Skip to content

Commit b5b7135

Browse files
committed
fix
1 parent 778da83 commit b5b7135

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

common/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package common
33
import "time"
44

55
var StartTime = time.Now().Unix() // unit: second
6-
var Version = "v1.10.16" // this hard coding will be replaced automatically when building, no need to manually change
6+
var Version = "v1.10.17" // this hard coding will be replaced automatically when building, no need to manually change
77

88
var DefaultOpenaiModelList = []string{
99
"gpt-4o",

controller/chat.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -958,11 +958,13 @@ func handleStreamRequest(c *gin.Context, client cycletls.CycleTLS, cookie string
958958
// 处理流式数据的辅助函数,返回bool表示是否继续处理
959959
func processStreamData(c *gin.Context, data string, projectId *string, cookie, responseId, model string, jsonData []byte, searchModel bool) bool {
960960
data = strings.TrimSpace(data)
961-
if !strings.HasPrefix(data, "data: ") {
961+
//if !strings.HasPrefix(data, "data: ") {
962+
// return true
963+
//}
964+
data = strings.TrimPrefix(data, "data: ")
965+
if !strings.HasPrefix(data, "{\"message_id\": ") && !strings.HasPrefix(data, " {\"id\": ") {
962966
return true
963967
}
964-
data = strings.TrimPrefix(data, "data: ")
965-
966968
var event map[string]interface{}
967969
if err := json.Unmarshal([]byte(data), &event); err != nil {
968970
logger.Errorf(c.Request.Context(), "Failed to unmarshal event: %v", err)

0 commit comments

Comments
 (0)