mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-13 15:47:28 +00:00
fix(ci): keep video live helper within plugin boundary
This commit is contained in:
@@ -16,8 +16,14 @@ import {
|
||||
encodePngRgba,
|
||||
fillPixel,
|
||||
getShellEnvAppliedKeys,
|
||||
isAuthErrorMessage,
|
||||
isBillingErrorMessage,
|
||||
isLiveProfileKeyModeEnabled,
|
||||
isLiveTestEnabled,
|
||||
isModelNotFoundErrorMessage,
|
||||
isOverloadedErrorMessage,
|
||||
isServerErrorMessage,
|
||||
isTimeoutErrorMessage,
|
||||
isTruthyEnvValue,
|
||||
normalizeVideoGenerationDuration,
|
||||
parseCsvFilter,
|
||||
@@ -36,7 +42,6 @@ import type {
|
||||
VideoGenerationRequest,
|
||||
} from "openclaw/plugin-sdk/test-env";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { resolveLiveVideoSkipReason } from "../test/helpers/media-generation/live-video-skip-reason.js";
|
||||
import alibabaPlugin from "./alibaba/index.js";
|
||||
import byteplusPlugin from "./byteplus/index.js";
|
||||
import deepinfraPlugin from "./deepinfra/index.js";
|
||||
@@ -225,6 +230,42 @@ function buildLiveCapabilityOverrides(params: {
|
||||
};
|
||||
}
|
||||
|
||||
function resolveLiveVideoSkipReason(message: string): string | null {
|
||||
if (isAuthErrorMessage(message)) {
|
||||
return "auth drift";
|
||||
}
|
||||
if (isModelNotFoundErrorMessage(message)) {
|
||||
return "model drift";
|
||||
}
|
||||
if (isBillingErrorMessage(message)) {
|
||||
return "billing drift";
|
||||
}
|
||||
if (
|
||||
isTimeoutErrorMessage(message) ||
|
||||
/did not finish in time/i.test(message) ||
|
||||
/last status:\s*in_progress/i.test(message)
|
||||
) {
|
||||
return "provider timeout";
|
||||
}
|
||||
if (isOverloadedErrorMessage(message) || isServerErrorMessage(message)) {
|
||||
return "provider outage";
|
||||
}
|
||||
if (
|
||||
/HTTP\s+404/i.test(message) &&
|
||||
/Invalid URL/i.test(message) &&
|
||||
/\/platform\/video_gen/i.test(message)
|
||||
) {
|
||||
return "provider endpoint drift";
|
||||
}
|
||||
if (/access denied|not authorized|not enabled|permission denied/i.test(message)) {
|
||||
return "provider/model drift";
|
||||
}
|
||||
if (/blocked by (?:our )?moderation system|content policy|policy violation/i.test(message)) {
|
||||
return "provider policy drift";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
async function runLiveVideoAttempt(params: {
|
||||
authLabel: string;
|
||||
attempted: string[];
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { resolveLiveVideoSkipReason } from "./live-video-skip-reason.js";
|
||||
|
||||
describe("resolveLiveVideoSkipReason", () => {
|
||||
it("classifies provider policy moderation blocks as skip-worthy drift", () => {
|
||||
expect(resolveLiveVideoSkipReason("Your request was blocked by our moderation system.")).toBe(
|
||||
"provider policy drift",
|
||||
);
|
||||
});
|
||||
|
||||
it("does not hide ordinary provider failures", () => {
|
||||
expect(resolveLiveVideoSkipReason("video generation returned an empty asset")).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -1,44 +0,0 @@
|
||||
import {
|
||||
isAuthErrorMessage,
|
||||
isBillingErrorMessage,
|
||||
isModelNotFoundErrorMessage,
|
||||
isOverloadedErrorMessage,
|
||||
isServerErrorMessage,
|
||||
isTimeoutErrorMessage,
|
||||
} from "openclaw/plugin-sdk/test-env";
|
||||
|
||||
export function resolveLiveVideoSkipReason(message: string): string | null {
|
||||
if (isAuthErrorMessage(message)) {
|
||||
return "auth drift";
|
||||
}
|
||||
if (isModelNotFoundErrorMessage(message)) {
|
||||
return "model drift";
|
||||
}
|
||||
if (isBillingErrorMessage(message)) {
|
||||
return "billing drift";
|
||||
}
|
||||
if (
|
||||
isTimeoutErrorMessage(message) ||
|
||||
/did not finish in time/i.test(message) ||
|
||||
/last status:\s*in_progress/i.test(message)
|
||||
) {
|
||||
return "provider timeout";
|
||||
}
|
||||
if (isOverloadedErrorMessage(message) || isServerErrorMessage(message)) {
|
||||
return "provider outage";
|
||||
}
|
||||
if (
|
||||
/HTTP\s+404/i.test(message) &&
|
||||
/Invalid URL/i.test(message) &&
|
||||
/\/platform\/video_gen/i.test(message)
|
||||
) {
|
||||
return "provider endpoint drift";
|
||||
}
|
||||
if (/access denied|not authorized|not enabled|permission denied/i.test(message)) {
|
||||
return "provider/model drift";
|
||||
}
|
||||
if (/blocked by (?:our )?moderation system|content policy|policy violation/i.test(message)) {
|
||||
return "provider policy drift";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user