From eb4e12d3c57cee94c9012ee9c13b0a40debd0be4 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Tue, 23 Jul 2024 19:50:43 +0530 Subject: [PATCH] s/online_context/onlineContext chat API response field for consistency This will align the name of the online context field returned by current chat message and chat history --- src/interface/desktop/chatutils.js | 2 +- src/interface/obsidian/src/chat_view.ts | 2 +- src/khoj/interface/web/chat.html | 2 +- src/khoj/routers/api_chat.py | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/interface/desktop/chatutils.js b/src/interface/desktop/chatutils.js index 84f5e431..4f4fb64e 100644 --- a/src/interface/desktop/chatutils.js +++ b/src/interface/desktop/chatutils.js @@ -515,7 +515,7 @@ function processMessageChunk(rawChunk) { isVoice: false, } } else if (chunk.type === "references") { - chatMessageState.references = {"notes": chunk.data.context, "online": chunk.data.online_results}; + chatMessageState.references = {"notes": chunk.data.context, "online": chunk.data.onlineContext}; } else if (chunk.type === 'message') { const chunkData = chunk.data; if (typeof chunkData === 'object' && chunkData !== null) { diff --git a/src/interface/obsidian/src/chat_view.ts b/src/interface/obsidian/src/chat_view.ts index efde958b..a6c62fd5 100644 --- a/src/interface/obsidian/src/chat_view.ts +++ b/src/interface/obsidian/src/chat_view.ts @@ -947,7 +947,7 @@ export class KhojChatView extends KhojPaneView { isVoice: false, }; } else if (chunk.type === "references") { - this.chatMessageState.references = {"notes": chunk.data.context, "online": chunk.data.online_results}; + this.chatMessageState.references = {"notes": chunk.data.context, "online": chunk.data.onlineContext}; } else if (chunk.type === 'message') { const chunkData = chunk.data; if (typeof chunkData === 'object' && chunkData !== null) { diff --git a/src/khoj/interface/web/chat.html b/src/khoj/interface/web/chat.html index b9ed5609..616e66bc 100644 --- a/src/khoj/interface/web/chat.html +++ b/src/khoj/interface/web/chat.html @@ -834,7 +834,7 @@ To get started, just start typing below. You can also type / to see a list of co isVoice: false, } } else if (chunk.type === "references") { - chatMessageState.references = {"notes": chunk.data.context, "online": chunk.data.online_results}; + chatMessageState.references = {"notes": chunk.data.context, "online": chunk.data.onlineContext}; } else if (chunk.type === 'message') { const chunkData = chunk.data; if (typeof chunkData === 'object' && chunkData !== null) { diff --git a/src/khoj/routers/api_chat.py b/src/khoj/routers/api_chat.py index d8826264..019d0fa9 100644 --- a/src/khoj/routers/api_chat.py +++ b/src/khoj/routers/api_chat.py @@ -831,7 +831,7 @@ async def chat( { "inferredQueries": inferred_queries, "context": compiled_references, - "online_results": online_results, + "onlineContext": online_results, }, ): yield result @@ -887,7 +887,7 @@ async def chat( "content-type": "application/json", "intentType": intent_type, "context": compiled_references, - "online_results": online_results, + "onlineContext": online_results, "inferredQueries": [improved_image_prompt], "image": image, }