feat(agents): 支持个人微信发布与渠道会话
This commit is contained in:
1 parent
03774d0625
commit
2e710db0fb
28 files changed
+2678
-31
No files matched your search
@@ -8,22 +8,27 @@ const labels: Record<string, string> = {
|
||||
createApplication: '创建应用', createKey: '创建密钥', createKnowledge: '创建知识库', processKnowledge: '处理文档',
|
||||
createSchedule: '创建自动任务', runSchedule: '立即运行任务',
|
||||
importKnowledgeAttachment: '导入附件到知识库', createChild: '创建子智能体',
|
||||
wechatBindVerification: '微信连接验证',
|
||||
};
|
||||
|
||||
export function CloudRecovery({ pending, onResolved }: { pending: CloudPendingOperation[]; onResolved: () => void }) {
|
||||
const [busy, setBusy] = useState('');
|
||||
const [error, setError] = useState('');
|
||||
const [notice, setNotice] = useState('');
|
||||
const [result, setResult] = useState<{ operation: string; value: unknown } | null>(null);
|
||||
const resolve = async (item: CloudPendingOperation, discard = false) => {
|
||||
setBusy(item.id); setError('');
|
||||
setBusy(item.id); setError(''); setNotice('');
|
||||
try {
|
||||
const response = await cloudAgentsApi.resolvePending(item.id, discard);
|
||||
if (!discard) setResult({ operation: item.operation, value: response.result });
|
||||
if (response.requires_input) {
|
||||
setResult(null);
|
||||
setNotice('这次微信验证还需要验证码。请进入对应智能体的「发布与访问 → 个人微信」,继续连接验证。');
|
||||
} else if (!discard) setResult({ operation: item.operation, value: response.result });
|
||||
onResolved();
|
||||
} catch (e) { setError(e instanceof Error ? e.message : '暂时无法确认结果'); }
|
||||
finally { setBusy(''); }
|
||||
};
|
||||
if (!pending.length && !result && !error) return null;
|
||||
if (!pending.length && !result && !error && !notice) return null;
|
||||
return <aside aria-label="未确认的云端操作" className="mx-auto mb-6 max-w-6xl space-y-3 rounded-xl border border-amber-200 bg-amber-50/30 p-4 text-sm">
|
||||
{pending.length > 0 && <><h2 className="font-medium">有 {pending.length} 个操作的结果尚未确认</h2>
|
||||
<p className="text-muted-foreground">重试会确认原操作,不会新建一份任务。移除提醒只清除本机记录,云端已接受的任务仍会继续。</p></>}
|
||||
@@ -38,5 +43,6 @@ export function CloudRecovery({ pending, onResolved }: { pending: CloudPendingOp
|
||||
<pre className="max-h-48 overflow-auto whitespace-pre-wrap break-all p-2 text-xs">{JSON.stringify(result.value, null, 2)}</pre></details>
|
||||
<Button variant="ghost" size="sm" onClick={() => setResult(null)}>关闭结果</Button></div>}
|
||||
{error && <p role="alert" className="text-destructive">{error}</p>}
|
||||
{notice && <p role="status" className="text-muted-foreground">{notice}</p>}
|
||||
</aside>;
|
||||
}
|
||||
Reference in new issue
Block a user