import { useState, useEffect } from 'react'; import { useAccounts } from '@/hooks/useAccounts'; import { usePrompts } from '@/hooks/usePrompts'; import { Button } from '@/components/ui/button'; const PROMPT_TYPES = [ { type: 'storyboard', label: '分镜' }, { type: 'image', label: '图片提示词' }, { type: 'video', label: '视频提示词' }, ] as const; export function PromptEditor() { const { accounts } = useAccounts(); const [selectedAccount, setSelectedAccount] = useState(''); const [selectedType, setSelectedType] = useState('storyboard'); const { content, path, loading, load, save, setContent } = usePrompts(); useEffect(() => { if (accounts.length > 0 && !selectedAccount) { setSelectedAccount(accounts[0].id); } }, [accounts]); useEffect(() => { if (selectedAccount) { load(selectedAccount, selectedType); } }, [selectedAccount, selectedType]); return (
{PROMPT_TYPES.map(({ type, label }) => ( ))}
{path}