mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 21:29:11 +00:00
Fix conversation look up logic
This commit is contained in:
@@ -890,8 +890,18 @@ async def chat(
|
|||||||
_custom_filters.append("site:khoj.dev")
|
_custom_filters.append("site:khoj.dev")
|
||||||
conversation_commands.append(ConversationCommand.Online)
|
conversation_commands.append(ConversationCommand.Online)
|
||||||
|
|
||||||
conversation = await ConversationAdapters.aget_conversation_by_user(user, conversation_id=conversation_id)
|
conversation = await ConversationAdapters.aget_conversation_by_user(
|
||||||
|
user, request.user.client_app, conversation_id, title
|
||||||
|
)
|
||||||
conversation_id = conversation.id if conversation else None
|
conversation_id = conversation.id if conversation else None
|
||||||
|
|
||||||
|
if not conversation:
|
||||||
|
return Response(
|
||||||
|
content=f"No conversation found with requested id, title", media_type="text/plain", status_code=400
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
meta_log = conversation.conversation_log
|
||||||
|
|
||||||
if ConversationCommand.Summarize in conversation_commands:
|
if ConversationCommand.Summarize in conversation_commands:
|
||||||
file_filters = conversation.file_filters
|
file_filters = conversation.file_filters
|
||||||
llm_response = ""
|
llm_response = ""
|
||||||
@@ -933,17 +943,6 @@ async def chat(
|
|||||||
)
|
)
|
||||||
return StreamingResponse(content=llm_response, media_type="text/event-stream", status_code=200)
|
return StreamingResponse(content=llm_response, media_type="text/event-stream", status_code=200)
|
||||||
|
|
||||||
conversation = await ConversationAdapters.aget_conversation_by_user(
|
|
||||||
user, request.user.client_app, conversation_id, title
|
|
||||||
)
|
|
||||||
conversation_id = conversation.id if conversation else None
|
|
||||||
if not conversation:
|
|
||||||
return Response(
|
|
||||||
content=f"No conversation found with requested id, title", media_type="text/plain", status_code=400
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
meta_log = conversation.conversation_log
|
|
||||||
|
|
||||||
is_automated_task = conversation_commands == [ConversationCommand.AutomatedTask]
|
is_automated_task = conversation_commands == [ConversationCommand.AutomatedTask]
|
||||||
|
|
||||||
if conversation_commands == [ConversationCommand.Default] or is_automated_task:
|
if conversation_commands == [ConversationCommand.Default] or is_automated_task:
|
||||||
|
|||||||
Reference in New Issue
Block a user