summaryrefslogtreecommitdiffstats
path: root/g4f/gui
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-02-26 11:30:17 +0100
committerGitHub <noreply@github.com>2024-02-26 11:30:17 +0100
commit36e7665613c4a8ff373d90401ae804f7a334feab (patch)
tree1c5bd93c13f845b8554da3290e124116e251663f /g4f/gui
parentMerge pull request #1630 from hlohaus/flow (diff)
parentAdd proxy connector to GeminiPro (diff)
downloadgpt4free-36e7665613c4a8ff373d90401ae804f7a334feab.tar
gpt4free-36e7665613c4a8ff373d90401ae804f7a334feab.tar.gz
gpt4free-36e7665613c4a8ff373d90401ae804f7a334feab.tar.bz2
gpt4free-36e7665613c4a8ff373d90401ae804f7a334feab.tar.lz
gpt4free-36e7665613c4a8ff373d90401ae804f7a334feab.tar.xz
gpt4free-36e7665613c4a8ff373d90401ae804f7a334feab.tar.zst
gpt4free-36e7665613c4a8ff373d90401ae804f7a334feab.zip
Diffstat (limited to 'g4f/gui')
-rw-r--r--g4f/gui/client/html/index.html1
-rw-r--r--g4f/gui/client/js/chat.v1.js19
2 files changed, 15 insertions, 5 deletions
diff --git a/g4f/gui/client/html/index.html b/g4f/gui/client/html/index.html
index 102a762e..9ef8a820 100644
--- a/g4f/gui/client/html/index.html
+++ b/g4f/gui/client/html/index.html
@@ -173,7 +173,6 @@
<option value="">Provider: Auto</option>
<option value="Bing">Bing</option>
<option value="OpenaiChat">OpenaiChat</option>
- <option value="HuggingChat">HuggingChat</option>
<option value="Gemini">Gemini</option>
<option value="Liaobots">Liaobots</option>
<option value="Phind">Phind</option>
diff --git a/g4f/gui/client/js/chat.v1.js b/g4f/gui/client/js/chat.v1.js
index c727dbf9..edd27689 100644
--- a/g4f/gui/client/js/chat.v1.js
+++ b/g4f/gui/client/js/chat.v1.js
@@ -121,6 +121,20 @@ const remove_cancel_button = async () => {
};
const filter_messages = (messages) => {
+ // Removes none user messages at end
+ let last_message;
+ while (last_message = new_messages.pop()) {
+ if (last_message["role"] == "user") {
+ new_messages.push(last_message);
+ break;
+ }
+ }
+
+ // Remove history, if it is selected
+ if (document.getElementById('history')?.checked) {
+ messages = [messages[messages.length-1]];
+ }
+
let new_messages = [];
for (i in messages) {
new_message = messages[i];
@@ -135,6 +149,7 @@ const filter_messages = (messages) => {
new_messages.push(new_message)
}
}
+
return new_messages;
}
@@ -143,10 +158,6 @@ const ask_gpt = async () => {
messages = await get_messages(window.conversation_id);
total_messages = messages.length;
- // Remove history, if it is selected
- if (document.getElementById('history')?.checked) {
- messages = [messages[messages.length-1]];
- }
messages = filter_messages(messages);
window.scrollTo(0, 0);