mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-02 00:28:00 +00:00
notes:
1) move the function _generate_numbered_list from excel_analyze/chat.py to base_chat.py
This commit is contained in:
parent
82cea5d87f
commit
eeaf95a5d2
@ -458,6 +458,54 @@ class BaseChat(ABC):
|
|||||||
else:
|
else:
|
||||||
return prompt_define_response
|
return prompt_define_response
|
||||||
|
|
||||||
|
def _generate_numbered_list(self) -> str:
|
||||||
|
"""this function is moved from excel_analyze/chat.py,and used by subclass.
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
antv_charts = [
|
||||||
|
{"response_line_chart": "used to display comparative trend analysis data"},
|
||||||
|
{
|
||||||
|
"response_pie_chart": "suitable for scenarios such as proportion and distribution statistics"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"response_table": "suitable for display with many display columns or non-numeric columns"
|
||||||
|
},
|
||||||
|
# {"response_data_text":" the default display method, suitable for single-line or simple content display"},
|
||||||
|
{
|
||||||
|
"response_scatter_plot": "Suitable for exploring relationships between variables, detecting outliers, etc."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"response_bubble_chart": "Suitable for relationships between multiple variables, highlighting outliers or special situations, etc."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"response_donut_chart": "Suitable for hierarchical structure representation, category proportion display and highlighting key categories, etc."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"response_area_chart": "Suitable for visualization of time series data, comparison of multiple groups of data, analysis of data change trends, etc."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"response_heatmap": "Suitable for visual analysis of time series data, large-scale data sets, distribution of classified data, etc."
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
# command_strings = []
|
||||||
|
# if CFG.command_disply:
|
||||||
|
# for name, item in CFG.command_disply.commands.items():
|
||||||
|
# if item.enabled:
|
||||||
|
# command_strings.append(f"{name}:{item.description}")
|
||||||
|
# command_strings += [
|
||||||
|
# str(item)
|
||||||
|
# for item in CFG.command_disply.commands.values()
|
||||||
|
# if item.enabled
|
||||||
|
# ]
|
||||||
|
return "\n".join(
|
||||||
|
f"{key}:{value}"
|
||||||
|
for dict_item in antv_charts
|
||||||
|
for key, value in dict_item.items()
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _build_model_operator(
|
def _build_model_operator(
|
||||||
is_stream: bool = False, dag_name: str = "llm_model_dag"
|
is_stream: bool = False, dag_name: str = "llm_model_dag"
|
||||||
@ -665,4 +713,4 @@ def _load_history_messages(
|
|||||||
ModelMessage(role=message_type, content=message_content)
|
ModelMessage(role=message_type, content=message_content)
|
||||||
)
|
)
|
||||||
|
|
||||||
return history_text if str_message else history_messages
|
return history_text if str_message else history_messages
|
@ -50,49 +50,6 @@ class ChatExcel(BaseChat):
|
|||||||
self.api_call = ApiCall(display_registry=CFG.command_disply)
|
self.api_call = ApiCall(display_registry=CFG.command_disply)
|
||||||
super().__init__(chat_param=chat_param)
|
super().__init__(chat_param=chat_param)
|
||||||
|
|
||||||
def _generate_numbered_list(self) -> str:
|
|
||||||
antv_charts = [
|
|
||||||
{"response_line_chart": "used to display comparative trend analysis data"},
|
|
||||||
{
|
|
||||||
"response_pie_chart": "suitable for scenarios such as proportion and distribution statistics"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"response_table": "suitable for display with many display columns or non-numeric columns"
|
|
||||||
},
|
|
||||||
# {"response_data_text":" the default display method, suitable for single-line or simple content display"},
|
|
||||||
{
|
|
||||||
"response_scatter_plot": "Suitable for exploring relationships between variables, detecting outliers, etc."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"response_bubble_chart": "Suitable for relationships between multiple variables, highlighting outliers or special situations, etc."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"response_donut_chart": "Suitable for hierarchical structure representation, category proportion display and highlighting key categories, etc."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"response_area_chart": "Suitable for visualization of time series data, comparison of multiple groups of data, analysis of data change trends, etc."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"response_heatmap": "Suitable for visual analysis of time series data, large-scale data sets, distribution of classified data, etc."
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
# command_strings = []
|
|
||||||
# if CFG.command_disply:
|
|
||||||
# for name, item in CFG.command_disply.commands.items():
|
|
||||||
# if item.enabled:
|
|
||||||
# command_strings.append(f"{name}:{item.description}")
|
|
||||||
# command_strings += [
|
|
||||||
# str(item)
|
|
||||||
# for item in CFG.command_disply.commands.values()
|
|
||||||
# if item.enabled
|
|
||||||
# ]
|
|
||||||
return "\n".join(
|
|
||||||
f"{key}:{value}"
|
|
||||||
for dict_item in antv_charts
|
|
||||||
for key, value in dict_item.items()
|
|
||||||
)
|
|
||||||
|
|
||||||
@trace()
|
@trace()
|
||||||
async def generate_input_values(self) -> Dict:
|
async def generate_input_values(self) -> Dict:
|
||||||
input_values = {
|
input_values = {
|
||||||
|
@ -89,46 +89,3 @@ class ChatWithDbAutoExecute(BaseChat):
|
|||||||
def do_action(self, prompt_response):
|
def do_action(self, prompt_response):
|
||||||
print(f"do_action:{prompt_response}")
|
print(f"do_action:{prompt_response}")
|
||||||
return self.database.run_to_df
|
return self.database.run_to_df
|
||||||
|
|
||||||
def _generate_numbered_list(self) -> str:
|
|
||||||
antv_charts = [
|
|
||||||
{"response_line_chart": "used to display comparative trend analysis data"},
|
|
||||||
{
|
|
||||||
"response_pie_chart": "suitable for scenarios such as proportion and distribution statistics"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"response_table": "suitable for display with many display columns or non-numeric columns"
|
|
||||||
},
|
|
||||||
# {"response_data_text":" the default display method, suitable for single-line or simple content display"},
|
|
||||||
{
|
|
||||||
"response_scatter_plot": "Suitable for exploring relationships between variables, detecting outliers, etc."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"response_bubble_chart": "Suitable for relationships between multiple variables, highlighting outliers or special situations, etc."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"response_donut_chart": "Suitable for hierarchical structure representation, category proportion display and highlighting key categories, etc."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"response_area_chart": "Suitable for visualization of time series data, comparison of multiple groups of data, analysis of data change trends, etc."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"response_heatmap": "Suitable for visual analysis of time series data, large-scale data sets, distribution of classified data, etc."
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
# command_strings = []
|
|
||||||
# if CFG.command_disply:
|
|
||||||
# for name, item in CFG.command_disply.commands.items():
|
|
||||||
# if item.enabled:
|
|
||||||
# command_strings.append(f"{name}:{item.description}")
|
|
||||||
# command_strings += [
|
|
||||||
# str(item)
|
|
||||||
# for item in CFG.command_disply.commands.values()
|
|
||||||
# if item.enabled
|
|
||||||
# ]
|
|
||||||
return "\n".join(
|
|
||||||
f"{key}:{value}"
|
|
||||||
for dict_item in antv_charts
|
|
||||||
for key, value in dict_item.items()
|
|
||||||
)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user