feat: centralize DeepSeek SSE parsing, improve account identifier resolution, and simplify CORS configuration.

This commit is contained in:
CJACK
2026-02-17 03:45:55 +08:00
parent 2cde0a1d84
commit 23d5ac7fa2
12 changed files with 263 additions and 75 deletions

View File

@@ -31,22 +31,15 @@ func CollectStream(resp *http.Response, thinkingEnabled bool, closeBody bool) Co
currentType = "thinking"
}
_ = deepseek.ScanSSELines(resp, func(line []byte) bool {
chunk, done, ok := ParseDeepSeekSSELine(line)
if !ok {
result := ParseDeepSeekContentLine(line, thinkingEnabled, currentType)
currentType = result.NextType
if !result.Parsed {
return true
}
if done {
if result.Stop {
return false
}
if _, hasErr := chunk["error"]; hasErr {
return false
}
parts, finished, newType := ParseSSEChunkForContent(chunk, thinkingEnabled, currentType)
currentType = newType
if finished {
return false
}
for _, p := range parts {
for _, p := range result.Parts {
if p.Type == "thinking" {
thinking.WriteString(p.Text)
} else {