diff --git a/pilot/common/sql_database.py b/pilot/common/sql_database.py index 8b6c5dfbe..61daf6a88 100644 --- a/pilot/common/sql_database.py +++ b/pilot/common/sql_database.py @@ -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 ... # 返回一个select语句,它选择该表的所有数据 - return f"SELECT * FROM {table_name}" + return f"SELECT * FROM {table_name} " elif cmd_type == "update": table_name = parts[1] diff --git a/pilot/scene/base.py b/pilot/scene/base.py index 57a1e2644..def42888f 100644 --- a/pilot/scene/base.py +++ b/pilot/scene/base.py @@ -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"]) diff --git a/pilot/scene/chat_dashboard/prompt.py b/pilot/scene/chat_dashboard/prompt.py index 212d24e96..045bf3466 100644 --- a/pilot/scene/chat_dashboard/prompt.py +++ b/pilot/scene/chat_dashboard/prompt.py @@ -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 possible,chart 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 """ diff --git a/pilot/scene/chat_dashboard/template/sales_report/dashboard.json b/pilot/scene/chat_dashboard/template/sales_report/dashboard.json index ab1e7abdf..4054688c8 100644 --- a/pilot/scene/chat_dashboard/template/sales_report/dashboard.json +++ b/pilot/scene/chat_dashboard/template/sales_report/dashboard.json @@ -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": [] -} \ No newline at end of file +} +