diff --git a/web/client/src/components/accounts/AccountForm.tsx b/web/client/src/components/accounts/AccountForm.tsx new file mode 100644 index 0000000..1dce685 --- /dev/null +++ b/web/client/src/components/accounts/AccountForm.tsx @@ -0,0 +1,135 @@ +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; + onDelete?: () => void; + onCancel: () => void; +} + +export function AccountForm({ account, onSave, onDelete, onCancel }: Props) { + const [form, setForm] = useState({ + id: account?.id || '', + name: account?.name || '', + description: account?.description || '', + defaultFormat: account?.defaultFormat || '9:16', + imageModel: account?.imageModel || 'gemini', + videoModel: account?.videoModel || 'veo3-fast', + ttsVoice: account?.ttsVoice || '', + ttsInstruction: account?.ttsInstruction || '', + }); + + const handleChange = (key: string, value: string) => setForm((f) => ({ ...f, [key]: value })); + + return ( +
+

+ {account ? `编辑账户: ${account.name}` : '创建新账户'} +

+ +
+ + handleChange('id', e.target.value)} + disabled={!!account} + placeholder="my-account" + className="mt-1 bg-zinc-900 border-zinc-800" + /> +
+ +
+ + handleChange('name', e.target.value)} + placeholder="账户名称" + className="mt-1 bg-zinc-900 border-zinc-800" + /> +
+ +
+ + handleChange('description', e.target.value)} + placeholder="简短描述..." + className="mt-1 bg-zinc-900 border-zinc-800" + /> +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ + handleChange('ttsVoice', e.target.value)} + placeholder="cosyvoice-xxx" + className="mt-1 bg-zinc-900 border-zinc-800 font-mono text-xs" + /> +
+ +
+ +