From 3ff0dc4fb562cec82bbddc6092f292f44b75649f Mon Sep 17 00:00:00 2001 From: junjun Date: Fri, 10 Oct 2025 16:35:35 +0800 Subject: [PATCH] feat: Vector retrieval matches tables --- backend/apps/chat/task/llm.py | 3 ++- backend/apps/system/crud/assistant.py | 4 ++-- backend/common/core/config.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/apps/chat/task/llm.py b/backend/apps/chat/task/llm.py index 3cf88749e..a011eebe2 100644 --- a/backend/apps/chat/task/llm.py +++ b/backend/apps/chat/task/llm.py @@ -419,7 +419,8 @@ def select_datasource(self): full_thinking_text = '' full_text = '' if not ignore_auto_select: - if settings.TABLE_EMBEDDING_ENABLED: + if settings.TABLE_EMBEDDING_ENABLED and ( + not self.current_assistant or (self.current_assistant and self.current_assistant.type != 1)): ds = get_ds_embedding(self.session, self.current_user, _ds_list, self.out_ds_instance, self.chat_question.question, self.current_assistant) yield {'content': '{"id":' + str(ds.get('id')) + '}'} diff --git a/backend/apps/system/crud/assistant.py b/backend/apps/system/crud/assistant.py index d690eec26..5fdbcce3d 100644 --- a/backend/apps/system/crud/assistant.py +++ b/backend/apps/system/crud/assistant.py @@ -173,8 +173,8 @@ def get_db_schema(self, ds_id: int, question: str, embedding: bool = True) -> st tables.append(t_obj) # do table embedding - if embedding and tables and settings.TABLE_EMBEDDING_ENABLED: - tables = get_table_embedding(tables, question) + # if embedding and tables and settings.TABLE_EMBEDDING_ENABLED: + # tables = get_table_embedding(tables, question) if tables: for s in tables: diff --git a/backend/common/core/config.py b/backend/common/core/config.py index ca0468b85..dd666796b 100644 --- a/backend/common/core/config.py +++ b/backend/common/core/config.py @@ -105,7 +105,7 @@ def SQLALCHEMY_DATABASE_URI(self) -> PostgresDsn | str: PG_POOL_RECYCLE: int = 3600 PG_POOL_PRE_PING: bool = True - TABLE_EMBEDDING_ENABLED: bool = False + TABLE_EMBEDDING_ENABLED: bool = True TABLE_EMBEDDING_COUNT: int = 10