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)
|
ctx, clearFunc := r.do.MakeCh(conn, requireData)
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
requireData.Ch <- entitys.Response{
|
entitys.ResError(requireData.Ch, "", err.Error())
|
||||||
Content: err.Error(),
|
|
||||||
Type: entitys.ResponseErr,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
clearFunc()
|
clearFunc()
|
||||||
}()
|
}()
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,13 @@ func ResLoading(ch chan Response, index string, content string) {
|
||||||
Type: ResponseLoading,
|
Type: ResponseLoading,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func ResError(ch chan Response, index string, content string) {
|
||||||
|
ch <- Response{
|
||||||
|
Index: index,
|
||||||
|
Content: content,
|
||||||
|
Type: ResponseErr,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type ResponseData struct {
|
type ResponseData struct {
|
||||||
Done bool
|
Done bool
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue