完善二期清单

This commit is contained in:
Azmat@qq.com
2026-08-18 14:11:05 +08:00
parent d1ecb52125
commit dfe94a923e
55 changed files with 1754 additions and 137 deletions
+20
View File
@@ -23,6 +23,26 @@ export const VIDEO_STRUCTURES: Record<VideoStructure, string> = {
export const PRESENTATION_KEYS = Object.keys(PRESENTATION_FORMATS) as PresentationFormat[];
export const STRUCTURE_KEYS = Object.keys(VIDEO_STRUCTURES) as VideoStructure[];
const FORMAT_KEY_BY_LABEL: Record<string, PresentationFormat> = Object.fromEntries(
(Object.entries(PRESENTATION_FORMATS) as Array<[PresentationFormat, string]>).map(([key, label]) => [label, key])
);
const STRUCTURE_KEY_BY_LABEL: Record<string, VideoStructure> = Object.fromEntries(
(Object.entries(VIDEO_STRUCTURES) as Array<[VideoStructure, string]>).map(([key, label]) => [label, key])
);
/** 脚本落库存的是中文标签(「短剧」),设定卡下拉用的是 key(drama)。两边都认。 */
export function coercePresentationFormat(value: unknown, fallback: PresentationFormat = "oral"): PresentationFormat {
if (typeof value !== "string" || !value) return fallback;
if (value in PRESENTATION_FORMATS) return value as PresentationFormat;
return FORMAT_KEY_BY_LABEL[value] || fallback;
}
export function coerceVideoStructure(value: unknown, fallback: VideoStructure = "pain"): VideoStructure {
if (typeof value !== "string" || !value) return fallback;
if (value in VIDEO_STRUCTURES) return value as VideoStructure;
return STRUCTURE_KEY_BY_LABEL[value] || fallback;
}
/** 一句话说清每个选项是什么,挂在下拉旁边当说明,别让用户猜。 */
export const PRESENTATION_HINT: Record<PresentationFormat, string> = {
oral: "一个人对镜头说,信息密度最高、最省制作",