- Drawer tabs 当前/历史: searchable run list (status/source/time filters, cursor auto-load), opens runs inside the drawer, keeps scroll and filters, remembers the last tab; 在页面打开 is secondary - Ended runs: append to resume, or 用同目标新建 with 先看方案再执行 toggle - Session page: 88ch conversation column, turns grouped with one timestamp, tool cards collapse to one line, 3+ activities fold; steps/subagents/budget moved to a right rail (collapsible overview bar on narrow screens and in the drawer), long model reports fold behind 展开全文 - Smoke covers the drawer history flow Co-Authored-By: Claude Opus 5.5 <[email protected]>
60 lines
2.7 KiB
TypeScript
60 lines
2.7 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="Agent 会话"
|
|
description="交代目标,Agent 列出步骤后在授权范围内执行并汇报;需要审批的动作停在对应步骤等你批准。"
|
|
/>
|
|
{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>
|
|
</>
|
|
);
|
|
}
|