Skip to content

Commit

Permalink
Fix show new Window Button
Browse files Browse the repository at this point in the history
  • Loading branch information
hlohaus committed Feb 7, 2025
1 parent 5b454f6 commit ad5d09f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
10 changes: 5 additions & 5 deletions g4f/gui/client/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@
<script>
(async () => {
const isIframe = window.self !== window.top;
const button = document.querySelector('form a.button');
let url = new URL(window.location.href)
let params = new URLSearchParams(url.search);
if (params.get("__sign")) {
Expand All @@ -190,9 +189,6 @@
window.location.replace("/");
}
}
if (isIframe) {
button.classList.remove('hidden');
}
})();
</script>
<script src="https://unpkg.com/[email protected]/dist/es-module-shims.js"></script>
Expand Down Expand Up @@ -236,7 +232,11 @@
import * as hub from "@huggingface/hub";
import { init } from "@huggingface/space-header";

if (window.self === window.top) {
const isIframe = window.self !== window.top;
const button = document.querySelector('form a.button');
if (isIframe) {
button.classList.remove('hidden');
} else {
init("roxky/g4f-space");
}

Expand Down
9 changes: 4 additions & 5 deletions g4f/gui/client/static/js/chat.v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -811,19 +811,18 @@ async function add_message_chunk(message, message_id, provider, scroll, finish_m
log_storage.appendChild(p);
await api("log", {...message, provider: provider_storage[message_id]});
} else if (message.type == "preview") {
if (content_map.inner.clientHeight > 200)
content_map.inner.style.height = content_map.inner.clientHeight + "px";
if (img = content_map.inner.querySelector("img"))
if (!img.complete)
return;
else
img.src = message.images;
else
content_map.inner.innerHTML = markdown_render(message.preview);
else {
content_map.inner.innerHTML = markdown_render(message.preview);
await register_message_images();
}
} else if (message.type == "content") {
message_storage[message_id] += message.content;
update_message(content_map, message_id, null, scroll);
content_map.inner.style.height = "";
} else if (message.type == "log") {
let p = document.createElement("p");
p.innerText = message.log;
Expand Down

0 comments on commit ad5d09f

Please sign in to comment.