fix: improve seedance reference handling

This commit is contained in:
stupid-h4er
2026-05-27 21:55:05 +08:00
parent 4bffb55695
commit 74ea4b81f2
9 changed files with 165 additions and 14 deletions
+20
View File
@@ -0,0 +1,20 @@
package handler
import (
"strings"
"testing"
)
func TestAIUpstreamErrorDetail(t *testing.T) {
got := aiUpstreamErrorDetail([]byte(`{"error":{"code":"InvalidParameter","message":"reference video fps is invalid"}}`))
if got != "InvalidParameter reference video fps is invalid" {
t.Fatalf("detail = %q", got)
}
}
func TestSafeUpstreamTextTruncates(t *testing.T) {
got := safeUpstreamText(strings.Repeat("错", 320))
if len([]rune(got)) != 303 {
t.Fatalf("truncated rune length = %d", len([]rune(got)))
}
}