feat: Vector retrieval matches tables

This commit is contained in:
junjun
2025-09-25 11:19:19 +08:00
committed by Junjun
parent ee1c0c0fa9
commit 69bba263e2
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -145,7 +145,7 @@ async def stream_sql(session: SessionDep, current_user: CurrentUser, request_que
"""
try:
llm_service = await LLMService.create(current_user, request_question, current_assistant)
llm_service = await LLMService.create(current_user, request_question, current_assistant, embedding=True)
llm_service.init_record()
llm_service.run_task_async()
except Exception as e:
+2 -2
View File
@@ -85,7 +85,7 @@ class LLMService:
def __init__(self, current_user: CurrentUser, chat_question: ChatQuestion,
current_assistant: Optional[CurrentAssistant] = None, no_reasoning: bool = False,
config: LLMConfig = None):
embedding: bool = False, config: LLMConfig = None):
self.chunk_list = []
# engine = create_engine(str(settings.SQLALCHEMY_DATABASE_URI))
# session_maker = sessionmaker(bind=engine)
@@ -115,7 +115,7 @@ class LLMService:
raise SingleMessageError("No available datasource configuration found")
chat_question.engine = (ds.type_name if ds.type != 'excel' else 'PostgreSQL') + get_version(ds)
chat_question.db_schema = get_table_schema(session=self.session, current_user=current_user, ds=ds,
question=chat_question.question)
question=chat_question.question, embedding=embedding)
self.generate_sql_logs = list_generate_sql_logs(session=self.session, chart_id=chat_id)
self.generate_chart_logs = list_generate_chart_logs(session=self.session, chart_id=chat_id)