From c5f8146f25747dd9e00947fc6cb563d71a800de7 Mon Sep 17 00:00:00 2001 From: ulleo Date: Wed, 30 Jul 2025 15:08:49 +0800 Subject: [PATCH] feat: modify template --- backend/apps/chat/task/llm.py | 2 ++ backend/template.yaml | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/apps/chat/task/llm.py b/backend/apps/chat/task/llm.py index e758fa93..b0ec1cfb 100644 --- a/backend/apps/chat/task/llm.py +++ b/backend/apps/chat/task/llm.py @@ -439,6 +439,7 @@ class LLMService: _ds = self.out_ds_instance.get_ds(data['id']) self.ds = _ds self.chat_question.engine = _ds.type + self.chat_question.db_schema = self.out_ds_instance.get_db_schema(ds.id) _engine_type = self.chat_question.engine _chat.engine_type = _ds.type else: @@ -448,6 +449,7 @@ class LLMService: raise Exception(f"Datasource configuration with id {_datasource} not found") self.ds = CoreDatasource(**_ds.model_dump()) self.chat_question.engine = _ds.type_name if _ds.type != 'excel' else 'PostgreSQL' + self.chat_question.db_schema = get_table_schema(session=self.session, current_user=self.current_user, ds=self.ds) _engine_type = self.chat_question.engine _chat.engine_type = _ds.type_name # save chat diff --git a/backend/template.yaml b/backend/template.yaml index 60eb5a5b..0c86b1ce 100644 --- a/backend/template.yaml +++ b/backend/template.yaml @@ -54,13 +54,13 @@ template: ] ``` + ### 提供表结构如下: + {schema} + ### 响应, 请直接返回JSON结果: ```json user: | - ### 提供表结构如下: - {schema} - ### 问题: {question}