feat: chat

This commit is contained in:
wolter 2025-11-21 15:25:01 +08:00
parent 75756557b6
commit 2cd19e5fdf
2 changed files with 8 additions and 4 deletions

View File

@ -46,10 +46,7 @@ func (r *AiRouterBiz) RouteWithSocket(client *gateway.Client, req *entitys.ChatS
ctx, clearFunc := r.do.MakeCh(conn, requireData)
defer func() {
if err != nil {
requireData.Ch <- entitys.Response{
Content: err.Error(),
Type: entitys.ResponseErr,
}
entitys.ResError(requireData.Ch, "", err.Error())
}
clearFunc()
}()

View File

@ -67,6 +67,13 @@ func ResLoading(ch chan Response, index string, content string) {
Type: ResponseLoading,
}
}
func ResError(ch chan Response, index string, content string) {
ch <- Response{
Index: index,
Content: content,
Type: ResponseErr,
}
}
type ResponseData struct {
Done bool