This commit is contained in:
Havoc412 2024-11-18 00:39:36 +08:00
parent d2f6f5da5a
commit c06bc1f84e
2 changed files with 4 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package errcode
const (
ErrNoContent = ErrNlp + iota
ErrNoDocFound
ErrPythonServierDown
)
func NlpMsgInit(m msg) {
@ -12,5 +13,6 @@ func NlpMsgInit(m msg) {
func NlpMsgUserInit(m msg) {
m[ErrNoContent] = "请输入内容"
m[ErrNoDocFound] = "小护没有在知识库中找到相关文档。😿😿😿"
m[ErrNoDocFound] = "小护没有在知识库中找到相关文档。😿"
m[ErrPythonServierDown] = "小护的🐍python服务挂了请稍后再试。😿"
}

View File

@ -117,7 +117,7 @@ func (r *Rag) ChatWebSocket(context *gin.Context) {
// 1. query embedding
embedding, ok := nlp.GetEmbedding(query)
if !ok {
code := errcode.ErrServerDown
code := errcode.ErrPythonServierDown
err := ws.WriteMessage(websocket.TextMessage, []byte(errcode.ErrMsgForUser[code]))
if err != nil {
variable.ZapLog.Error("Failed to send error message via WebSocket", zap.Error(err))