From 03652cb588eed711d4290eb8b0b7be9c82665722 Mon Sep 17 00:00:00 2001 From: fuzhongyun <15339891972@163.com> Date: Fri, 9 Jan 2026 18:31:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20session=20title=20=E8=A1=A5=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/biz/do/ctx.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/internal/biz/do/ctx.go b/internal/biz/do/ctx.go index 6058b38..8d5cf74 100644 --- a/internal/biz/do/ctx.go +++ b/internal/biz/do/ctx.go @@ -32,16 +32,18 @@ type Do struct { } func NewDo( + sessionImpl *impl.SessionImpl, sysImpl *impl.SysImpl, taskImpl *impl.TaskImpl, hisImpl *impl.ChatHisImpl, conf *config.Config, ) *Do { return &Do{ - conf: conf, - sysImpl: sysImpl, - hisImpl: hisImpl, - taskImpl: taskImpl, + conf: conf, + sessionImpl: sessionImpl, + sysImpl: sysImpl, + hisImpl: hisImpl, + taskImpl: taskImpl, } } @@ -275,6 +277,15 @@ func (d *Do) startMessageHandler( } d.hisImpl.AddWithData(AiRes) hisLog.HisId = AiRes.HisID + + // 查询当前session + cond := builder.NewCond().And(builder.Eq{"session_id": requireData.Session}) + sessionMap, _ := d.sessionImpl.GetOneBySearch(&cond) + requireData.SessionInfo.Title = sessionMap["title"].(string) + // 当前 session title为空 ,更新为用户输入 + if requireData.SessionInfo.Title == "" { + d.sessionImpl.UpdateByCond(&cond, &model.AiSession{Title: requireData.Req.Text}) + } } _ = entitys.MsgSend(client, entitys.Response{