diff --git a/api/chat_main_handler.go b/api/chat_main_handler.go index ea9f8825..318d3bbf 100644 --- a/api/chat_main_handler.go +++ b/api/chat_main_handler.go @@ -386,6 +386,10 @@ func (h *ChatHandler) chatStream(w http.ResponseWriter, chatSession sqlc_queries } openai_req := NewChatCompletionRequest(chatSession, chat_compeletion_messages, chatFiles) + if len(openai_req.Messages) <= 1 { + RespondWithError(w, http.StatusInternalServerError, "error.system_message_notice", err) + return "", "", true + } ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute) defer cancel() stream, err := client.CreateChatCompletionStream(ctx, openai_req) @@ -758,7 +762,7 @@ func (h *ChatHandler) chatStreamClaude3(w http.ResponseWriter, chatSession sqlc_ messages = messagesToOpenAIMesages(chat_compeletion_messages[1:], chatFiles) } else { // only system message, return and do nothing - RespondWithError(w, http.StatusInternalServerError, "error.claude_system_message_notice", err) + RespondWithError(w, http.StatusInternalServerError, "error.system_message_notice", err) return "", "", true } // create the json data diff --git a/web/src/locales/en-US-more.json b/web/src/locales/en-US-more.json index 87d14f4f..6ef14a8e 100644 --- a/web/src/locales/en-US-more.json +++ b/web/src/locales/en-US-more.json @@ -15,6 +15,6 @@ } }, "error": { - "claude_system_message_notice": "Claude the first message is a system message, please continue entering information to start the conversation" + "system_message_notice": "the first message is a system message, please continue entering information to start the conversation" } } \ No newline at end of file diff --git a/web/src/locales/en-US.json b/web/src/locales/en-US.json index 60c0d309..3393e298 100644 --- a/web/src/locales/en-US.json +++ b/web/src/locales/en-US.json @@ -144,7 +144,7 @@ "error": { "NotAdmin": "Non-administrators are prohibited from accessing", "NotAuthorized": "Please log in first", - "claude_system_message_notice": "Claude Model, the first message is a system message, please continue entering information to start the conversation", + "system_message_notice": "the first message is a system message, please continue entering information to start the conversation", "fail_to_do_request": "Failed to request the model, please try again later or contact the administrator", "fail_to_generate_token": "Failed to generate token", "fail_to_get_rate_limit": "Failed to retrieve the quota corresponding to the model, please contact the administrator to enable it", diff --git a/web/src/locales/zh-CN.json b/web/src/locales/zh-CN.json index 5b826332..58289443 100644 --- a/web/src/locales/zh-CN.json +++ b/web/src/locales/zh-CN.json @@ -166,7 +166,7 @@ "socks": "Socks" }, "error": { - "claude_system_message_notice": "claude 第一条是系统消息, 请继续输入信息开始会话", + "system_message_notice": "第一条是系统消息已经是收到, 请继续输入信息开始会话", "invalid_request": "无效请求", "invalid_email_or_password": "无效的电子邮件或密码", "fail_to_generate_token": "生成令牌失败", diff --git a/web/src/locales/zh-TW-more.json b/web/src/locales/zh-TW-more.json index 0671edcf..85529d2c 100644 --- a/web/src/locales/zh-TW-more.json +++ b/web/src/locales/zh-TW-more.json @@ -16,6 +16,6 @@ } }, "error": { - "claude_system_message_notice": "CLAUDE第一條是系統消息,請繼續輸入信息開始會話" + "system_message_notice": "第一條是系統消息,請繼續輸入信息開始會話" } } \ No newline at end of file diff --git a/web/src/locales/zh-TW.json b/web/src/locales/zh-TW.json index 25e58976..ed8d9fec 100644 --- a/web/src/locales/zh-TW.json +++ b/web/src/locales/zh-TW.json @@ -144,7 +144,7 @@ "error": { "NotAdmin": "非管理員禁止訪問", "NotAuthorized": "請先登入", - "claude_system_message_notice": "CLAUDE模型第一條是系統消息,請繼續輸入信息開始會話", + "system_message_notice": "第一條是系統消息,請繼續輸入信息開始會話", "fail_to_do_request": "請求模型失敗, 請稍後再試, 或聯繫管理員", "fail_to_generate_token": "生成令牌失敗", "fail_to_get_rate_limit": "無法查詢模型對應的配額,請聯繫管理員開通",