From eb6e89e5c84064d5d959d8fd8079fdfff52d4eb5 Mon Sep 17 00:00:00 2001 From: ulleo Date: Tue, 14 Oct 2025 18:55:21 +0800 Subject: [PATCH] fix: 'Session' object has no attribute 'exec' --- backend/apps/chat/task/llm.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backend/apps/chat/task/llm.py b/backend/apps/chat/task/llm.py index b9d0a3b3..3fa327a3 100644 --- a/backend/apps/chat/task/llm.py +++ b/backend/apps/chat/task/llm.py @@ -56,7 +56,7 @@ dynamic_ds_types = [1, 3] dynamic_subsql_prefix = 'select * from sqlbot_dynamic_temp_table_' -session_maker = scoped_session(sessionmaker(bind=engine)) +session_maker = scoped_session(sessionmaker(bind=engine, class_=Session)) class LLMService: @@ -88,7 +88,6 @@ def __init__(self, session: Session, current_user: CurrentUser, chat_question: C current_assistant: Optional[CurrentAssistant] = None, no_reasoning: bool = False, embedding: bool = False, config: LLMConfig = None): self.chunk_list = [] - session.exec = session.exec if hasattr(session, "exec") else session.execute self.current_user = current_user self.current_assistant = current_assistant chat_id = chat_question.chat_id