Skip to content

Commit

Permalink
update (#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
swuecho authored Jun 8, 2024
1 parent 33c4b42 commit 74e4c49
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion api/chat_main_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion web/src/locales/en-US-more.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
2 changes: 1 addition & 1 deletion web/src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion web/src/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "生成令牌失败",
Expand Down
2 changes: 1 addition & 1 deletion web/src/locales/zh-TW-more.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
}
},
"error": {
"claude_system_message_notice": "CLAUDE第一條是系統消息,請繼續輸入信息開始會話"
"system_message_notice": "第一條是系統消息,請繼續輸入信息開始會話"
}
}
2 changes: 1 addition & 1 deletion web/src/locales/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "無法查詢模型對應的配額,請聯繫管理員開通",
Expand Down

0 comments on commit 74e4c49

Please sign in to comment.