From 1455e4bf80f25ac97d36b0bae5ca532dad890d1b Mon Sep 17 00:00:00 2001 From: "3371392206@qq.com" <3371392206@qq.com> Date: Sat, 15 Aug 2026 17:55:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20synthesis.go=20?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E4=B8=8D=E5=8C=B9=E9=85=8D=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=94=99=E8=AF=AF=20([]byte=E2=86=92string)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adapter/volcano/synthesis.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/adapter/volcano/synthesis.go b/adapter/volcano/synthesis.go index 0e900ea..6093e97 100644 --- a/adapter/volcano/synthesis.go +++ b/adapter/volcano/synthesis.go @@ -29,6 +29,15 @@ func (nopMetrics) UpstreamFinished(string, string, string, string, time.Duration func (nopMetrics) UpstreamUsage(string, int) {} // Synthesis 调用火山 v3 一次,返回组装好的结果。 +// +// 入参: +// - ctx:超时控制 +// - client:复用的 HTTPClient +// - opts:从 setting 构造的完整参数(text 字段会被 text 覆盖) +// - text:本次合成的实际文本 +// - clientFormat:客户端期望的最终格式,"wav" 内部转 pcm 后本地拼 wav 头 +// - speed:OpenAI 风格的 speed(倍率,0.5~2.0) +// - mtr:可选埋点;传 nil 等价于 nopMetrics func Synthesis( ctx context.Context, client *HTTPClient, @@ -142,13 +151,13 @@ func newRequestID() string { // extractAdditionsForLog 从已编码的请求体里取 additions 字段值,便于日志展示。 func extractAdditionsForLog(body []byte) string { - const key = `"additions":"` + const key = "\"additions\":\"" idx := bytesIndex(body, key) if idx < 0 { return "" } rest := body[idx+len(key):] - end := bytesIndex(rest, []byte{'"'}) + end := bytesIndex(rest, "\"") if end < 0 { return "" }