From 8f7f67dd55a475b8b055accf02231f52e525d23c Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 29 Jul 2025 20:38:35 +0800 Subject: [PATCH] perf: Assistant ds --- backend/apps/chat/task/llm.py | 2 +- backend/apps/system/crud/assistant.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/apps/chat/task/llm.py b/backend/apps/chat/task/llm.py index f59d6ad9..9e4e832c 100644 --- a/backend/apps/chat/task/llm.py +++ b/backend/apps/chat/task/llm.py @@ -365,7 +365,7 @@ class LLMService: datasource_msg: List[Union[BaseMessage, dict[str, Any]]] = [] datasource_msg.append(SystemMessage(self.chat_question.datasource_sys_question())) if self.current_assistant: - _ds_list = get_assistant_ds(llm_service=self) + _ds_list = get_assistant_ds(session=self.session, llm_service=self) else: oid: str = self.current_user.oid stmt = select(CoreDatasource.id, CoreDatasource.name, CoreDatasource.description).where( diff --git a/backend/apps/system/crud/assistant.py b/backend/apps/system/crud/assistant.py index 090c4f1b..8238ab45 100644 --- a/backend/apps/system/crud/assistant.py +++ b/backend/apps/system/crud/assistant.py @@ -29,9 +29,8 @@ def get_assistant_user(*, id: int): email="sqlbot-inner-assistant@sqlbot.com") -def get_assistant_ds(llm_service) -> list[dict]: +def get_assistant_ds(session: Session, llm_service) -> list[dict]: assistant: AssistantHeader = llm_service.current_assistant - session: Session = llm_service.session type = assistant.type if type == 0: configuration = assistant.configuration