mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 13:18:18 +00:00
Handle gemini chat response completion chunk when streaming
This commit is contained in:
@@ -238,7 +238,7 @@ async def gemini_chat_completion_with_backoff(
|
|||||||
break
|
break
|
||||||
|
|
||||||
# emit thought vs response parts
|
# 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:
|
if part.thought:
|
||||||
yield ResponseWithThought(thought=part.text)
|
yield ResponseWithThought(thought=part.text)
|
||||||
elif part.text:
|
elif part.text:
|
||||||
|
|||||||
@@ -1057,7 +1057,7 @@ async def chat(
|
|||||||
|
|
||||||
# researched_results = await extract_relevant_info(q, researched_results, agent)
|
# researched_results = await extract_relevant_info(q, researched_results, agent)
|
||||||
if state.verbose > 1:
|
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
|
# Gather Context
|
||||||
## Extract Document References
|
## Extract Document References
|
||||||
|
|||||||
Reference in New Issue
Block a user