fix: session title 补全
This commit is contained in:
parent
44155c058d
commit
03652cb588
|
|
@ -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{
|
||||
|
|
|
|||
Loading…
Reference in New Issue