/**不同类型 将有不同元数据 */ export enum ScriptSliceType { /** 文本 */ text = "text", /**角色 */ role = "role", /** 场景 */ scene = "scene", } /** * 剧本片段值对象接口 */ export interface ScriptSlice { /**唯一标识符 */ readonly id: string; /** 类型 */ type: ScriptSliceType; /** 剧本内容 */ text: string; /** 元数据 */ metaData: any; } /**对话内容项 */ export interface ContentItem { /** 角色ID */ roleId: string; /** 对话内容 */ content: string; } /**镜头值对象 */ export interface LensType { /** 镜头名称 */ name: string; /** 镜头描述 */ content: string; /**运镜描述 */ movement: string; } /** * @description: 剧本 值对象,将剧本文本转换为剧本对象 * @return {*} */ export class ScriptValueObject { scriptSlices: ScriptSlice[] = []; /** * @description: 构造函数,初始化剧本 * @param scriptText 剧本文本字符串 */ constructor(scriptText?: string) { if (scriptText) { this.parseFromString(scriptText); } } /** * @description: 从字符串解析剧本片段 * @param scriptText 剧本文本字符串 */ parseFromString(scriptText: string): void { // TODO: 实现字符串解析逻辑 } /** * @description: 检测剧本片段类型 * @param text 文本内容 * @returns ScriptSliceType */ private detectScriptType(text: string): ScriptSliceType { // TODO: 实现类型检测逻辑 return ScriptSliceType.text; } /** * @description: 提取元数据 * @param text 文本内容 * @returns any */ private extractMetadata(text: string): any { // TODO: 实现元数据提取逻辑 return {}; } /** * @description: 将剧本片段转换为字符串 * @returns string */ toString(): string { return this.scriptSlices.map((slice) => slice.text).join(""); } }