summaryrefslogtreecommitdiffstats
path: root/g4f/gui/client
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-01-12 02:14:35 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-01-12 02:14:35 +0100
commita7c856592213c8a8c7a6ef3b30cccf2ede6a9636 (patch)
tree6f2107ce9057c2da9a30e3fd33ff247d30a3e199 /g4f/gui/client
parentFix create_async in CreateImagesProvider (diff)
downloadgpt4free-a7c856592213c8a8c7a6ef3b30cccf2ede6a9636.tar
gpt4free-a7c856592213c8a8c7a6ef3b30cccf2ede6a9636.tar.gz
gpt4free-a7c856592213c8a8c7a6ef3b30cccf2ede6a9636.tar.bz2
gpt4free-a7c856592213c8a8c7a6ef3b30cccf2ede6a9636.tar.lz
gpt4free-a7c856592213c8a8c7a6ef3b30cccf2ede6a9636.tar.xz
gpt4free-a7c856592213c8a8c7a6ef3b30cccf2ede6a9636.tar.zst
gpt4free-a7c856592213c8a8c7a6ef3b30cccf2ede6a9636.zip
Diffstat (limited to '')
-rw-r--r--g4f/gui/client/css/style.css1
-rw-r--r--g4f/gui/client/html/index.html2
-rw-r--r--g4f/gui/client/js/chat.v1.js15
3 files changed, 9 insertions, 9 deletions
diff --git a/g4f/gui/client/css/style.css b/g4f/gui/client/css/style.css
index e619b409..3e2d6d6f 100644
--- a/g4f/gui/client/css/style.css
+++ b/g4f/gui/client/css/style.css
@@ -485,6 +485,7 @@ select {
padding: 8px 16px;
appearance: none;
+ width: 250px;
}
.input-box {
diff --git a/g4f/gui/client/html/index.html b/g4f/gui/client/html/index.html
index b47f2a37..bc41bd45 100644
--- a/g4f/gui/client/html/index.html
+++ b/g4f/gui/client/html/index.html
@@ -168,7 +168,7 @@
</select>
</div>
<div class="field">
- <select name="jailbreak" id="jailbreak">
+ <select name="jailbreak" id="jailbreak" style="display: none;">
<option value="default" selected>Set Jailbreak</option>
<option value="gpt-math-1.0">math 1.0</option>
<option value="gpt-dude-1.0">dude 1.0</option>
diff --git a/g4f/gui/client/js/chat.v1.js b/g4f/gui/client/js/chat.v1.js
index 9d49d24e..fffe9fe9 100644
--- a/g4f/gui/client/js/chat.v1.js
+++ b/g4f/gui/client/js/chat.v1.js
@@ -73,8 +73,8 @@ const ask_gpt = async () => {
// Remove generated images from history
for (i in messages) {
- messages[i]["content"] = messages[i]["content"].replace(
- /<!-- generated images start -->[\s\S]+<!-- generated images end -->/m,
+ messages[i]["content"] = messages[i]["content"].replaceAll(
+ /<!-- generated images start -->[\s\S]+<!-- generated images end -->/gm,
""
)
delete messages[i]["provider"];
@@ -318,7 +318,7 @@ const get_conversation = async (conversation_id) => {
const get_messages = async (conversation_id) => {
let conversation = await get_conversation(conversation_id);
- return conversation.items;
+ return conversation?.items || [];
};
const add_conversation = async (conversation_id, content) => {
@@ -463,9 +463,8 @@ const register_settings_localstorage = async () => {
};
const load_settings_localstorage = async () => {
- settings_ids = ["switch", "model", "jailbreak", "patch", "provider"];
- settings_elements = settings_ids.map((id) => document.getElementById(id));
- settings_elements.map((element) => {
+ for (id of ["switch", "model", "jailbreak", "patch", "provider"]) {
+ element = document.getElementById(id);
if (localStorage.getItem(element.id)) {
switch (element.type) {
case "checkbox":
@@ -478,8 +477,8 @@ const load_settings_localstorage = async () => {
console.warn("Unresolved element type");
}
}
- });
-};
+ }
+}
const say_hello = async () => {
tokens = [`Hello`, `!`, ` How`,` can`, ` I`,` assist`,` you`,` today`,`?`]