mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 23:48:56 +01:00
Fix chat history construction when generating chatml msgs with context
This commit is contained in:
parent
7d9a06c8ab
commit
3b978b9b67
2 changed files with 2 additions and 2 deletions
|
@ -203,7 +203,7 @@ def generate_chatml_messages_with_context(
|
|||
chatml_messages.insert(0, reconstructed_context_message)
|
||||
|
||||
role = "user" if chat["by"] == "you" else "assistant"
|
||||
message_content = construct_structured_message(message_content, chat.get("images"), model_type, vision_enabled)
|
||||
message_content = construct_structured_message(chat["message"], chat.get("images"), model_type, vision_enabled)
|
||||
|
||||
reconstructed_message = ChatMessage(content=message_content, role=role)
|
||||
chatml_messages.insert(0, reconstructed_message)
|
||||
|
|
|
@ -112,7 +112,7 @@ def add_files_filter(request: Request, filter: FilesFilterRequest):
|
|||
file_filters = ConversationAdapters.add_files_to_filter(request.user.object, conversation_id, files_filter)
|
||||
return Response(content=json.dumps(file_filters), media_type="application/json", status_code=200)
|
||||
except Exception as e:
|
||||
logger.error(f"Error adding file filter {filter.filename}: {e}", exc_info=True)
|
||||
logger.error(f"Error adding file filter {filter.filenames}: {e}", exc_info=True)
|
||||
raise HTTPException(status_code=422, detail=str(e))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue