mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-09 17:57:06 +08:00
feat: view sql in chat
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user