实现 SFX V2 T1 契约与提示词基础

统一前后端 SFX Prompt Unicode canonicalization、字符计数和 2048 边界
固化 52 个音效预设、追加规则及跨语言测试向量
演进共享音频请求响应、duration、Loop 和 V2 metadata 契约
增加 External model 输入矩阵纯函数并保持正式接线归属 T5
补齐前端提交、读取、深拷贝与请求边界回归测试
更新共享计划并标记 T1 完成且当前不可发布
This commit is contained in:
2026-08-06 13:05:48 +00:00
parent 6fd731f56c
commit cd80c085ff
24 changed files with 1559 additions and 97 deletions
@@ -13,6 +13,7 @@ import {
DEFAULT_CANVAS_BACKGROUND_COLOR,
dropDeadInlineGenerationPlaceholders,
formatCanvasDisplayScalePercent,
generationInputsOrNull,
hydrateCanvasGenerationDialog,
hydrateLayer,
INLINE_GENERATION_PLACEHOLDER_LIVE_WINDOW_MS,
@@ -971,6 +972,47 @@ describe('ImageCanvasEditorModel', () => {
expect(hydrated).not.toHaveProperty('durationSeconds');
});
it('keeps only valid authoritative SFX V2 metadata in generation inputs', () => {
const soundEffect = {
schemaVersion: 2 as const,
userPrompt: '金币落地,轻快可爱',
actualPrompt: 'A bright, cute coin landing chime',
model: 'eleven_text_to_sound_v2' as const,
durationMode: 'manual' as const,
requestedDurationSeconds: 5,
actualDurationSeconds: 5.12,
loop: false,
};
expect(
generationInputsOrNull({ fields: [], references: [], soundEffect }),
).toEqual({ fields: [], references: [], soundEffect });
for (const invalidSoundEffect of [
{ ...soundEffect, schemaVersion: 1 },
{ ...soundEffect, model: 'audio1.0' },
{ ...soundEffect, userPrompt: ' 金币落地' },
{ ...soundEffect, actualDurationSeconds: 600.1 },
{
...soundEffect,
durationMode: 'auto',
requestedDurationSeconds: 5,
},
{
...soundEffect,
durationMode: 'manual',
requestedDurationSeconds: null,
},
]) {
expect(
generationInputsOrNull({
fields: [{ title: '用户描述', value: '金币落地' }],
references: [],
soundEffect: invalidSoundEffect,
}),
).toBeNull();
}
});
it('hydrates character animation sequence fields from the project resource', () => {
const layer: CanvasLayer = {
id: 'layer-action',