Fix/ecommerce video 400 bug #7
@@ -18,6 +18,7 @@ import {
|
|||||||
type PlanStep,
|
type PlanStep,
|
||||||
} from "./ecommerceVideoTypes";
|
} from "./ecommerceVideoTypes";
|
||||||
import type { AdVideoUserConfig } from "../../api/adVideoPlanClient";
|
import type { AdVideoUserConfig } from "../../api/adVideoPlanClient";
|
||||||
|
import { ServerRequestError } from "../../api/serverConnection";
|
||||||
import { saveToolResultToLocal, addToolResultToAssetLibrary } from "../workbench/toolResultActions";
|
import { saveToolResultToLocal, addToolResultToAssetLibrary } from "../workbench/toolResultActions";
|
||||||
import { useAppStore } from "../../stores";
|
import { useAppStore } from "../../stores";
|
||||||
|
|
||||||
@@ -192,8 +193,15 @@ export default function EcommerceVideoWorkspace({
|
|||||||
renderAbortRef.current,
|
renderAbortRef.current,
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
const message = err instanceof Error ? err.message : "生成失败";
|
||||||
|
const isPaymentError = err instanceof ServerRequestError && err.status === 402;
|
||||||
setScenes((prev) => prev.map((s) =>
|
setScenes((prev) => prev.map((s) =>
|
||||||
s.sceneId === scene.sceneId ? { ...s, status: "failed", error: err instanceof Error ? err.message : "生成失败" } : s));
|
s.sceneId === scene.sceneId ? { ...s, status: "failed", error: isPaymentError ? "余额不足,请充值后继续" : message } : s));
|
||||||
|
if (isPaymentError) {
|
||||||
|
setError("余额不足,请充值后再生成视频");
|
||||||
|
renderAbortRef.current.current = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setScenes((current) => {
|
setScenes((current) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user