diff --git a/src/khoj/processor/conversation/utils.py b/src/khoj/processor/conversation/utils.py index 74c464d9..c6b3bc2f 100644 --- a/src/khoj/processor/conversation/utils.py +++ b/src/khoj/processor/conversation/utils.py @@ -338,7 +338,11 @@ def generate_chatml_messages_with_context( message_context += chat.get("intent").get("inferred-queries")[0] if not is_none_or_empty(chat.get("context")): references = "\n\n".join( - {f"# File: {item['file']}\n## {item['compiled']}\n" for item in chat.get("context") or []} + { + f"# File: {item['file']}\n## {item['compiled']}\n" + for item in chat.get("context") or [] + if isinstance(item, dict) + } ) message_context += f"{prompts.notes_conversation.format(references=references)}\n\n" if not is_none_or_empty(chat.get("onlineContext")):