mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +00:00
Fix to return openai formatted messages in the correct order
We'd reversed the formatting of openai messages to drop invalid messages without affecting the other messages being appended . But we need to reverse the final formatted list to return in the right order.
This commit is contained in:
@@ -443,7 +443,7 @@ def format_message_for_api(raw_messages: List[ChatMessage], api_base_url: str) -
|
||||
continue
|
||||
formatted_messages.append({"role": message.role, "content": message.content})
|
||||
|
||||
return formatted_messages
|
||||
return list(reversed(formatted_messages))
|
||||
|
||||
|
||||
def is_openai_api(api_base_url: str = None) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user