"use client"; import { useState, useEffect } from 'react'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Textarea } from '@/components/ui/textarea'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { Badge } from '@/components/ui/badge'; import { Separator } from '@/components/ui/separator'; import { ArrowRight, Sparkles, Users, FileText, Play, Pause, RefreshCw, Palette, Volume2 } from 'lucide-react'; import { Progress } from '@/components/ui/progress'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { motion } from 'framer-motion'; interface InputScriptStepProps { onNext: () => void; } interface Character { id: string; name: string; description: string; personality: string; appearance: string; voice: string; avatar: string; fullBodyImage: string; audioSample: string; styles: string[]; currentStyle: number; } const aiModels = [ { id: 'gpt-4', name: 'GPT-4 Turbo', description: 'Most advanced model with superior creativity' }, { id: 'gpt-3.5', name: 'GPT-3.5 Turbo', description: 'Fast and efficient for most tasks' }, { id: 'claude-3', name: 'Claude 3 Opus', description: 'Excellent for narrative and storytelling' }, ]; const loadingSteps = [ { text: "分析脚本内容...", progress: 20 }, { text: "提取角色信息...", progress: 40 }, { text: "生成角色形象...", progress: 60 }, { text: "匹配音色特征...", progress: 80 }, { text: "完成角色创建...", progress: 100 }, ]; const mockCharacters: Character[] = [ { id: "1", name: "凤青楗", description: "重生的凤凰,拥有强大的意志力,决心改变自己的命运", personality: "坚强、勇敢、充满希望", appearance: "优雅的凤凰形象,金色羽毛,炯炯有神的眼睛", voice: "温暖而坚定的女声", avatar: "https://images.pexels.com/photos/3861969/pexels-photo-3861969.jpeg?auto=compress&cs=tinysrgb&w=300", fullBodyImage: "https://images.pexels.com/photos/3861969/pexels-photo-3861969.jpeg?auto=compress&cs=tinysrgb&w=400", audioSample: "https://www.soundjay.com/misc/sounds/bell-ringing-05.wav", styles: [ "https://images.pexels.com/photos/3861969/pexels-photo-3861969.jpeg?auto=compress&cs=tinysrgb&w=300", "https://images.pexels.com/photos/3184287/pexels-photo-3184287.jpeg?auto=compress&cs=tinysrgb&w=300", "https://images.pexels.com/photos/1222271/pexels-photo-1222271.jpeg?auto=compress&cs=tinysrgb&w=300" ], currentStyle: 0 }, { id: "2", name: "星光使者", description: "掌控星辰力量的神秘角色,与凤青楗一同战斗", personality: "智慧、冷静、神秘", appearance: "星光环绕的身影,深邃的蓝色长袍", voice: "低沉磁性的男声", avatar: "https://images.pexels.com/photos/3184287/pexels-photo-3184287.jpeg?auto=compress&cs=tinysrgb&w=300", fullBodyImage: "https://images.pexels.com/photos/3184287/pexels-photo-3184287.jpeg?auto=compress&cs=tinysrgb&w=400", audioSample: "https://www.soundjay.com/misc/sounds/bell-ringing-05.wav", styles: [ "https://images.pexels.com/photos/3184287/pexels-photo-3184287.jpeg?auto=compress&cs=tinysrgb&w=300", "https://images.pexels.com/photos/1222271/pexels-photo-1222271.jpeg?auto=compress&cs=tinysrgb&w=300", "https://images.pexels.com/photos/3184465/pexels-photo-3184465.jpeg?auto=compress&cs=tinysrgb&w=300" ], currentStyle: 0 } ]; // 新的Loading组件 const CharacterLoading = ({ step }: { step: string }) => { return (
{/* 旋转粒子环 */} {/* 中心波动光圈 */} {/* 扫光线条 */} {/* 核心文本 */} {step}
); }; // 角色卡片组件 const CharacterCard = ({ character, onStyleChange, onPlayAudio, isPlaying }: { character: Character; onStyleChange: (id: string, styleIndex: number) => void; onPlayAudio: (id: string) => void; isPlaying: string | null; }) => ( {/* 角色头像区域 */}
{character.name} {/* 渐变遮罩 */}
{/* 角色名字 */}

{character.name}

{character.voice}
{/* 音频播放按钮 */}
{/* 详细信息 */}

{character.description}

{character.personality}

{character.appearance}

{/* 样式切换 */}
{character.styles.map((style, index) => ( ))}
); // 角色生成结果组件 const CharacterGenerationResult = ({ characters, onStyleChange, onPlayAudio, isPlaying, onContinue }: { characters: Character[]; onStyleChange: (id: string, styleIndex: number) => void; onPlayAudio: (id: string) => void; isPlaying: string | null; onContinue: () => void; }) => (
{/* 标题区域 */}
角色生成完成

您的故事角色

AI已经根据您的脚本生成了{characters.length}个独特的角色,每个角色都有专属的形象和音色。 您可以试听音色、切换形象样式,满意后继续下一步。

{/* 角色网格 */}
{characters.map((character) => (
))}
{/* 操作按钮 */}
); export function InputScriptStep({ onNext }: InputScriptStepProps) { const [script, setScript] = useState(''); const [chapters, setChapters] = useState('4'); const [shots, setShots] = useState('8'); const [showActorsPanel, setShowActorsPanel] = useState(false); const [isGenerating, setIsGenerating] = useState(true); const [showCharacters, setShowCharacters] = useState(false); const [loadingStep, setLoadingStep] = useState(0); const [characters, setCharacters] = useState(mockCharacters); const [playingAudio, setPlayingAudio] = useState(null); // 模拟生成过程 useEffect(() => { if (isGenerating) { const timer = setInterval(() => { setLoadingStep((prev) => { if (prev >= loadingSteps.length - 1) { clearInterval(timer); setTimeout(() => { setIsGenerating(false); setShowCharacters(true); }, 500); return prev; } return prev + 1; }); }, 1500); return () => clearInterval(timer); } }, [isGenerating]); const handleSubmit = () => { if (script.trim() && chapters) { setIsGenerating(true); setLoadingStep(0); } }; const handleStyleChange = (characterId: string, styleIndex: number) => { setCharacters(prev => prev.map(char => char.id === characterId ? { ...char, currentStyle: styleIndex, fullBodyImage: char.styles[styleIndex] } : char ) ); }; const handlePlayAudio = (characterId: string) => { if (playingAudio === characterId) { setPlayingAudio(null); } else { setPlayingAudio(characterId); // 模拟音频播放,3秒后自动停止 setTimeout(() => setPlayingAudio(null), 3000); } }; const handleContinue = () => { setShowCharacters(false); onNext(); }; // 显示角色生成结果 if (showCharacters) { return ( ); } // 原始的脚本输入界面 return (
{/* Script Input */}