summaryrefslogtreecommitdiffstats
path: root/g4f/gui
diff options
context:
space:
mode:
Diffstat (limited to '')
-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);