mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 13:18:18 +00:00
Fix extracting inferred queries from chat history db
Inferred queries is stored with underscore in db but aliased with - in memory. This conversation.messages logic was broken, so inferred queries field of chat message history was getting ignored. This change fixes that issue and improve previous image generation description for better context for subsequent image generation attempts.
This commit is contained in:
@@ -636,9 +636,9 @@ class Conversation(DbBaseModel):
|
||||
for msg in self.conversation_log.get("chat", []):
|
||||
try:
|
||||
# Clean up inferred queries if they contain None
|
||||
if msg.get("intent") and msg["intent"].get("inferred-queries"):
|
||||
if msg.get("intent") and msg["intent"].get("inferred_queries"):
|
||||
msg["intent"]["inferred-queries"] = [
|
||||
q for q in msg["intent"]["inferred-queries"] if q is not None and isinstance(q, str)
|
||||
q for q in msg["intent"]["inferred_queries"] if q is not None and isinstance(q, str)
|
||||
]
|
||||
msg["message"] = str(msg.get("message", ""))
|
||||
validated_messages.append(ChatMessageModel.model_validate(msg))
|
||||
|
||||
Reference in New Issue
Block a user