Skip to content

Commit c5f8146

Browse files
committed
feat: modify template
1 parent dc42cf7 commit c5f8146

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

backend/apps/chat/task/llm.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ def select_datasource(self):
439439
_ds = self.out_ds_instance.get_ds(data['id'])
440440
self.ds = _ds
441441
self.chat_question.engine = _ds.type
442+
self.chat_question.db_schema = self.out_ds_instance.get_db_schema(ds.id)
442443
_engine_type = self.chat_question.engine
443444
_chat.engine_type = _ds.type
444445
else:
@@ -448,6 +449,7 @@ def select_datasource(self):
448449
raise Exception(f"Datasource configuration with id {_datasource} not found")
449450
self.ds = CoreDatasource(**_ds.model_dump())
450451
self.chat_question.engine = _ds.type_name if _ds.type != 'excel' else 'PostgreSQL'
452+
self.chat_question.db_schema = get_table_schema(session=self.session, current_user=self.current_user, ds=self.ds)
451453
_engine_type = self.chat_question.engine
452454
_chat.engine_type = _ds.type_name
453455
# save chat

backend/template.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ template:
5454
]
5555
```
5656
57+
### 提供表结构如下:
58+
{schema}
59+
5760
### 响应, 请直接返回JSON结果:
5861
```json
5962
6063
user: |
61-
### 提供表结构如下:
62-
{schema}
63-
6464
### 问题:
6565
{question}
6666

0 commit comments

Comments
 (0)