mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 05:40:17 +00:00
Use base64 encoded image instead of source URL for persistence
The source URL returned by OpenAI would expire soon. This would make the chat sessions contain non-accessible images/messages if using OpenaI image URL Get base64 encoded image from OpenAI and store directly in conversation logs. This resolves the image link expiring issue
This commit is contained in:
@@ -109,7 +109,7 @@ export class KhojChatModal extends Modal {
|
||||
if (!message) {
|
||||
return;
|
||||
} else if (intentType === "text-to-image") {
|
||||
let imageMarkdown = ``;
|
||||
let imageMarkdown = ``;
|
||||
this.renderMessage(chatEl, imageMarkdown, sender, dt);
|
||||
return;
|
||||
} else if (!context) {
|
||||
@@ -317,8 +317,8 @@ export class KhojChatModal extends Modal {
|
||||
if (responseText.startsWith("{") && responseText.endsWith("}")) {
|
||||
try {
|
||||
const responseAsJson = JSON.parse(responseText);
|
||||
if (responseAsJson.imageUrl) {
|
||||
responseText = ``;
|
||||
if (responseAsJson.image) {
|
||||
responseText = ``;
|
||||
} else if (responseAsJson.detail) {
|
||||
responseText = responseAsJson.detail;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user