feat: view sql in chat

This commit is contained in:
ulleo
2025-07-21 14:27:49 +08:00
parent 9c23895fc6
commit 707bde759a
5 changed files with 42 additions and 4 deletions
+7
View File
@@ -1,4 +1,5 @@
import datetime
import sqlparse
from typing import List
import orjson
@@ -128,6 +129,12 @@ def format_record(record: ChatRecord):
_dict['predict_data'] = _obj
except Exception:
pass
if record.sql and record.sql.strip() != '':
try:
_dict['sql'] = sqlparse.format(record.sql, reindent=True)
except Exception:
pass
return _dict
+1
View File
@@ -38,6 +38,7 @@ dependencies = [
"tabulate>=0.9.0",
"sqlbot-xpack==0.0.3.5",
"fastapi-cache2>=0.2.2",
"sqlparse>=0.5.3",
]
[[tool.uv.index]]
name = "default"