fix(video): NewAPI Channel 2 - 修复轮询与结果解析

创建成功后的短暂 task_not_exist 按退避策略重试,并在短期窗口耗尽后保留 running 状态,继续回查原 Provider Task ID。

补齐嵌套任务 ID 与视频结果地址解析,更新生成插件、协议文档和专项回归测试。
This commit is contained in:
zAhYAng committed 2026-09-05 09:56:59 +08:00
1 parent 7ec51732f7
commit 617b70e189
13 files changed
+378 -12

No files matched your search

@@ -35,12 +35,22 @@ func TestOnlyResumableNewAPIChannel2VideoDeadlinesStayRunning(t *testing.T) {
if !svc.shouldDeferVideoProviderTask(base, string(input), context.DeadlineExceeded) {
t.Fatal("resumable NewAPI Channel 2 deadline should remain running")
}
pendingErr := providerStatePendingError{TaskID: base.ProviderRequestID, Cause: providerHTTPError{StatusCode: 400, Body: `{"code":"task_not_exist"}`}}
if !svc.shouldDeferVideoProviderTask(base, string(input), pendingErr) {
t.Fatal("resumable NewAPI Channel 2 provider sync delay should remain running")
}
if svc.shouldDeferVideoProviderTask(model.Task{ID: "task-2", Type: "canvas_video"}, string(input), context.DeadlineExceeded) {
t.Fatal("missing provider task id must not be deferred")
}
if svc.shouldDeferVideoProviderTask(model.Task{ID: "task-2", Type: "canvas_video"}, string(input), pendingErr) {
t.Fatal("provider sync delay without persisted provider task id must not be deferred")
}
if svc.shouldDeferVideoProviderTask(base, string(input), context.Canceled) {
t.Fatal("explicit cancellation must not be deferred")
}
if svc.shouldDeferVideoProviderTask(base, string(input), providerHTTPError{StatusCode: 400, Body: `{"code":"task_not_exist"}`}) {
t.Fatal("untyped provider error must not be deferred")
}
other, err := json.Marshal(canvasGenerationInput{Mode: "video", Config: providerConfig{BaseURL: "https://example.com", InterfaceType: string(model.ChannelInterfaceNewAPIVideo)}})
if err != nil {
t.Fatal(err)