fix: 修复流式响应中 URL 的 & 被转义为 \u0026 的问题

新增 jsonMarshalRaw 使用 SetEscapeHTML(false) 替代 json.Marshal,
避免 HTML 字符转义导致客户端无法直接使用返回的 URL。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
huangenjun
2026-02-25 11:32:56 +08:00
parent 3c619a8da5
commit 65d4ca2563
2 changed files with 22 additions and 4 deletions

View File

@@ -316,7 +316,7 @@ func (s *SoraGatewayService) processSoraSSEData(data string, originalModel strin
}
}
updatedData, err := json.Marshal(payload)
updatedData, err := jsonMarshalRaw(payload)
if err != nil {
return "data: " + data, contentDelta, nil
}
@@ -484,7 +484,7 @@ func (s *SoraGatewayService) flushSoraRewriteBuffer(buffer string, originalModel
if originalModel != "" {
payload["model"] = originalModel
}
updatedData, err := json.Marshal(payload)
updatedData, err := jsonMarshalRaw(payload)
if err != nil {
return "", "", err
}