feat(*): 模型生成链路 - 完善 Agnes 结果兼容、价格展示与请求日志追踪

This commit is contained in:
ddCat
2026-08-28 06:53:57 +08:00
parent 2c02f5ef3d
commit bd0d0fd4fd
20 changed files with 671 additions and 108 deletions

View File

@@ -11,6 +11,7 @@ type AgnesTaskResponse = {
task_id?: string;
video_id?: string;
status?: string;
url?: string;
metadata?: { url?: string } | null;
error?: { message?: string; detail?: string; code?: string } | null;
message?: string;
@@ -64,8 +65,8 @@ export async function pollAgnesVideoTask(deps: VideoProviderDeps, config: Resolv
const state = deps.response.unwrapEnvelope(raw, "Agnes 接口没有返回任务状态");
const status = String(state.status || "").trim().toLowerCase();
if (status === "completed" || status === "succeeded" || status === "success" || status === "done") {
const url = String(state.metadata?.url || "").trim();
if (!url) return { status: "failed", error: "Agnes 任务已完成但没有返回 metadata.url" };
const url = String(state.metadata?.url || state.url || "").trim();
if (!url) return { status: "failed", error: "Agnes 任务已完成但没有返回视频 URL" };
return { status: "completed", result: await deps.response.videoResultFromUrl(url, options) };
}
if (status === "failed" || status === "cancelled" || status === "canceled") return { status: "failed", error: agnesFailureMessage(state) };