import { useState } from 'react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import type { Account } from '@/types'; interface Props { account: Account; onSave: (data: Partial) => void; } export function AccountBasicTab({ account, onSave }: Props) { const [form, setForm] = useState({ name: account.name || '', description: account.description || '', pipeline: account.pipeline || 'image-video', defaultFormat: account.defaultFormat || '9:16', imageModel: account.imageModel || 'gemini', videoModel: account.videoModel || 'veo3-fast', batchSize: account.batchSize || 30, ttsVoice: account.ttsVoice || '', ttsInstruction: account.ttsInstruction || '', }); const [saved, setSaved] = useState(false); const handleChange = (key: string, value: string | number) => { setForm((f) => ({ ...f, [key]: value })); setSaved(false); }; const handleSave = () => { onSave(form); setSaved(true); setTimeout(() => setSaved(false), 2000); }; return (
handleChange('name', e.target.value)} className="mt-1 bg-zinc-50 border-zinc-200" />
handleChange('description', e.target.value)} placeholder="账号描述..." className="mt-1 bg-zinc-50 border-zinc-200" />
handleChange('batchSize', parseInt(e.target.value) || 30)} className="mt-1 bg-zinc-50 border-zinc-200" />
handleChange('ttsVoice', e.target.value)} placeholder="cosyvoice-xxx" className="mt-1 bg-zinc-50 border-zinc-200 font-mono text-xs" />