summaryrefslogtreecommitdiffstats
path: root/g4f/gui/client
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-11-20 19:58:16 +0100
committerGitHub <noreply@github.com>2024-11-20 19:58:16 +0100
commitffb4b0d162cc29b1caa4539d854de37206804225 (patch)
treeea565c46ed908d2a6b4ef3fef1f100e68428aec3 /g4f/gui/client
parentUpdate api.py (diff)
downloadgpt4free-ffb4b0d162cc29b1caa4539d854de37206804225.tar
gpt4free-ffb4b0d162cc29b1caa4539d854de37206804225.tar.gz
gpt4free-ffb4b0d162cc29b1caa4539d854de37206804225.tar.bz2
gpt4free-ffb4b0d162cc29b1caa4539d854de37206804225.tar.lz
gpt4free-ffb4b0d162cc29b1caa4539d854de37206804225.tar.xz
gpt4free-ffb4b0d162cc29b1caa4539d854de37206804225.tar.zst
gpt4free-ffb4b0d162cc29b1caa4539d854de37206804225.zip
Diffstat (limited to 'g4f/gui/client')
-rw-r--r--g4f/gui/client/index.html5
-rw-r--r--g4f/gui/client/static/css/style.css1
-rw-r--r--g4f/gui/client/static/js/chat.v1.js16
3 files changed, 16 insertions, 6 deletions
diff --git a/g4f/gui/client/index.html b/g4f/gui/client/index.html
index 48214093..6c2ad8b6 100644
--- a/g4f/gui/client/index.html
+++ b/g4f/gui/client/index.html
@@ -112,6 +112,11 @@
<label for="hide-systemPrompt" class="toogle" title="For more space on phones"></label>
</div>
<div class="field">
+ <span class="label">Download generated images</span>
+ <input type="checkbox" id="download_images" checked/>
+ <label for="download_images" class="toogle" title="Download and save generated images to /generated_images"></label>
+ </div>
+ <div class="field">
<span class="label">Auto continue in ChatGPT</span>
<input id="auto_continue" type="checkbox" name="auto_continue" checked/>
<label for="auto_continue" class="toogle" title="Continue large responses in OpenaiChat"></label>
diff --git a/g4f/gui/client/static/css/style.css b/g4f/gui/client/static/css/style.css
index 76399703..c4b61d87 100644
--- a/g4f/gui/client/static/css/style.css
+++ b/g4f/gui/client/static/css/style.css
@@ -498,6 +498,7 @@ body {
gap: 12px;
cursor: pointer;
animation: show_popup 0.4s;
+ height: 28px;
}
.toolbar .regenerate {
diff --git a/g4f/gui/client/static/js/chat.v1.js b/g4f/gui/client/static/js/chat.v1.js
index a3e94ee2..0136f9c4 100644
--- a/g4f/gui/client/static/js/chat.v1.js
+++ b/g4f/gui/client/static/js/chat.v1.js
@@ -428,10 +428,14 @@ async function add_message_chunk(message, message_id) {
p.innerText = message.log;
log_storage.appendChild(p);
}
- window.scrollTo(0, 0);
- if (message_box.scrollTop >= message_box.scrollHeight - message_box.clientHeight - 100) {
- message_box.scrollTo({ top: message_box.scrollHeight, behavior: "auto" });
+ let scroll_down = ()=>{
+ if (message_box.scrollTop >= message_box.scrollHeight - message_box.clientHeight - 100) {
+ window.scrollTo(0, 0);
+ message_box.scrollTo({ top: message_box.scrollHeight, behavior: "auto" });
+ }
}
+ setTimeout(scroll_down, 200);
+ setTimeout(scroll_down, 1000);
}
cameraInput?.addEventListener("click", (e) => {
@@ -492,6 +496,7 @@ const ask_gpt = async (message_index = -1, message_id) => {
const file = input && input.files.length > 0 ? input.files[0] : null;
const provider = providerSelect.options[providerSelect.selectedIndex].value;
const auto_continue = document.getElementById("auto_continue")?.checked;
+ const download_images = document.getElementById("download_images")?.checked;
let api_key = get_api_key_by_provider(provider);
await api("conversation", {
id: message_id,
@@ -501,13 +506,13 @@ const ask_gpt = async (message_index = -1, message_id) => {
provider: provider,
messages: messages,
auto_continue: auto_continue,
+ download_images: download_images,
api_key: api_key,
}, file, message_id);
if (!error_storage[message_id]) {
html = markdown_render(message_storage[message_id]);
content_map.inner.innerHTML = html;
highlight(content_map.inner);
-
if (imageInput) imageInput.value = "";
if (cameraInput) cameraInput.value = "";
if (fileInput) fileInput.value = "";
@@ -1239,8 +1244,7 @@ async function load_version() {
if (versions["version"] != versions["latest_version"]) {
let release_url = 'https://github.com/xtekky/gpt4free/releases/tag/' + versions["latest_version"];
let title = `New version: ${versions["latest_version"]}`;
- text += `<a href="${release_url}" target="_blank" title="${title}">${versions["version"]}</a> `;
- text += `<i class="fa-solid fa-rotate"></i>`
+ text += `<a href="${release_url}" target="_blank" title="${title}">${versions["version"]}</a> 🆕`;
} else {
text += versions["version"];
}