diff --git a/src/khoj/processor/conversation/google/utils.py b/src/khoj/processor/conversation/google/utils.py index f397bf52..acda998d 100644 --- a/src/khoj/processor/conversation/google/utils.py +++ b/src/khoj/processor/conversation/google/utils.py @@ -238,7 +238,7 @@ async def gemini_chat_completion_with_backoff( break # emit thought vs response parts - for part in chunk.candidates[0].content.parts: + for part in chunk.candidates[0].content.parts or []: if part.thought: yield ResponseWithThought(thought=part.text) elif part.text: diff --git a/src/khoj/routers/api_chat.py b/src/khoj/routers/api_chat.py index da52746a..8091a13d 100644 --- a/src/khoj/routers/api_chat.py +++ b/src/khoj/routers/api_chat.py @@ -1057,7 +1057,7 @@ async def chat( # researched_results = await extract_relevant_info(q, researched_results, agent) if state.verbose > 1: - logger.debug(f'Researched Results: {"".join(r.summarizedResult for r in research_results)}') + logger.debug(f'Researched Results: {"".join(r.summarizedResult or "" for r in research_results)}') # Gather Context ## Extract Document References