refactor(*): 稳定期治理 - 收敛核心架构、错误语义并修复跨项目数据竞态
This commit is contained in:
1 parent
bacd502f5c
commit
b5f3413ded
298 files changed
+12681
-26428
No files matched your search
@@ -11,13 +11,16 @@ import { mergeFetchedChannelModelCosts, type ChannelModelCatalogItem } from "../
|
||||
import { defaultModelCapabilityConfig, pluginWorkflowCapabilityConfig } from "../src/lib/model-capabilities";
|
||||
import { ChannelModelSettings } from "../src/pages/settings/channel-video-pricing";
|
||||
import { fetchChannelModels } from "../src/services/api/image";
|
||||
import { apiClient } from "../src/services/api/request";
|
||||
import { createVideoGenerationTask } from "../src/services/api/video";
|
||||
import { createModelChannel, defaultConfig, modelDisplayName, normalizeConfigSnapshot, resolveModelRequestConfig, selectableModelsByCapability, type AiConfig } from "../src/stores/use-config-store";
|
||||
|
||||
const originalAxiosPost = axios.post;
|
||||
const originalAxiosRequest = axios.request;
|
||||
const originalApiRequest = apiClient.request;
|
||||
|
||||
afterEach(() => {
|
||||
axios.post = originalAxiosPost;
|
||||
axios.request = originalAxiosRequest;
|
||||
apiClient.request = originalApiRequest;
|
||||
});
|
||||
|
||||
const omniCatalog: ChannelModelCatalogItem = {
|
||||
@@ -84,7 +87,7 @@ describe("public channel model catalog", () => {
|
||||
});
|
||||
|
||||
test("preserves six public capabilities without expanding compatibility IDs", async () => {
|
||||
axios.post = (async () => ({
|
||||
apiClient.request = (async () => ({
|
||||
data: {
|
||||
code: 0,
|
||||
data: {
|
||||
@@ -98,7 +101,7 @@ describe("public channel model catalog", () => {
|
||||
],
|
||||
},
|
||||
},
|
||||
})) as typeof axios.post;
|
||||
})) as typeof apiClient.request;
|
||||
const channel = createModelChannel({ baseUrl: "https://flow.example", apiKey: "synthetic-test-key", models: [] });
|
||||
|
||||
const result = await fetchChannelModels(channel, true);
|
||||
@@ -336,10 +339,10 @@ describe("public channel model catalog", () => {
|
||||
|
||||
test("omits resolution_name for Omni and for auto instead of inventing 720p", async () => {
|
||||
const bodies: Record<string, string>[] = [];
|
||||
axios.post = (async (_url: string, body: unknown) => {
|
||||
bodies.push(formEntries(body));
|
||||
axios.request = (async (request) => {
|
||||
bodies.push(formEntries(request.data));
|
||||
return { data: { id: `synthetic-${bodies.length}` } };
|
||||
}) as typeof axios.post;
|
||||
}) as typeof axios.request;
|
||||
|
||||
const omniConfig = configForCatalog([omniCatalog], { videoSeconds: "10", size: "16:9", vquality: "720" });
|
||||
await createVideoGenerationTask(omniConfig, "synthetic prompt");
|
||||
@@ -360,10 +363,10 @@ describe("public channel model catalog", () => {
|
||||
|
||||
test("sends a declared compatible HD resolution for a video capability", async () => {
|
||||
let body: Record<string, string> = {};
|
||||
axios.post = (async (_url: string, requestBody: unknown) => {
|
||||
body = formEntries(requestBody);
|
||||
axios.request = (async (request) => {
|
||||
body = formEntries(request.data);
|
||||
return { data: { id: "synthetic-hd" } };
|
||||
}) as typeof axios.post;
|
||||
}) as typeof axios.request;
|
||||
const catalog: ChannelModelCatalogItem = {
|
||||
...omniCatalog,
|
||||
id: "veo-public",
|
||||
@@ -383,10 +386,10 @@ describe("public channel model catalog", () => {
|
||||
|
||||
test("preserves provider resolution enums with direction suffixes across Canvas display and requests", async () => {
|
||||
let body: Record<string, string> = {};
|
||||
axios.post = (async (_url: string, requestBody: unknown) => {
|
||||
body = formEntries(requestBody);
|
||||
axios.request = (async (request) => {
|
||||
body = formEntries(request.data);
|
||||
return { data: { id: "synthetic-directional" } };
|
||||
}) as typeof axios.post;
|
||||
}) as typeof axios.request;
|
||||
const catalog: ChannelModelCatalogItem = {
|
||||
...omniCatalog,
|
||||
id: "directional-video",
|
||||
|
||||
Reference in new issue
Block a user