summaryrefslogtreecommitdiffstats
path: root/g4f/gui/client
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-04-21 07:45:23 +0200
committerGitHub <noreply@github.com>2024-04-21 07:45:23 +0200
commit0f3935f1c068c723342153dd040e0e72e95aa11b (patch)
treec4d1e9c9eb2ebfe13e2679afe8a23d7ffa45fa46 /g4f/gui/client
parentMerge pull request #1865 from hlohaus/carst (diff)
parentAdd MissingRequirementsError to You (diff)
downloadgpt4free-0f3935f1c068c723342153dd040e0e72e95aa11b.tar
gpt4free-0f3935f1c068c723342153dd040e0e72e95aa11b.tar.gz
gpt4free-0f3935f1c068c723342153dd040e0e72e95aa11b.tar.bz2
gpt4free-0f3935f1c068c723342153dd040e0e72e95aa11b.tar.lz
gpt4free-0f3935f1c068c723342153dd040e0e72e95aa11b.tar.xz
gpt4free-0f3935f1c068c723342153dd040e0e72e95aa11b.tar.zst
gpt4free-0f3935f1c068c723342153dd040e0e72e95aa11b.zip
Diffstat (limited to '')
-rw-r--r--g4f/gui/client/static/js/chat.v1.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/g4f/gui/client/static/js/chat.v1.js b/g4f/gui/client/static/js/chat.v1.js
index a043cb25..8b00eed2 100644
--- a/g4f/gui/client/static/js/chat.v1.js
+++ b/g4f/gui/client/static/js/chat.v1.js
@@ -41,7 +41,9 @@ appStorage = window.localStorage || {
length: 0
}
-const markdown = window.markdownit();
+const markdown = window.markdownit({
+ html: true,
+});
const markdown_render = (content) => {
return markdown.render(content
.replaceAll(/<!-- generated images start -->|<!-- generated images end -->/gm, "")
@@ -312,6 +314,8 @@ async function add_message_chunk(message) {
window.error = message.error
console.error(message.error);
content_inner.innerHTML += `<p><strong>An error occured:</strong> ${message.error}</p>`;
+ } else if (message.type == "preview") {
+ content_inner.innerHTML = markdown_render(message.preview);
} else if (message.type == "content") {
window.text += message.content;
html = markdown_render(window.text);
@@ -545,7 +549,7 @@ const load_conversation = async (conversation_id, scroll=true) => {
last_model = item.provider?.model;
let next_i = parseInt(i) + 1;
let next_provider = item.provider ? item.provider : (messages.length > next_i ? messages[next_i].provider : null);
- let provider_label = item.provider?.label ? item.provider?.label : item.provider?.name;
+ let provider_label = item.provider?.label ? item.provider.label : item.provider?.name;
let provider_link = item.provider?.name ? `<a href="${item.provider.url}" target="_blank">${provider_label}</a>` : "";
let provider = provider_link ? `
<div class="provider">