- 「未经核查」只在最终汇报左栏标题保留一处,删「仅供参考」与数据来源说明; 右栏改叫「实际结果」,去掉「运行已完成」「工具成功 N」徽章,计数只列非零项, 状态值用中文标签,不再显示计划 / 记录短 ID - 工具卡片只标会改数据的动作和中高风险;能力 ID、scope、幂等、耗时、调用 ID、 schema 入口收进技术信息;拒绝说明改成一句「要你批准」 - 用量只显示费用与时长,工具调用数、token、模型、会话 ID 进技术信息(超限时照常显示) - 会话标题 shortGoalTitle:去上下文前缀、UUID、JSON 参数,能力 ID 换中文名,取第一句,40 字截断 - 入口去口号:删「交代目标,边做边汇报」与抽屉里的重复快捷键说明 - 对话组件结构不动 Co-Authored-By: Claude Opus 5.5 <[email protected]>
57 lines
2.5 KiB
TypeScript
57 lines
2.5 KiB
TypeScript
import { FlaskConical, ShieldCheck } from "lucide-react";
|
|
import { useNavigate } from "react-router";
|
|
import { toast } from "sonner";
|
|
import { agentMockEnabled, useCreateAgentRun } from "~/api/agent.ts";
|
|
import { GoalComposer } from "~/components/agent/agent-run-panel.tsx";
|
|
import { AgentSessionList } from "~/components/agent/agent-session-list.tsx";
|
|
import { PageHeader } from "~/components/console/page-header.tsx";
|
|
import { Button } from "~/components/ui/button.tsx";
|
|
import { errorMessage } from "~/lib/api.ts";
|
|
|
|
export default function AgentPage() {
|
|
const create = useCreateAgentRun();
|
|
const navigate = useNavigate();
|
|
const mock = agentMockEnabled();
|
|
|
|
return (
|
|
<>
|
|
<PageHeader title="智能体会话" />
|
|
{mock ? (
|
|
<div className="mb-4 flex flex-wrap items-center gap-3 rounded-xl border border-warning/40 bg-warning/10 px-4 py-3 text-caption text-warning">
|
|
<FlaskConical className="h-4 w-4 shrink-0" />
|
|
<span className="min-w-0 flex-1">演示模式:会话是本地假数据,不连接后端,不执行任何操作。</span>
|
|
<Button variant="outline" size="sm" onClick={() => window.location.assign("/console/agent?mock=0")}>
|
|
退出演示
|
|
</Button>
|
|
</div>
|
|
) : null}
|
|
<div className="grid grid-cols-1 gap-4 lg:grid-cols-[minmax(0,20rem)_minmax(0,1fr)] lg:items-start">
|
|
<div className="pg-slab order-2 rounded-xl p-3 lg:order-1 lg:h-[calc(100dvh-12rem)] lg:overflow-hidden">
|
|
<AgentSessionList hrefFor={(id) => `/console/agent/${id}${mock ? "?mock=1" : ""}`} className="h-full" />
|
|
</div>
|
|
<div className="order-1 mx-auto w-full max-w-[88ch] space-y-3 lg:order-2">
|
|
<div className="pg-slab rounded-xl p-4">
|
|
<h2 className="mb-3 text-body font-medium text-foreground">新会话</h2>
|
|
<GoalComposer
|
|
pending={create.isPending}
|
|
onSubmit={(goal, opts) =>
|
|
create.mutate(
|
|
{ goal, ...opts },
|
|
{
|
|
onSuccess: (run) => navigate(`/console/agent/${run.id}${mock ? "?mock=1" : ""}`),
|
|
onError: (e) => toast.error(errorMessage(e)),
|
|
},
|
|
)
|
|
}
|
|
/>
|
|
</div>
|
|
<p className="flex items-center gap-2 px-1 text-meta text-muted-foreground">
|
|
<ShieldCheck aria-hidden className="size-3.5 shrink-0" />
|
|
每次工具调用都经服务端授权校验,汇报以系统核实的结果为准。
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</>
|
|
);
|
|
}
|