WEB API independent

This commit is contained in:
yhjun1026 2023-07-07 16:02:17 +08:00
parent 8dc4f54ed6
commit 28a08a1245
4 changed files with 10 additions and 10 deletions

View File

@ -319,10 +319,11 @@ class Database:
result = list(result)
result.insert(0, field_names)
print("DDL Result:" + str(result))
if not result:
return self.__query(session, "SHOW COLUMNS FROM test")
return result
else:
return []
return self.__query(session, "SHOW COLUMNS FROM test")
def run_no_throw(self, session, command: str, fetch: str = "all") -> List:
"""Execute a SQL command and return a string representing the results.
@ -385,7 +386,7 @@ class Database:
elif cmd_type == "delete":
table_name = parts[2] # delete from <table_name> ...
# 返回一个select语句它选择该表的所有数据
return f"SELECT * FROM {table_name}"
return f"SELECT * FROM {table_name} "
elif cmd_type == "update":
table_name = parts[1]

View File

@ -14,7 +14,7 @@ class Scene:
class ChatScene(Enum):
ChatWithDbExecute = Scene("chat_with_db_execute", "Chat Data",
"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"])
ChatExecution = Scene("chat_execution", "Plugin", "Use tools through dialogue to accomplish your goals.",
["Plugin Select"])

View File

@ -16,8 +16,7 @@ According to the structure definition in the following tables:
Provide professional data analysis to support the goal:
{input}
Constraint:
Provide multi-dimensional analysis as much as possible according to the target requirements, no less than three and no more than 8 dimensions.
Provide multi-dimensional analysis as much as possible according to the target requirements, no less than 3 and no more than 8 dimensions.
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:
{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 possiblechart types:
{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}
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
"""

View File

@ -3,7 +3,8 @@
"name": "sale_report",
"introduce": "",
"layout": "TODO",
"supported_chart_type":["FacetChart", "GaugeChart", "RadarChart", "Sheet", "LineChart", "PieChart", "BarChart", "PointChart", "KeyMetrics"],
"supported_chart_type":[ "Table", "LineChart", "BarChart", "IndicatorValue"],
"key_metrics":[],
"trends": []
}
}