feat: 简化微信渠道账号连接

This commit is contained in:
brother7 committed 2026-09-14 12:05:16 +08:00
1 parent a721b8fb7e
commit 21e707d9c4
21 files changed
+238 -1078

No files matched your search

@@ -51,14 +51,14 @@ export function CloudChannelConversations({ slug, channelAccountId, activeView =
setSessions(items => [...items, ...next]); setOffset(page.next_offset); }
catch (error) { setError(failureText(error)); } finally { setLoading(false); }
};
return <section aria-label="本人微信会话" className="space-y-4">
<div className="flex flex-wrap items-start justify-between gap-3"><div><h2 className="font-medium">本人微信对话</h2>
<p className="mt-1 text-sm leading-6 text-muted-foreground">查看你的本人微信会话,处理确认和保存文件。新消息请从对应微信对话发送。</p></div>
return <section aria-label="微信会话" className="space-y-4">
<div className="flex flex-wrap items-start justify-between gap-3"><div><h2 className="font-medium">微信对话</h2>
<p className="mt-1 text-sm leading-6 text-muted-foreground">查看扫码账号的微信会话,处理确认和保存文件。新消息请从对应微信对话发送。</p></div>
<Button variant="ghost" size="sm" disabled={loading || busy} onClick={() => setRevision(value => value + 1)}><RefreshCw className="mr-2 h-4 w-4" />刷新会话</Button></div>
{error && <p role="alert" className="text-sm text-destructive">{error}</p>}
{loading && !sessions.length && <p role="status" className="text-sm text-muted-foreground">正在读取本人会话…</p>}
{!loading && !error && !sessions.length && <p className="rounded-xl bg-muted/30 p-6 text-sm leading-6 text-muted-foreground">还没有本人微信会话。请先在发布与访问中连接并启用个人微信,然后用绑定时扫码的微信发送一条消息。</p>}
{!!sessions.length && <label className="block space-y-2 text-sm"><span>选择本人微信会话</span>
{loading && !sessions.length && <p role="status" className="text-sm text-muted-foreground">正在读取微信会话…</p>}
{!loading && !error && !sessions.length && <p className="rounded-xl bg-muted/30 p-6 text-sm leading-6 text-muted-foreground">还没有微信会话。请先在“渠道 → 微信”中连接并启用账号,然后用扫码的微信发送一条消息。</p>}
{!!sessions.length && <label className="block space-y-2 text-sm"><span>选择微信会话</span>
<select className="h-10 w-full rounded-md border border-input bg-background px-3" value={selected} disabled={busy} onChange={event => setSelected(event.target.value)}>
{!sessions.some(session => session.session_id === selected) && <option value={selected}>当前会话</option>}
{sessions.map(session => <option key={session.session_id} value={session.session_id}>{session.agent_name || '微信助手'} · 第 {session.sequence ?? 1} 段 · {new Date(session.created_at).toLocaleString()}{session.session_state === 'closed' ? ' · 历史' : ''}</option>)}