mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-14 22:43:49 +00:00
WEB API independent
This commit is contained in:
parent
8dc4f54ed6
commit
28a08a1245
@ -319,10 +319,11 @@ class Database:
|
|||||||
result = list(result)
|
result = list(result)
|
||||||
result.insert(0, field_names)
|
result.insert(0, field_names)
|
||||||
print("DDL Result:" + str(result))
|
print("DDL Result:" + str(result))
|
||||||
|
if not result:
|
||||||
|
return self.__query(session, "SHOW COLUMNS FROM test")
|
||||||
return result
|
return result
|
||||||
else:
|
else:
|
||||||
return []
|
return self.__query(session, "SHOW COLUMNS FROM test")
|
||||||
|
|
||||||
def run_no_throw(self, session, command: str, fetch: str = "all") -> List:
|
def run_no_throw(self, session, command: str, fetch: str = "all") -> List:
|
||||||
"""Execute a SQL command and return a string representing the results.
|
"""Execute a SQL command and return a string representing the results.
|
||||||
@ -385,7 +386,7 @@ class Database:
|
|||||||
elif cmd_type == "delete":
|
elif cmd_type == "delete":
|
||||||
table_name = parts[2] # delete from <table_name> ...
|
table_name = parts[2] # delete from <table_name> ...
|
||||||
# 返回一个select语句,它选择该表的所有数据
|
# 返回一个select语句,它选择该表的所有数据
|
||||||
return f"SELECT * FROM {table_name}"
|
return f"SELECT * FROM {table_name} "
|
||||||
|
|
||||||
elif cmd_type == "update":
|
elif cmd_type == "update":
|
||||||
table_name = parts[1]
|
table_name = parts[1]
|
||||||
|
@ -14,7 +14,7 @@ class Scene:
|
|||||||
class ChatScene(Enum):
|
class ChatScene(Enum):
|
||||||
ChatWithDbExecute = Scene("chat_with_db_execute", "Chat Data",
|
ChatWithDbExecute = Scene("chat_with_db_execute", "Chat Data",
|
||||||
"Dialogue with your private data through natural language.", ["DB Select"])
|
"Dialogue with your private data through natural language.", ["DB Select"])
|
||||||
ChatWithDbQA = Scene("chat_with_db_qa", "Chat Meta Data", "Have a Professional Conversation with Metadata.",
|
ChatWithDbQA = Scene("chat_with_db_qa", "Chat DB", "Have a Professional Conversation with Metadata.",
|
||||||
["DB Select"])
|
["DB Select"])
|
||||||
ChatExecution = Scene("chat_execution", "Plugin", "Use tools through dialogue to accomplish your goals.",
|
ChatExecution = Scene("chat_execution", "Plugin", "Use tools through dialogue to accomplish your goals.",
|
||||||
["Plugin Select"])
|
["Plugin Select"])
|
||||||
|
@ -16,8 +16,7 @@ According to the structure definition in the following tables:
|
|||||||
Provide professional data analysis to support the goal:
|
Provide professional data analysis to support the goal:
|
||||||
{input}
|
{input}
|
||||||
|
|
||||||
Constraint:
|
Provide multi-dimensional analysis as much as possible according to the target requirements, no less than 3 and no more than 8 dimensions.
|
||||||
Provide multi-dimensional analysis as much as possible according to the target requirements, no less than three and no more than 8 dimensions.
|
|
||||||
The data columns of the analysis output should not exceed 4.
|
The data columns of the analysis output should not exceed 4.
|
||||||
According to the characteristics of the analyzed data, choose the most suitable one from the charts provided below for display, chart type:
|
According to the characteristics of the analyzed data, choose the most suitable one from the charts provided below for display, chart type:
|
||||||
{supported_chat_type}
|
{supported_chat_type}
|
||||||
@ -26,9 +25,8 @@ Pay attention to the length of the output content of the analysis result, do not
|
|||||||
According to the characteristics of the analyzed data, choose the best one from the charts provided below to display, use different types of charts as much as possible,chart types:
|
According to the characteristics of the analyzed data, choose the best one from the charts provided below to display, use different types of charts as much as possible,chart types:
|
||||||
{supported_chat_type}
|
{supported_chat_type}
|
||||||
|
|
||||||
Give {dialect} data analysis SQL, analysis title, display method and analytical thinking,respond in the following json format:
|
Give {dialect} data analysis SQL and do not use value not provided in sql, analysis title, display method and analytical thinking,respond in the following json format:
|
||||||
{response}
|
{response}
|
||||||
Do not use unprovided fields and value in the where condition of sql.
|
|
||||||
Ensure the response is correct json and can be parsed by Python json.loads
|
Ensure the response is correct json and can be parsed by Python json.loads
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
"name": "sale_report",
|
"name": "sale_report",
|
||||||
"introduce": "",
|
"introduce": "",
|
||||||
"layout": "TODO",
|
"layout": "TODO",
|
||||||
"supported_chart_type":["FacetChart", "GaugeChart", "RadarChart", "Sheet", "LineChart", "PieChart", "BarChart", "PointChart", "KeyMetrics"],
|
"supported_chart_type":[ "Table", "LineChart", "BarChart", "IndicatorValue"],
|
||||||
"key_metrics":[],
|
"key_metrics":[],
|
||||||
"trends": []
|
"trends": []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user