| 1 | import type { StoryProfileBeat, WorkplaceData } from "@/lib/types"; |
| 2 | |
| 3 | export function resolveBeats(workplace: WorkplaceData): StoryProfileBeat[] { |
| 4 | const beats = workplace.story_profile?.beats; |
| 5 | return Array.isArray(beats) ? beats : []; |
| 6 | } |
| 7 | |
| 8 | export function beatSummaryForShot( |
| 9 | workplace: WorkplaceData, |
| 10 | shotId: number, |
| 11 | ): string { |
| 12 | const beat = resolveBeats(workplace).find((item) => item.shot_id === shotId); |
| 13 | return beat?.summary?.trim() ?? ""; |
| 14 | } |
| 15 | |
| 16 | export function buildBeatRevisionFeedback( |
| 17 | shotId: number, |
| 18 | oldSummary: string, |
| 19 | newSummary: string, |
| 20 | ): string { |
| 21 | return [ |
| 22 | `用户修改了镜头「${shotId}」的分镜 summary。`, |
| 23 | `原内容:「${oldSummary}」。`, |
| 24 | `修改后:「${newSummary}」。`, |
| 25 | "请同步更新 story_profile.beats 中对应 beat 的 summary、重写该镜头提示词,并重新生成该镜头。", |
| 26 | ].join("\n"); |
| 27 | } |
| 28 |