前端(Vite + React)、API/worker(Fastify + BullMQ)、api-contracts 契约包、 迁移脚本、测试与自托管 docker-compose 示例。 开源准备:运维脚本与机器信息已拆到私有仓库;公司名、备案号、隐私邮箱改读 publicCompliance.local.json(仓库只保留占位模板);站点地址与客服二维码改为 VITE_ 环境变量;fixtures 中的真实用户标识已匿名化;三个 package.json 标注 Apache-2.0。 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
19 lines
868 B
TypeScript
19 lines
868 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { getUserVisibleGenerationFailureReason } from '../src/domain/generationFailureMessage.js';
|
|
|
|
describe('生成失败用户文案', () => {
|
|
it.each([
|
|
'ratio must be adaptive for first frame generation',
|
|
'reference_video duration exceeds limit',
|
|
'omni_reference_task_type is invalid',
|
|
])('将 Seedance 参数错误收敛为可操作的安全提示:%s', reason => {
|
|
expect(getUserVisibleGenerationFailureReason('provider-error', reason, 'failed'))
|
|
.toBe('参考素材或生成参数不符合模型要求,请调整后重试。');
|
|
});
|
|
|
|
it('不向用户暴露未识别的供应商原始错误', () => {
|
|
expect(getUserVisibleGenerationFailureReason('provider-error', 'request_id=secret raw error', 'failed'))
|
|
.toBe('生成服务暂时不可用,请稍后重试。');
|
|
});
|
|
});
|