Merge remote-tracking branch 'origin/master' into feat/recommend-runtime-guest
# Conflicts: # docs/【玩法创作】平台入口与玩法链路-2026-05-15.md
This commit is contained in:
36
src/services/wooden-fish/woodenFishClient.test.ts
Normal file
36
src/services/wooden-fish/woodenFishClient.test.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { beforeEach, expect, test, vi } from 'vitest';
|
||||
|
||||
const { createCreationAgentClientMock } = vi.hoisted(() => ({
|
||||
createCreationAgentClientMock: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('../creation-agent', () => ({
|
||||
createCreationAgentClient: createCreationAgentClientMock,
|
||||
}));
|
||||
|
||||
vi.mock('../apiClient', () => ({
|
||||
requestJson: vi.fn(),
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
vi.resetModules();
|
||||
createCreationAgentClientMock.mockReset();
|
||||
createCreationAgentClientMock.mockReturnValue({
|
||||
createSession: vi.fn(),
|
||||
getSession: vi.fn(),
|
||||
sendMessage: vi.fn(),
|
||||
streamMessage: vi.fn(),
|
||||
executeAction: vi.fn(),
|
||||
});
|
||||
});
|
||||
|
||||
test('wooden fish creation keeps image2 generation requests alive long enough', async () => {
|
||||
await import('./woodenFishClient');
|
||||
|
||||
expect(createCreationAgentClientMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
createSessionTimeoutMs: 20 * 60 * 1000,
|
||||
executeActionTimeoutMs: 20 * 60 * 1000,
|
||||
}),
|
||||
);
|
||||
});
|
||||
@@ -27,6 +27,8 @@ import {
|
||||
const WOODEN_FISH_API_BASE = '/api/creation/wooden-fish/sessions';
|
||||
const WOODEN_FISH_WORKS_API_BASE = '/api/creation/wooden-fish/works';
|
||||
const WOODEN_FISH_RUNTIME_API_BASE = '/api/runtime/wooden-fish';
|
||||
// 中文注释:敲木鱼创作会串行等待多次 image2 与 OSS 写入,前端请求窗口需要覆盖完整生成链路。
|
||||
const WOODEN_FISH_GENERATION_TIMEOUT_MS = 20 * 60 * 1000;
|
||||
const WOODEN_FISH_RUNTIME_READ_RETRY: ApiRetryOptions = {
|
||||
maxRetries: 1,
|
||||
baseDelayMs: 120,
|
||||
@@ -78,6 +80,8 @@ const woodenFishCreationClient = createCreationAgentClient<
|
||||
streamIncomplete: '敲木鱼共创消息流式结果不完整',
|
||||
executeAction: '执行敲木鱼共创操作失败',
|
||||
},
|
||||
createSessionTimeoutMs: WOODEN_FISH_GENERATION_TIMEOUT_MS,
|
||||
executeActionTimeoutMs: WOODEN_FISH_GENERATION_TIMEOUT_MS,
|
||||
});
|
||||
|
||||
type FlattenedWoodenFishWorkProfileResponse = Omit<
|
||||
@@ -120,6 +124,8 @@ function normalizeWoodenFishWorkProfile(
|
||||
hitObjectAsset: flattened.hitObjectAsset,
|
||||
backgroundAsset:
|
||||
flattened.backgroundAsset ?? flattened.draft?.backgroundAsset ?? null,
|
||||
backButtonAsset:
|
||||
flattened.backButtonAsset ?? flattened.draft?.backButtonAsset ?? null,
|
||||
hitSoundAsset: flattened.hitSoundAsset,
|
||||
floatingWords: flattened.floatingWords,
|
||||
};
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
import type { WoodenFishAudioAsset } from '../../../packages/shared/src/contracts/woodenFish';
|
||||
|
||||
export const WOODEN_FISH_DEFAULT_HIT_OBJECT_SRC =
|
||||
'/wooden-fish/default-hit-object.png';
|
||||
|
||||
export const WOODEN_FISH_DEFAULT_HIT_SOUND_SRC =
|
||||
'/wooden-fish/default-hit-sound.mp3';
|
||||
|
||||
export const WOODEN_FISH_DEFAULT_HIT_OBJECT_PROMPT =
|
||||
'默认敲击物图案,圆润木质质感,透明背景';
|
||||
|
||||
export const WOODEN_FISH_DEFAULT_HIT_SOUND_ASSET: WoodenFishAudioAsset = {
|
||||
assetId: 'wooden-fish-default-hit-sound',
|
||||
audioSrc: WOODEN_FISH_DEFAULT_HIT_SOUND_SRC,
|
||||
audioObjectKey: 'public/wooden-fish/default-hit-sound.mp3',
|
||||
assetObjectId: 'wooden-fish-default-hit-sound',
|
||||
source: 'bundled-default',
|
||||
prompt: '默认木鱼音',
|
||||
durationMs: 3000,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user