From 9b61f0b5f7d7b39b07b6115303d741ea2ba646a1 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Sun, 25 Feb 2024 00:11:11 +0530 Subject: [PATCH] Fix rendering images from Khoj response in Obsidian client --- src/interface/obsidian/src/chat_modal.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/interface/obsidian/src/chat_modal.ts b/src/interface/obsidian/src/chat_modal.ts index dbdfa667..d7688d35 100644 --- a/src/interface/obsidian/src/chat_modal.ts +++ b/src/interface/obsidian/src/chat_modal.ts @@ -398,7 +398,7 @@ export class KhojChatModal extends Modal { // Reset collated chat result to empty string this.result = ""; responseElement.innerHTML = ""; - if (response.headers.get("content-type") == "application/json") { + if (response.headers.get("content-type") === "application/json") { let responseText = "" try { const responseAsJson = await response.json() as ChatJsonResult; @@ -413,10 +413,10 @@ export class KhojChatModal extends Modal { } finally { await this.renderIncrementalMessage(responseElement, responseText); } + } else { + // Stream and render chat response + await this.readChatStream(response, responseElement); } - - // Stream and render chat response - await this.readChatStream(response, responseElement); } catch (err) { console.log(`Khoj chat response failed with\n${err}`); let errorMsg = "Sorry, unable to get response from Khoj backend ❤️‍🩹. Retry or contact developers for help at team@khoj.dev or on Discord";