|
@@ -119,6 +119,8 @@ func (m *WsChat) Handle(ws *ghttp.WebSocket, msg []byte) {
|
|
for {
|
|
for {
|
|
line, _, err := buf.ReadLine()
|
|
line, _, err := buf.ReadLine()
|
|
if err == io.EOF {
|
|
if err == io.EOF {
|
|
|
|
+ //放回链接池
|
|
|
|
+ ChatGptPool.Add()
|
|
replyId := ChatHistory.Save(m.Ctx, &ChatRecord{
|
|
replyId := ChatHistory.Save(m.Ctx, &ChatRecord{
|
|
Content: lastData.Response,
|
|
Content: lastData.Response,
|
|
Type: 2,
|
|
Type: 2,
|
|
@@ -140,10 +142,6 @@ func (m *WsChat) Handle(ws *ghttp.WebSocket, msg []byte) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-func saveAndReturnMap() {
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
func parseEventStream(line []byte) (event string, date *BufRes) {
|
|
func parseEventStream(line []byte) (event string, date *BufRes) {
|
|
// 如果行以 "event:" 开头,表示这是一个事件的标识符
|
|
// 如果行以 "event:" 开头,表示这是一个事件的标识符
|
|
if len(line) > 6 && string(line[:6]) == "event:" {
|
|
if len(line) > 6 && string(line[:6]) == "event:" {
|