'use client'; import { useRef, useState } from 'react'; const PRESET_STYLES = [ { id: 'plush', label: '毛绒玩偶' }, { id: 'mecha', label: '机甲风' }, { id: 'kawaii', label: '可爱萌系' }, { id: 'blueprint', label: '专利蓝图' }, { id: 'cyber', label: '赛博朋克' }, { id: 'minimal', label: '极简' }, ]; export type PromptPanelProps = { onGenerate: (opts: { prompt: string; refImages: string[]; count: number; style?: string }) => void; loading: boolean; }; export default function PromptPanel({ onGenerate, loading }: PromptPanelProps) { const [prompt, setPrompt] = useState('AI 毛绒陪伴玩具,机甲头盔,胸前挂 M logo,橙白配色,圆胖体型'); const [refs, setRefs] = useState([]); const [count, setCount] = useState(8); const [style, setStyle] = useState(''); const fileInput = useRef(null); function handleFiles(files: FileList | null) { if (!files) return; Array.from(files).slice(0, 4 - refs.length).forEach(f => { const r = new FileReader(); r.onload = () => setRefs(prev => [...prev, r.result as string]); r.readAsDataURL(f); }); } function submit() { if (!prompt.trim() || loading) return; onGenerate({ prompt: prompt.trim(), refImages: refs, count, style: style || undefined }); } return (