From 566e6ae582308a6306685d1a5ea1b081567960dd Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Sat, 14 Dec 2024 13:12:05 +0800 Subject: [PATCH] Add logging for OpenAI request and fix locale/logic issues (#560) --- api/chat_main_handler.go | 1 + web/src/locales/en-US.json | 2 +- web/src/locales/zh-CN.json | 2 +- web/src/locales/zh-TW.json | 2 +- web/src/store/modules/chat/index.ts | 4 ++-- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/api/chat_main_handler.go b/api/chat_main_handler.go index fd148f84..1c814351 100644 --- a/api/chat_main_handler.go +++ b/api/chat_main_handler.go @@ -508,6 +508,7 @@ func (h *ChatHandler) chatStream(w http.ResponseWriter, chatSession sqlc_queries RespondWithError(w, http.StatusInternalServerError, "error.system_message_notice", err) return "", "", true } + log.Printf("%+v", openai_req) ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute) defer cancel() diff --git a/web/src/locales/en-US.json b/web/src/locales/en-US.json index d99e835b..5338773a 100644 --- a/web/src/locales/en-US.json +++ b/web/src/locales/en-US.json @@ -14,7 +14,7 @@ "isEnable": "Is Enabled", "label": "Model name", "maxToken": "Maximum token number", - "name": "ID", + "name": "Model ID", "orderNumber": "Order number", "url": "Request full URL" }, diff --git a/web/src/locales/zh-CN.json b/web/src/locales/zh-CN.json index 382478dc..ca740483 100644 --- a/web/src/locales/zh-CN.json +++ b/web/src/locales/zh-CN.json @@ -135,7 +135,7 @@ "chat_model": { "deleteModel": "删除", "deleteModelConfirm": "确认删除", - "name": "模型名称(ID)", + "name": "模型名称(model ID in api)", "label": "模型标签", "isDefault": "默认?", "apiAuthHeader": "Auth Header key", diff --git a/web/src/locales/zh-TW.json b/web/src/locales/zh-TW.json index 14c96080..8801c60c 100644 --- a/web/src/locales/zh-TW.json +++ b/web/src/locales/zh-TW.json @@ -12,7 +12,7 @@ "enablePerModelRateLimit": "是否單獨流控", "isDefault": "默認?", "isEnable": "是否啟用", - "label": "模型名稱", + "label": "模型名稱(ID)", "maxToken": "最大token數量", "name": "身分識別號", "orderNumber": "次序", diff --git a/web/src/store/modules/chat/index.ts b/web/src/store/modules/chat/index.ts index ead802e4..2f857395 100644 --- a/web/src/store/modules/chat/index.ts +++ b/web/src/store/modules/chat/index.ts @@ -240,7 +240,7 @@ export const useChatStore = defineStore('chat-store', { const chatData = this.chat[keys[0]] const chat = chatData[index] chatData.splice(index, 1) - if (chat) + if (chat && chat.uuid) await deleteChatData(chat) } return @@ -250,7 +250,7 @@ export const useChatStore = defineStore('chat-store', { const chatData = this.chat[uuid] const chat = chatData[index] chatData.splice(index, 1) - if (chat) + if (chat && chat.uuid) await deleteChatData(chat) } },