- 版本目标 → 收录版本(前后端用户可见字符串、能力描述、给模型的提示) - Agent 上游 / 上游 → 模型服务;界面上的 Agent / Agent 会话 → 智能体 / 智能体会话 - 身份歧义 / 识别有歧义 / 无法确定作品 → 没识别出作品;待识别(池) → 未识别 - 建档 → 加入媒体库;资产 → 文件;库根 → 媒体库目录;纳管 → 本工具 / 外部任务; 哨兵 → 标记文件 / 检查目录;站点快照 → 抓取;Feed / RSS 订阅 / 来源健康 → RSS - 代码标识符、API 字段名、迁移文件不改;glossary.md 同步;smoke 选择器跟随 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="智能体会话"
|
|
description="交代目标,智能体列出步骤后在授权范围内执行并汇报;需要审批的动作停在对应步骤等你批准。"
|
|
/>
|
|
{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>
|
|
</>
|
|
);
|
|
}
|