summaryrefslogtreecommitdiffstats
path: root/g4f/gui/client/static
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-05-18 23:18:32 +0200
committerGitHub <noreply@github.com>2024-05-18 23:18:32 +0200
commit97ce36a217b7998aee460c62c926c0c1f6f3baf6 (patch)
tree4a137ca4958a81272e37f952b9330a197038f83f /g4f/gui/client/static
parentMerge pull request #1974 from hlohaus/leech (diff)
parentAdd get/set cookies dir, hide prompt option in gui (diff)
downloadgpt4free-97ce36a217b7998aee460c62c926c0c1f6f3baf6.tar
gpt4free-97ce36a217b7998aee460c62c926c0c1f6f3baf6.tar.gz
gpt4free-97ce36a217b7998aee460c62c926c0c1f6f3baf6.tar.bz2
gpt4free-97ce36a217b7998aee460c62c926c0c1f6f3baf6.tar.lz
gpt4free-97ce36a217b7998aee460c62c926c0c1f6f3baf6.tar.xz
gpt4free-97ce36a217b7998aee460c62c926c0c1f6f3baf6.tar.zst
gpt4free-97ce36a217b7998aee460c62c926c0c1f6f3baf6.zip
Diffstat (limited to 'g4f/gui/client/static')
-rw-r--r--g4f/gui/client/static/css/style.css13
-rw-r--r--g4f/gui/client/static/js/chat.v1.js23
2 files changed, 29 insertions, 7 deletions
diff --git a/g4f/gui/client/static/css/style.css b/g4f/gui/client/static/css/style.css
index 01bc17fa..005cb8bf 100644
--- a/g4f/gui/client/static/css/style.css
+++ b/g4f/gui/client/static/css/style.css
@@ -457,7 +457,11 @@ body {
#input-count {
width: fit-content;
font-size: 12px;
- padding: 6px var(--inner-gap);
+ padding: 6px 6px;
+}
+
+#input-count .text {
+ padding: 0 4px;
}
.stop_generating, .toolbar .regenerate {
@@ -491,6 +495,13 @@ body {
animation: show_popup 0.4s;
}
+.toolbar .hide-input {
+ background: transparent;
+ border: none;
+ color: var(--colour-3);
+ cursor: pointer;
+}
+
@keyframes show_popup {
from {
opacity: 0;
diff --git a/g4f/gui/client/static/js/chat.v1.js b/g4f/gui/client/static/js/chat.v1.js
index a0178e63..46d5039e 100644
--- a/g4f/gui/client/static/js/chat.v1.js
+++ b/g4f/gui/client/static/js/chat.v1.js
@@ -11,7 +11,7 @@ const imageInput = document.getElementById("image");
const cameraInput = document.getElementById("camera");
const fileInput = document.getElementById("file");
const microLabel = document.querySelector(".micro-label");
-const inputCount = document.getElementById("input-count");
+const inputCount = document.getElementById("input-count").querySelector(".text");
const providerSelect = document.getElementById("provider");
const modelSelect = document.getElementById("model");
const modelProvider = document.getElementById("model2");
@@ -41,9 +41,7 @@ appStorage = window.localStorage || {
length: 0
}
-const markdown = window.markdownit({
- html: true,
-});
+const markdown = window.markdownit();
const markdown_render = (content) => {
return markdown.render(content
.replaceAll(/<!-- generated images start -->|<!-- generated images end -->/gm, "")
@@ -813,6 +811,17 @@ document.getElementById("regenerateButton").addEventListener("click", async () =
await ask_gpt();
});
+const hide_input = document.querySelector(".toolbar .hide-input");
+hide_input.addEventListener("click", async (e) => {
+ const icon = hide_input.querySelector("i");
+ const func = icon.classList.contains("fa-angles-down") ? "add" : "remove";
+ const remv = icon.classList.contains("fa-angles-down") ? "remove" : "add";
+ icon.classList[func]("fa-angles-up");
+ icon.classList[remv]("fa-angles-down");
+ document.querySelector(".conversation .user-input").classList[func]("hidden");
+ document.querySelector(".conversation .buttons").classList[func]("hidden");
+});
+
const uuid = () => {
return `xxxxxxxx-xxxx-4xxx-yxxx-${Date.now().toString(16)}`.replace(
/[xy]/g,
@@ -1016,7 +1025,7 @@ const count_input = async () => {
if (countFocus.value) {
inputCount.innerText = count_words_and_tokens(countFocus.value, get_selected_model());
} else {
- inputCount.innerHTML = "&nbsp;"
+ inputCount.innerText = "";
}
}, 100);
};
@@ -1060,6 +1069,8 @@ async function on_api() {
messageInput.addEventListener("keydown", async (evt) => {
if (prompt_lock) return;
+ // If not mobile
+ if (!window.matchMedia("(pointer:coarse)").matches)
if (evt.keyCode === 13 && !evt.shiftKey) {
evt.preventDefault();
console.log("pressed enter");
@@ -1262,6 +1273,7 @@ async function load_provider_models(providerIndex=null) {
if (!providerIndex) {
providerIndex = providerSelect.selectedIndex;
}
+ modelProvider.innerHTML = '';
const provider = providerSelect.options[providerIndex].value;
if (!provider) {
modelProvider.classList.add("hidden");
@@ -1269,7 +1281,6 @@ async function load_provider_models(providerIndex=null) {
return;
}
const models = await api('models', provider);
- modelProvider.innerHTML = '';
if (models.length > 0) {
modelSelect.classList.add("hidden");
modelProvider.classList.remove("hidden");