mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-12 06:38:59 +08:00
Add template DB Assistant and exesql sql column description (#2054)
### What problem does this PR solve? ### Type of change - [x] New Feature (non-breaking change which adds functionality) --------- Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
This commit is contained in:
parent
20f3f54714
commit
21f2c5838b
@ -82,9 +82,9 @@ class ExeSQL(ComponentBase, ABC):
|
||||
continue
|
||||
try:
|
||||
query = db.execute_sql(single_sql)
|
||||
sql_res.append(
|
||||
{"content": "\n##Total: " + str(query.rowcount) + "\n" + pd.DataFrame(
|
||||
[i for i in query.fetchmany(size=self._param.top_n)]).to_markdown()})
|
||||
single_res = pd.DataFrame([i for i in query.fetchmany(size=self._param.top_n)])
|
||||
single_res.columns = [i[0] for i in query.description]
|
||||
sql_res.append({"content": "\nTotal: " + str(query.rowcount) + "\n" + single_res.to_markdown()})
|
||||
except Exception as e:
|
||||
sql_res.append({"content": "**Error**:" + str(e) + "\nError SQL Statement:" + single_sql})
|
||||
pass
|
||||
|
681
agent/templates/DB Assistant.json
Normal file
681
agent/templates/DB Assistant.json
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user