-
+
-
+
-
+
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);