mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-04 13:20:17 +00:00
Fix handling of inline base64 images by Obsidian, Desktop clients
Fix for #1082 pushed down adding the `data:image/webp;base64' prefix of the base64 images to the server image gen API. But the code on the Obsidian and Desktop client still add these prefixes. This change stops the Desktop, Obsidian clients from adding the prefix as it is being handled by the API now. It should resolve showing images inline in those clients as well
This commit is contained in:
@@ -524,21 +524,14 @@ export class KhojChatView extends KhojPaneView {
|
||||
} else if (intentType === "text-to-image2") {
|
||||
imageMarkdown = ``;
|
||||
} else if (intentType === "text-to-image-v3") {
|
||||
imageMarkdown = ``;
|
||||
imageMarkdown = ``;
|
||||
} else if (intentType === "excalidraw" || excalidrawDiagram) {
|
||||
const domain = this.setting.khojUrl.endsWith("/") ? this.setting.khojUrl : `${this.setting.khojUrl}/`;
|
||||
const redirectMessage = `Hey, I'm not ready to show you diagrams yet here. But you can view it in ${domain}chat?conversationId=${conversationId}`;
|
||||
imageMarkdown = redirectMessage;
|
||||
} else if (images && images.length > 0) {
|
||||
for (let image of images) {
|
||||
if (image.startsWith("https://")) {
|
||||
imageMarkdown += `\n\n`;
|
||||
} else {
|
||||
imageMarkdown += `\n\n`;
|
||||
}
|
||||
}
|
||||
|
||||
imageMarkdown += `${message}`;
|
||||
imageMarkdown += images.map(image => ``).join('\n\n');
|
||||
imageMarkdown += message;
|
||||
}
|
||||
|
||||
if (images?.length === 0 && inferredQueries) {
|
||||
@@ -1384,7 +1377,7 @@ export class KhojChatView extends KhojPaneView {
|
||||
} else if (imageJson.intentType === "text-to-image2") {
|
||||
rawResponse += ``;
|
||||
} else if (imageJson.intentType === "text-to-image-v3") {
|
||||
rawResponse = ``;
|
||||
rawResponse = ``;
|
||||
} else if (imageJson.intentType === "excalidraw") {
|
||||
const domain = this.setting.khojUrl.endsWith("/") ? this.setting.khojUrl : `${this.setting.khojUrl}/`;
|
||||
const redirectMessage = `Hey, I'm not ready to show you diagrams yet here. But you can view it in ${domain}`;
|
||||
@@ -1396,12 +1389,7 @@ export class KhojChatView extends KhojPaneView {
|
||||
} else if (imageJson.images) {
|
||||
// If response has images field, response is a list of generated images.
|
||||
imageJson.images.forEach((image: any) => {
|
||||
|
||||
if (image.startsWith("http")) {
|
||||
rawResponse += `\n\n`;
|
||||
} else {
|
||||
rawResponse += `\n\n`;
|
||||
}
|
||||
rawResponse += `\n\n`;
|
||||
});
|
||||
} else if (imageJson.excalidrawDiagram) {
|
||||
const domain = this.setting.khojUrl.endsWith("/") ? this.setting.khojUrl : `${this.setting.khojUrl}/`;
|
||||
|
||||
Reference in New Issue
Block a user