diff --git a/internal/biz/router.go b/internal/biz/router.go index ff0adc8..8a40efe 100644 --- a/internal/biz/router.go +++ b/internal/biz/router.go @@ -100,9 +100,7 @@ func (r *AiRouterBiz) RouteWithSocket(c *websocket.Conn, req *entitys.ChatSockRe go func() { defer func() { close(done) - if len(chat) > 0 { - } var his = []*model.AiChatHi{ { SessionID: session, @@ -133,7 +131,7 @@ func (r *AiRouterBiz) RouteWithSocket(c *websocket.Conn, req *entitys.ChatSockRe cancel() // 通知主流程退出 return } - if v.Type == entitys.ResponseText || v.Type == entitys.ResponseStream { + if v.Type == entitys.ResponseText || v.Type == entitys.ResponseStream || v.Type == entitys.ResponseJson { chat = append(chat, v.Content) } @@ -408,7 +406,7 @@ func (r *AiRouterBiz) getSessionChatHis(sessionId string) (his []model.AiChatHi, cond := builder.NewCond() cond = cond.And(builder.Eq{"session_id": sessionId}) - _, err = r.hisImpl.GetListToStruct(&cond, &dataTemp.ReqPageBo{Limit: r.conf.Sys.SessionLen}, &his, "his_id asc") + _, err = r.hisImpl.GetListToStruct(&cond, &dataTemp.ReqPageBo{Limit: r.conf.Sys.SessionLen}, &his, "his_id desc") return }