fix: session title 补全
This commit is contained in:
parent
44155c058d
commit
03652cb588
|
|
@ -32,6 +32,7 @@ type Do struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDo(
|
func NewDo(
|
||||||
|
sessionImpl *impl.SessionImpl,
|
||||||
sysImpl *impl.SysImpl,
|
sysImpl *impl.SysImpl,
|
||||||
taskImpl *impl.TaskImpl,
|
taskImpl *impl.TaskImpl,
|
||||||
hisImpl *impl.ChatHisImpl,
|
hisImpl *impl.ChatHisImpl,
|
||||||
|
|
@ -39,6 +40,7 @@ func NewDo(
|
||||||
) *Do {
|
) *Do {
|
||||||
return &Do{
|
return &Do{
|
||||||
conf: conf,
|
conf: conf,
|
||||||
|
sessionImpl: sessionImpl,
|
||||||
sysImpl: sysImpl,
|
sysImpl: sysImpl,
|
||||||
hisImpl: hisImpl,
|
hisImpl: hisImpl,
|
||||||
taskImpl: taskImpl,
|
taskImpl: taskImpl,
|
||||||
|
|
@ -275,6 +277,15 @@ func (d *Do) startMessageHandler(
|
||||||
}
|
}
|
||||||
d.hisImpl.AddWithData(AiRes)
|
d.hisImpl.AddWithData(AiRes)
|
||||||
hisLog.HisId = AiRes.HisID
|
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{
|
_ = entitys.MsgSend(client, entitys.Response{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue