|
@@ -192,7 +192,7 @@ func fastgptSendChat(l *SubmitApiChatLogic, w http.ResponseWriter, content, apiB
|
|
|
// 拼接回答
|
|
|
answer = answer + jsonData.Answer
|
|
|
|
|
|
- _, err = fmt.Fprintln(w, "data: "+string(lineData)+"\n")
|
|
|
+ _, err = fmt.Fprintf(w, "%s", "data: "+string(lineData)+"\r\n")
|
|
|
fmt.Printf("response=%v\n", string(lineData))
|
|
|
if err != nil {
|
|
|
logAnswer(l, userId, sessionId, botId, botType, answer)
|
|
@@ -203,6 +203,8 @@ func fastgptSendChat(l *SubmitApiChatLogic, w http.ResponseWriter, content, apiB
|
|
|
|
|
|
if finish {
|
|
|
logAnswer(l, userId, sessionId, botId, botType, answer)
|
|
|
+ _, _ = fmt.Fprintf(w, "%s", "0\r\n")
|
|
|
+ flusher.Flush()
|
|
|
break
|
|
|
}
|
|
|
}
|
|
@@ -302,7 +304,7 @@ func difySendChat(l *SubmitApiChatLogic, w http.ResponseWriter, content, apiBase
|
|
|
// 拼接回答
|
|
|
answer = answer + jsonData.Answer
|
|
|
|
|
|
- _, err = fmt.Fprintln(w, "data: "+string(lineData)+"\n")
|
|
|
+ _, err = fmt.Fprintf(w, "%s", "data: "+string(lineData)+"\r\n")
|
|
|
fmt.Printf("response=%v\n", string(lineData))
|
|
|
if err != nil {
|
|
|
logAnswer(l, userId, sessionId, botId, botType, answer)
|
|
@@ -313,6 +315,8 @@ func difySendChat(l *SubmitApiChatLogic, w http.ResponseWriter, content, apiBase
|
|
|
|
|
|
if finish {
|
|
|
logAnswer(l, userId, sessionId, botId, botType, answer)
|
|
|
+ _, _ = fmt.Fprintf(w, "%s", "0\r\n")
|
|
|
+ flusher.Flush()
|
|
|
break
|
|
|
}
|
|
|
}
|