summaryrefslogtreecommitdiffstats
path: root/g4f/gui/client
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-11-19 10:39:22 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-11-19 10:39:22 +0100
commitb79a4d6aeb2432392912b8df2470aa276e9b49ca (patch)
treec33b708448722d72bc750b4c0080abb0da212dbb /g4f/gui/client
parentAdd image upload to Copilot provider (diff)
downloadgpt4free-b79a4d6aeb2432392912b8df2470aa276e9b49ca.tar
gpt4free-b79a4d6aeb2432392912b8df2470aa276e9b49ca.tar.gz
gpt4free-b79a4d6aeb2432392912b8df2470aa276e9b49ca.tar.bz2
gpt4free-b79a4d6aeb2432392912b8df2470aa276e9b49ca.tar.lz
gpt4free-b79a4d6aeb2432392912b8df2470aa276e9b49ca.tar.xz
gpt4free-b79a4d6aeb2432392912b8df2470aa276e9b49ca.tar.zst
gpt4free-b79a4d6aeb2432392912b8df2470aa276e9b49ca.zip
Diffstat (limited to '')
-rw-r--r--g4f/gui/client/static/js/chat.v1.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/g4f/gui/client/static/js/chat.v1.js b/g4f/gui/client/static/js/chat.v1.js
index 9aba4f10..11306cdc 100644
--- a/g4f/gui/client/static/js/chat.v1.js
+++ b/g4f/gui/client/static/js/chat.v1.js
@@ -781,6 +781,7 @@ async function save_system_message() {
}
const hide_message = async (conversation_id, message_index =- 1) => {
const conversation = await get_conversation(conversation_id)
+ if (!conversation) return;
message_index = message_index == -1 ? conversation.items.length - 1 : message_index
const last_message = message_index in conversation.items ? conversation.items[message_index] : null;
if (last_message !== null) {
@@ -817,6 +818,7 @@ const get_message = async (conversation_id, index) => {
const add_message = async (conversation_id, role, content, provider) => {
const conversation = await get_conversation(conversation_id);
+ if (!conversation) return;
conversation.items.push({
role: role,
content: content,