mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-27 17:35:07 +01:00
Update clients to support rendering webp images inline
This is for self-hosted scenarios where AWS S3 uploads is not enabled
This commit is contained in:
parent
d21f22ffa1
commit
c6e8443631
3 changed files with 16 additions and 0 deletions
|
@ -214,6 +214,8 @@
|
|||
imageMarkdown = `![](data:image/png;base64,${message})`;
|
||||
} else if (intentType === "text-to-image2") {
|
||||
imageMarkdown = `![](${message})`;
|
||||
} else if (intentType === "text-to-image-v3") {
|
||||
imageMarkdown = `![](data:image/webp;base64,${message})`;
|
||||
}
|
||||
|
||||
const inferredQuery = inferredQueries?.[0];
|
||||
|
@ -288,6 +290,8 @@
|
|||
imageMarkdown = `![](data:image/png;base64,${message})`;
|
||||
} else if (intentType === "text-to-image2") {
|
||||
imageMarkdown = `![](${message})`;
|
||||
} else if (intentType === "text-to-image-v3") {
|
||||
imageMarkdown = `![](data:image/webp;base64,${message})`;
|
||||
}
|
||||
const inferredQuery = inferredQueries?.[0];
|
||||
if (inferredQuery) {
|
||||
|
@ -509,6 +513,8 @@
|
|||
rawResponse += `![${query}](data:image/png;base64,${responseAsJson.image})`;
|
||||
} else if (responseAsJson.intentType === "text-to-image2") {
|
||||
rawResponse += `![${query}](${responseAsJson.image})`;
|
||||
} else if (responseAsJson.intentType === "text-to-image-v3") {
|
||||
rawResponse += `![${query}](data:image/webp;base64,${responseAsJson.image})`;
|
||||
}
|
||||
const inferredQueries = responseAsJson.inferredQueries?.[0];
|
||||
if (inferredQueries) {
|
||||
|
|
|
@ -156,6 +156,8 @@ export class KhojChatModal extends Modal {
|
|||
imageMarkdown = `![](data:image/png;base64,${message})`;
|
||||
} else if (intentType === "text-to-image2") {
|
||||
imageMarkdown = `![](${message})`;
|
||||
} else if (intentType === "text-to-image-v3") {
|
||||
imageMarkdown = `![](data:image/webp;base64,${message})`;
|
||||
}
|
||||
if (inferredQueries) {
|
||||
imageMarkdown += "\n\n**Inferred Query**:";
|
||||
|
@ -429,6 +431,8 @@ export class KhojChatModal extends Modal {
|
|||
responseText += `![${query}](data:image/png;base64,${responseAsJson.image})`;
|
||||
} else if (responseAsJson.intentType === "text-to-image2") {
|
||||
responseText += `![${query}](${responseAsJson.image})`;
|
||||
} else if (responseAsJson.intentType === "text-to-image-v3") {
|
||||
responseText += `![${query}](data:image/webp;base64,${responseAsJson.image})`;
|
||||
}
|
||||
const inferredQuery = responseAsJson.inferredQueries?.[0];
|
||||
if (inferredQuery) {
|
||||
|
|
|
@ -244,6 +244,8 @@ To get started, just start typing below. You can also type / to see a list of co
|
|||
imageMarkdown = `![](data:image/png;base64,${message})`;
|
||||
} else if (intentType === "text-to-image2") {
|
||||
imageMarkdown = `![](${message})`;
|
||||
} else if (intentType === "text-to-image-v3") {
|
||||
imageMarkdown = `![](data:image/webp;base64,${message})`;
|
||||
}
|
||||
const inferredQuery = inferredQueries?.[0];
|
||||
if (inferredQuery) {
|
||||
|
@ -312,6 +314,8 @@ To get started, just start typing below. You can also type / to see a list of co
|
|||
imageMarkdown = `![](data:image/png;base64,${message})`;
|
||||
} else if (intentType === "text-to-image2") {
|
||||
imageMarkdown = `![](${message})`;
|
||||
} else if (intentType === "text-to-image-v3") {
|
||||
imageMarkdown = `![](data:image/webp;base64,${message})`;
|
||||
}
|
||||
const inferredQuery = inferredQueries?.[0];
|
||||
if (inferredQuery) {
|
||||
|
@ -619,6 +623,8 @@ To get started, just start typing below. You can also type / to see a list of co
|
|||
rawResponse += `![generated_image](data:image/png;base64,${imageJson.image})`;
|
||||
} else if (imageJson.intentType === "text-to-image2") {
|
||||
rawResponse += `![generated_image](${imageJson.image})`;
|
||||
} else if (imageJson.intentType === "text-to-image-v3") {
|
||||
rawResponse = `![](data:image/webp;base64,${imageJson.image})`;
|
||||
}
|
||||
if (inferredQuery) {
|
||||
rawResponse += `\n\n**Inferred Query**:\n\n${inferredQuery}`;
|
||||
|
|
Loading…
Reference in a new issue