From 2186b0467565ecf22ef989cb133b1420f1b95f0b Mon Sep 17 00:00:00 2001 From: sion123 <450702724@qq.com> Date: Fri, 8 May 2026 02:18:50 +0800 Subject: [PATCH] =?UTF-8?q?feat(web):=20=E5=B0=86=E5=8E=9F=E7=94=9F=20sele?= =?UTF-8?q?ct=20=E6=9B=BF=E6=8D=A2=E4=B8=BA=20shadcn/ui=20Select=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=B9=B6=E6=94=AF=E6=8C=81=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 AccountForm、AssetGallery、ChatView、ConfigForm、PromptEditor 中将 ` handleChange('defaultFormat', e.target.value)} - className="mt-1 w-full h-10 rounded-md border border-zinc-200 bg-zinc-50 px-3 text-sm" - > - - - - +
- +
- +
diff --git a/web/client/src/components/assets/AssetGallery.tsx b/web/client/src/components/assets/AssetGallery.tsx index fee50ef..81a4f02 100644 --- a/web/client/src/components/assets/AssetGallery.tsx +++ b/web/client/src/components/assets/AssetGallery.tsx @@ -4,6 +4,7 @@ import { useAssets } from '@/hooks/useAssets'; import { AssetProjectGroup } from './AssetProjectGroup'; import { AssetPreview } from './AssetPreview'; import { Button } from '@/components/ui/button'; +import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '@/components/ui/select'; import type { Asset } from '@/types'; interface ManifestGroup { @@ -125,16 +126,17 @@ export function AssetGallery() { ))} - +
diff --git a/web/client/src/components/prompts/PromptEditor.tsx b/web/client/src/components/prompts/PromptEditor.tsx index 3bd6736..2add6a4 100644 --- a/web/client/src/components/prompts/PromptEditor.tsx +++ b/web/client/src/components/prompts/PromptEditor.tsx @@ -7,6 +7,7 @@ import 'prismjs/themes/prism.css'; import { useAccounts } from '@/hooks/useAccounts'; import { usePrompts } from '@/hooks/usePrompts'; import { Button } from '@/components/ui/button'; +import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '@/components/ui/select'; const PROMPT_TYPES = [ { type: 'storyboard', label: '分镜' }, @@ -54,15 +55,16 @@ export function PromptEditor({ accountId: accountIdProp }: { accountId?: string
- +
diff --git a/web/client/src/hooks/useChat.ts b/web/client/src/hooks/useChat.ts index df52938..de99353 100644 --- a/web/client/src/hooks/useChat.ts +++ b/web/client/src/hooks/useChat.ts @@ -150,8 +150,8 @@ export function useChat(conversationId: string | null) { } }, [conversationId, connected]); - const send = useCallback((content: string) => { - chatSocket.send('chat', { content }); + const send = useCallback((content: string, images?: Array<{ data: string; mimeType: string }>) => { + chatSocket.send('chat', { content, images }); }, []); const stop = useCallback(() => { diff --git a/web/server/agent/pi-bridge.ts b/web/server/agent/pi-bridge.ts index 3812371..93d56de 100644 --- a/web/server/agent/pi-bridge.ts +++ b/web/server/agent/pi-bridge.ts @@ -44,7 +44,7 @@ interface RunContext { currentAssistantMsgId: string | null; } -export async function runAgentChat(ws: WebSocket, convId: string, userContent: string) { +export async function runAgentChat(ws: WebSocket, convId: string, userContent: string, images?: Array<{ type: 'image'; data: string; mimeType: string }>) { const userMsgId = saveUserMessage(convId, userContent); ws.send(JSON.stringify({ type: 'message', data: { id: userMsgId, role: 'user', content: userContent } })); @@ -84,7 +84,7 @@ export async function runAgentChat(ws: WebSocket, convId: string, userContent: s ws.send(JSON.stringify({ type: 'status', data: { status: 'thinking' } })); try { - await agent.prompt(userContent); + await agent.prompt(userContent, images); } catch (err) { const errMsg = (err as Error).message; console.error('[pi-bridge] Agent error:', errMsg); diff --git a/web/server/ws/chat.ts b/web/server/ws/chat.ts index 00d35b7..29d2424 100644 --- a/web/server/ws/chat.ts +++ b/web/server/ws/chat.ts @@ -34,7 +34,7 @@ export function handleChat(ws: WebSocket) { ws.send(JSON.stringify({ type: 'error', data: { message: '没有活跃对话,请先创建或选择一个对话' } })); return; } - await runAgentChat(ws, conversationId, msg.content); + await runAgentChat(ws, conversationId, msg.content, msg.images); } } catch (e) { console.error('WebSocket error:', e);