From a539761c49b34d701f4ff44796e13b124a88c306 Mon Sep 17 00:00:00 2001 From: sabaimran Date: Sat, 30 Nov 2024 12:35:13 -0800 Subject: [PATCH] Fix processing of excalidrawdiagram in json response chunking --- src/khoj/routers/helpers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/khoj/routers/helpers.py b/src/khoj/routers/helpers.py index 92b2b1aa..d54ae4f7 100644 --- a/src/khoj/routers/helpers.py +++ b/src/khoj/routers/helpers.py @@ -1807,7 +1807,7 @@ class MessageProcessor: self.raw_response = "" self.generated_images = [] self.generated_files = [] - self.generated_excalidraw_diagrams = [] + self.generated_excalidraw_diagram = [] def convert_message_chunk_to_json(self, raw_chunk: str) -> Dict[str, Any]: if raw_chunk.startswith("{") and raw_chunk.endswith("}"): @@ -1854,8 +1854,8 @@ class MessageProcessor: self.generated_images = chunk_data[key] elif key == "files": self.generated_files = chunk_data[key] - elif key == "excalidraw_diagrams": - self.generated_excalidraw_diagrams = chunk_data[key] + elif key == "excalidrawDiagram": + self.generated_excalidraw_diagram = chunk_data[key] def handle_json_response(self, json_data: Dict[str, str]) -> str | Dict[str, str]: if "image" in json_data or "details" in json_data: @@ -1892,7 +1892,7 @@ async def read_chat_stream(response_iterator: AsyncGenerator[str, None]) -> Dict "usage": processor.usage, "images": processor.generated_images, "files": processor.generated_files, - "excalidraw_diagrams": processor.generated_excalidraw_diagrams, + "excalidrawDiagram": processor.generated_excalidraw_diagram, }