feat(web): 将原生 select 替换为 shadcn/ui Select 组件并支持图片消息发送
- 在 AccountForm、AssetGallery、ChatView、ConfigForm、PromptEditor 中将 `<select>` 替换为 shadcn/ui 的 Select 组件以统一 UI 风格 - 在 ChatView 和 useChat hook 中支持发送图片附件 - 更新 pi-bridge 和 ws/chat 以处理 agent 调用中的图片数据
This commit is contained in:
@@ -126,10 +126,10 @@ export function ChatView() {
|
||||
creatingRef.current = false;
|
||||
}, [createConversation, selectedAccountId]);
|
||||
|
||||
const handleSend = useCallback((content: string) => {
|
||||
const handleSend = useCallback((content: string, images?: Array<{ data: string; mimeType: string }>) => {
|
||||
if (quote) { content = `> ${quote}\n\n${content}`; setQuote(null); }
|
||||
if (conversationId) {
|
||||
send(content);
|
||||
send(content, images);
|
||||
} else {
|
||||
handleSendNew(content);
|
||||
}
|
||||
@@ -154,14 +154,18 @@ export function ChatView() {
|
||||
{accounts.length > 0 && (
|
||||
<div className="flex items-center gap-2 mt-3 justify-center">
|
||||
<span className="text-xs text-zinc-400">当前账号:</span>
|
||||
<select
|
||||
<Select
|
||||
value={selectedAccountId || ''}
|
||||
onChange={(e) => useAppStore.getState().setSelectedAccountId(e.target.value || null)}
|
||||
className="h-7 rounded-lg border border-zinc-100 bg-white px-2.5 text-xs text-zinc-600 hover:border-zinc-200 transition-colors"
|
||||
onValueChange={(v) => useAppStore.getState().setSelectedAccountId(v === 'none' ? null : v)}
|
||||
>
|
||||
<option value="">不指定</option>
|
||||
{accounts.map((a) => <option key={a.id} value={a.id}>{a.name}</option>)}
|
||||
</select>
|
||||
<SelectTrigger className="h-7 w-auto min-w-[100px] text-xs px-2.5 border-zinc-100 hover:border-zinc-200">
|
||||
<SelectValue placeholder="不指定" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="none">不指定</SelectItem>
|
||||
{accounts.map((a) => <SelectItem key={a.id} value={a.id}>{a.name}</SelectItem>)}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
)}
|
||||
{recentConvs.length > 0 && (
|
||||
|
||||
Reference in New Issue
Block a user