feat: chat
This commit is contained in:
parent
75756557b6
commit
2cd19e5fdf
|
|
@ -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()
|
||||
}()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue