diff --git a/src/components/AIVideoGenerator.tsx b/src/components/AIVideoGenerator.tsx index 79fa5eb..5ce5fb0 100644 --- a/src/components/AIVideoGenerator.tsx +++ b/src/components/AIVideoGenerator.tsx @@ -17,6 +17,7 @@ const AIVideoGenerator: React.FC = ({ className = '' }) = const [customPrompt, setCustomPrompt] = useState('') const [batchPrompts, setBatchPrompts] = useState(['']) const [outputFolder, setOutputFolder] = useState('') + const [singleOutputFolder, setSingleOutputFolder] = useState('') const [duration, setDuration] = useState('5') const [modelType, setModelType] = useState('lite') const [previewData, setPreviewData] = useState<{ @@ -114,6 +115,30 @@ const AIVideoGenerator: React.FC = ({ className = '' }) = } } + const handleSingleOutputFolderSelect = async () => { + try { + console.log('Opening output folder dialog...') + const folderPath = await invoke('select_folder') as string + console.log('Selected output folder:', folderPath) + setSingleOutputFolder(folderPath) + } catch (error) { + console.error('Failed to select output folder:', error) + alert(`输出文件夹选择失败: ${error instanceof Error ? error.message : '未知错误'}`) + } + } + + const handleBatchOutputFolderSelect = async () => { + try { + console.log('Opening batch output folder dialog...') + const folderPath = await invoke('select_folder') as string + console.log('Selected batch output folder:', folderPath) + setOutputFolder(folderPath) + } catch (error) { + console.error('Failed to select batch output folder:', error) + alert(`批量输出文件夹选择失败: ${error instanceof Error ? error.message : '未知错误'}`) + } + } + // Handle generation @@ -136,7 +161,7 @@ const AIVideoGenerator: React.FC = ({ className = '' }) = prompt: customPrompt, duration, model_type: modelType, - output_path: outputFolder + output_path: singleOutputFolder }) await generateSingleVideo({ @@ -144,7 +169,7 @@ const AIVideoGenerator: React.FC = ({ className = '' }) = prompt: customPrompt, duration, model_type: modelType, - output_path: outputFolder || undefined, + output_path: singleOutputFolder || undefined, timeout: 300 }) } else { @@ -262,6 +287,32 @@ const AIVideoGenerator: React.FC = ({ className = '' }) = /> + {/* Output Directory for Single Mode */} +
+ +
+ + + {singleOutputFolder || '未选择 (将使用默认目录)'} + +
+ setSingleOutputFolder(e.target.value)} + placeholder="或手动输入保存目录路径 (例如: C:\Users\用户名\Videos)" + className="input w-full text-sm mt-2" + /> +
+ ) : ( <> @@ -298,17 +349,7 @@ const AIVideoGenerator: React.FC = ({ className = '' }) = />