Compare commits

...

2 Commits

Author SHA1 Message Date
renzhiyuan ca4fca9a16 Merge remote-tracking branch 'origin/master' 2025-09-29 15:09:25 +08:00
renzhiyuan ca0fce6911 结构修改 2025-09-29 15:09:22 +08:00
1 changed files with 2 additions and 4 deletions

View File

@ -100,9 +100,7 @@ func (r *AiRouterBiz) RouteWithSocket(c *websocket.Conn, req *entitys.ChatSockRe
go func() { go func() {
defer func() { defer func() {
close(done) close(done)
if len(chat) > 0 {
}
var his = []*model.AiChatHi{ var his = []*model.AiChatHi{
{ {
SessionID: session, SessionID: session,
@ -133,7 +131,7 @@ func (r *AiRouterBiz) RouteWithSocket(c *websocket.Conn, req *entitys.ChatSockRe
cancel() // 通知主流程退出 cancel() // 通知主流程退出
return 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) chat = append(chat, v.Content)
} }
@ -408,7 +406,7 @@ func (r *AiRouterBiz) getSessionChatHis(sessionId string) (his []model.AiChatHi,
cond := builder.NewCond() cond := builder.NewCond()
cond = cond.And(builder.Eq{"session_id": sessionId}) 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 return
} }