From 4d2c0b661b983057e505c3d8810e49afaafd2403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=97=E6=9E=B3?= <7854742+wang_rumeng@user.noreply.gitee.com> Date: Wed, 6 Aug 2025 13:18:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AF=AD=E8=A8=80=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=B0=86=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=E9=80=89=E9=A1=B9=E4=BB=8E=E7=AE=80=E5=86=99=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E5=AE=8C=E6=95=B4=E5=90=8D=E7=A7=B0=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=B8=BB=E9=A2=98=E6=A0=87=E7=AD=BE=E9=80=89=E6=8B=A9=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E5=A2=9E=E5=8A=A0=E9=94=99=E8=AF=AF=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E6=97=B6=E9=95=BF=E5=92=8C=E4=BD=8D=E7=BD=AE=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=99=BA=E8=83=BD=E4=BC=98=E5=8C=96=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E4=BB=A5=E6=8F=90=E5=8D=87=E7=94=A8=E6=88=B7=E4=BD=93?= =?UTF-8?q?=E9=AA=8C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/pages/create-to-video2.tsx | 20 +++++------ components/script-renderer/ScriptRenderer.tsx | 7 +++- components/ui/shot-editor/ShotEditor.tsx | 35 ++++++++++++++++++- 3 files changed, 48 insertions(+), 14 deletions(-) diff --git a/components/pages/create-to-video2.tsx b/components/pages/create-to-video2.tsx index 442f46b..456cabf 100644 --- a/components/pages/create-to-video2.tsx +++ b/components/pages/create-to-video2.tsx @@ -29,7 +29,7 @@ export function CreateToVideo2() { const [isFocus, setIsFocus] = useState(false); const [selectedMode, setSelectedMode] = useState(ModeEnum.AUTOMATIC); const [selectedResolution, setSelectedResolution] = useState(ResolutionEnum.HD_720P); - const [selectedLanguage, setSelectedLanguage] = useState('en'); + const [selectedLanguage, setSelectedLanguage] = useState('english'); const [script, setInputText] = useState(''); const editorRef = useRef(null); const [runTour, setRunTour] = useState(true); @@ -136,7 +136,8 @@ export function CreateToVideo2() { user_id: String(userId), script: script, mode: selectedMode, - resolution: selectedResolution + resolution: selectedResolution, + language: selectedLanguage }; // 调用创建剧集API @@ -244,7 +245,7 @@ export function CreateToVideo2() { ), children: [ { - key: 'en', + key: 'english', label: (
English @@ -252,7 +253,7 @@ export function CreateToVideo2() { ), }, { - key: 'zh', + key: 'chinese', label: (
Chinese @@ -261,7 +262,7 @@ export function CreateToVideo2() { ), }, { - key: 'ja', + key: 'japanese', label: (
Japanese @@ -270,7 +271,7 @@ export function CreateToVideo2() { ), }, { - key: 'ko', + key: 'korean', label: (
Korean @@ -302,16 +303,11 @@ export function CreateToVideo2() { if (loadingIdea) return; setLoadingIdea(true); setTimeout(() => { - setInputText('idea'); + setInputText(ideaText); setLoadingIdea(false); }, 3000); }; - const handleStartCreating = () => { - setActiveTab('script'); - setInputText(ideaText); - } - // 处理编辑器聚焦 const handleEditorFocus = () => { setIsFocus(true); diff --git a/components/script-renderer/ScriptRenderer.tsx b/components/script-renderer/ScriptRenderer.tsx index 8c4b9c5..62ffe98 100644 --- a/components/script-renderer/ScriptRenderer.tsx +++ b/components/script-renderer/ScriptRenderer.tsx @@ -107,7 +107,12 @@ export const ScriptRenderer: React.FC = ({ data }) => { const handleThemeTagChange = (value: string[]) => { console.log('主题标签更改', value); if (value.length > 5) { - return toast.error('最多可选择5个主题标签'); + toast.error('最多可选择5个主题标签', { + duration: 3000, + position: 'top-center', + richColors: true, + }); + return; } setAddThemeTag(value); }; diff --git a/components/ui/shot-editor/ShotEditor.tsx b/components/ui/shot-editor/ShotEditor.tsx index e9ab0c0..1cddd66 100644 --- a/components/ui/shot-editor/ShotEditor.tsx +++ b/components/ui/shot-editor/ShotEditor.tsx @@ -5,6 +5,8 @@ import { motion } from "framer-motion"; import { CharacterTokenExtension } from './CharacterToken'; import { ShotTitle } from './ShotTitle'; import { ReadonlyText } from './ReadonlyText'; +import { Sparkles } from 'lucide-react'; +import { toast } from 'sonner'; const initialContent = { type: 'doc', @@ -41,6 +43,14 @@ interface ShotEditorProps { const ShotEditor = React.forwardRef<{ addSegment: () => void, onCharacterClick: (attrs: any) => void }, ShotEditorProps>(function ShotEditor({ onAddSegment, onCharacterClick }, ref) { const [segments, setSegments] = useState(initialContent.content); + const [isOptimizing, setIsOptimizing] = useState(false); + + const handleSmartPolish = () => { + setIsOptimizing(true); + setTimeout(() => { + setIsOptimizing(false); + }, 3000); + }; const editor = useEditor({ extensions: [ @@ -86,6 +96,16 @@ const ShotEditor = React.forwardRef<{ addSegment: () => void, onCharacterClick: shotCount++; } }); + + // 不能超过4个分镜 + if (shotCount >= 4) { + toast.error('不能超过4个分镜', { + duration: 3000, + position: 'top-center', + richColors: true, + }); + return; + } editor.chain().focus('end').insertContent([ { @@ -116,8 +136,21 @@ const ShotEditor = React.forwardRef<{ addSegment: () => void, onCharacterClick: } return ( -
+
+ {/* 智能润色按钮 */} + + + {isOptimizing ? "优化中..." : "智能优化"} + {/*