mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-02 08:40:36 +00:00
fix(ChatExcel): ChatExcel OutParse Bug Fix
1.ChatExcel OutParse Bug Fix 2
This commit is contained in:
parent
95badc5cdf
commit
cf9d9bd48e
@ -30,7 +30,10 @@ class ChatDashboardOutputParser(BaseOutputParser):
|
||||
for item in response:
|
||||
chart_items.append(
|
||||
ChartItem(
|
||||
item["sql"].replace("\\", " "), item["title"], item["thoughts"], item["showcase"]
|
||||
item["sql"].replace("\\", " "),
|
||||
item["title"],
|
||||
item["thoughts"],
|
||||
item["showcase"],
|
||||
)
|
||||
)
|
||||
return chart_items
|
||||
|
@ -45,8 +45,12 @@ def deep_quotes(token, column_names=[]):
|
||||
if __name__ == "__main__":
|
||||
sql = "SELECT `地区`, (`2021年人口` - `2001年人口`) / `2001年人口` * 100 AS `Population_Growth_Rate` FROM Generated_by_ChatExcel_table1 (2)"
|
||||
if f'"Generated_by_ChatExcel_table1 (2)"' not in sql:
|
||||
sql = sql.replace('Generated_by_ChatExcel_table1 (2)', f'"Generated_by_ChatExcel_table1 (2)"')
|
||||
sql = add_quotes_ex(sql, ['地区', '地区代码', '2001年人口', '2006年人口', '2011年人口', '2016年人口', '2021年人口'])
|
||||
sql = sql.replace(
|
||||
"Generated_by_ChatExcel_table1 (2)", f'"Generated_by_ChatExcel_table1 (2)"'
|
||||
)
|
||||
sql = add_quotes_ex(
|
||||
sql, ["地区", "地区代码", "2001年人口", "2006年人口", "2011年人口", "2016年人口", "2021年人口"]
|
||||
)
|
||||
print(f"excute sql:{sql}")
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user