feat: 重构多轮RAG展示并完善报告协作、业务链审核与 agentfx 种子

抽出专用多轮RAG消息列表并升级会话模型;强化报告协作画布与检查器;业务链普通用户改为提交审核;扩展 agentfx 报告技能种子,并将含 admin 的用户名自动提权为管理员。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
董宏凯andCursor committed 2026-09-03 17:34:16 +08:00
1 parent f109a95535
commit db333a4c33
30 files changed
+2878 -1482

No files matched your search

@@ -1175,7 +1175,8 @@ export default function BusinessChainEditorPage() {
{/* 右侧操作 */}
<div className="ml-auto flex items-center gap-2">
{/* 发布:未发布 → 弹窗选「确认审核 / 直接发布」;审核中 → 撤回;已发布 → 收回。 */}
{/* 发布:未发布 → 弹窗(管理员可选「直接发布 / 确认审核」,普通用户提交审核);
审核中 → 撤回;已发布 → 收回。 */}
{currentChainId && (currentChainMine || isAdmin) && (
<button
type="button"
@@ -1186,7 +1187,9 @@ export default function BusinessChainEditorPage() {
? "已发布为公共,点击收回为私有"
: currentChainPending
? "审核中,点击撤回审核"
: "发布为公共:可选提交审核(管理员发布)或直接发布"
: isAdmin
? "发布为公共:可选提交审核(管理员发布)或直接发布"
: "提交审核:由管理员审核后发布为公共"
}
className={cn(
"flex items-center gap-1.5 border px-3 py-1.5 text-sm font-medium transition active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-60",
@@ -1438,7 +1441,8 @@ export default function BusinessChainEditorPage() {
}}
/>
{/* 发布审核确认弹窗:确认审核 → 进入「待审核」由管理员发布;直接发布 → 立即公共可见。 */}
{/* 发布审核确认弹窗:确认审核 → 进入「待审核」由管理员发布;管理员可选
「直接发布」立即公共可见(普通用户无此权限,只能走审核)。 */}
<Dialog open={reviewDialogOpen} onOpenChange={setReviewDialogOpen}>
<DialogContent className="sm:max-w-md">
<DialogHeader>
@@ -1447,19 +1451,22 @@ export default function BusinessChainEditorPage() {
发布业务链条
</DialogTitle>
<DialogDescription>
是否需要审核?确认审核后该链条将进入「待审核」,由管理员在业务链条列表中发布;
直接发布则立即对所有账号可见 / 选用。
{isAdmin
? "是否需要审核?确认审核后该链条将进入「待审核」,由管理员在业务链条列表中发布;直接发布则立即对所有账号可见 / 选用。"
: "提交后该链条将进入「待审核」,由管理员在业务链条列表中审核发布;发布前可随时撤回审核。"}
</DialogDescription>
</DialogHeader>
<DialogFooter>
<Button variant="outline" onClick={() => setReviewDialogOpen(false)}>
取消
</Button>
<Button variant="secondary" onClick={handleDirectPublish} disabled={publishing}>
直接发布
</Button>
{isAdmin && (
<Button variant="secondary" onClick={handleDirectPublish} disabled={publishing}>
直接发布
</Button>
)}
<Button onClick={handleSubmitReview} disabled={publishing}>
确认审核
{isAdmin ? "确认审核" : "提交审核"}
</Button>
</DialogFooter>
</DialogContent>
@@ -65,7 +65,14 @@ import { useRouteNavigate } from "@/core/route-base";
import { cn } from "@/lib/utils";
import { useDesensitizeSubtree } from "@/roundtable-planning/lib/use-desensitize-subtree";
import { approveChainReview, deleteChain, listChains, setChainPublic, type ChainScope } from "../api/chains";
import {
approveChainReview,
deleteChain,
listChains,
setChainPublic,
submitChainForReview,
type ChainScope,
} from "../api/chains";
import { chainTagClasses, type BusinessChain } from "../lib/business-chain";
import { getAvatarTypeFor } from "../lib/roundtable-constants";
@@ -163,26 +170,70 @@ export default function BusinessChainListPage() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
// ── 操作:发布 / 取消发布 ────────────────────────────────────────────────
// 「待审核」筛选里 = 管理员审核发布(is_public=true 并清除待审核标记);
// 其它筛选里 = 常规发布 / 取消发布。
// ── 操作:发布 / 取消发布 / 提交审核 / 审核发布 ──────────────────────────
// 发布为公共(is_public=true)仅管理员可执行:
// - 「待审核」筛选里 = 管理员审核发布(is_public=true 并清除待审核标记);
// - 管理员在其它筛选里点待审核链条的发布 = 同样走审核发布;
// - 管理员对普通链条 = 常规发布 / 取消发布。
// 普通用户:未发布链条的发布入口 = 提交审核(等待管理员发布,不能自行发布);
// 已发布链条可取消发布(收回为私有)。
const handleTogglePublic = useCallback(
async (chain: BusinessChain) => {
// 审核发布:待审核筛选(仅管理员可达)或管理员点待审核链条。
if (scope === "pending" || (isAdmin && chain.pendingReview)) {
setPublishingId(chain.id);
try {
const updated = await approveChainReview(chain.id);
if (updated) {
await refresh(scope);
await loadStats();
toast.success(`「${chain.title || "未命名链条"}」审核通过并已发布到公共选用库`);
} else {
toast.error("链条已不存在,可能被删除");
await refresh(scope);
}
} catch (err) {
toast.error(`操作失败:${err instanceof Error ? err.message : String(err)}`);
} finally {
setPublishingId(null);
}
return;
}
// 普通用户的未发布链条:提交审核,不能直接发布。
if (!isAdmin && !chain.isPublic) {
if (chain.pendingReview) {
toast.info("该链条审核中,请等待管理员发布");
return;
}
setPublishingId(chain.id);
try {
const updated = await submitChainForReview(chain.id);
if (updated) {
await refresh(scope);
await loadStats();
toast.success(`「${chain.title || "未命名链条"}」已提交审核,等待管理员发布`);
} else {
toast.error("链条已不存在,可能被删除");
await refresh(scope);
}
} catch (err) {
toast.error(`提交审核失败:${err instanceof Error ? err.message : String(err)}`);
} finally {
setPublishingId(null);
}
return;
}
// 其余(管理员发布/取消发布,普通用户取消发布)走常规开关。
setPublishingId(chain.id);
try {
const updated =
scope === "pending"
? await approveChainReview(chain.id)
: await setChainPublic(chain.id, !chain.isPublic);
const updated = await setChainPublic(chain.id, !chain.isPublic);
if (updated) {
await refresh(scope);
await loadStats();
toast.success(
scope === "pending"
? `「${chain.title || "未命名链条"}」审核通过并已发布到公共选用库`
: chain.isPublic
? `已取消发布「${chain.title || "未命名链条"}」`
: `「${chain.title || "未命名链条"}」已发布到公共选用库`,
chain.isPublic
? `已取消发布「${chain.title || "未命名链条"}」`
: `「${chain.title || "未命名链条"}」已发布到公共选用库`,
);
} else {
toast.error("链条已不存在,可能被删除");
@@ -194,7 +245,7 @@ export default function BusinessChainListPage() {
setPublishingId(null);
}
},
[refresh, scope, loadStats],
[refresh, scope, loadStats, isAdmin],
);
// ── 操作:删除(确认弹窗)─────────────────────────────────────────────────
@@ -463,6 +514,7 @@ export default function BusinessChainListPage() {
key={chain.id}
chain={chain}
canManage={isAdmin || chain.isMine !== false}
isAdmin={isAdmin}
publishing={publishingId === chain.id}
onSettings={() => goConfigure(chain.id)}
onTogglePublic={() => handleTogglePublic(chain)}
@@ -652,6 +704,7 @@ function EmptyState({
function ChainCard({
chain,
canManage,
isAdmin,
publishing,
onSettings,
onTogglePublic,
@@ -660,6 +713,8 @@ function ChainCard({
chain: BusinessChain;
/** 能否编辑 / 发布 / 删除(本人链条 或 管理员)。 */
canManage: boolean;
/** 当前登录用户是否管理员:发布语义不同(管理员=直接发布/审核发布,普通=提交审核)。 */
isAdmin: boolean;
publishing: boolean;
onSettings: () => void;
onTogglePublic: () => void;
@@ -722,14 +777,26 @@ function ChainCard({
</div>
</div>
{/* 操作按钮:本人链条或管理员可发布 / 设置 / 删除(普通用户看别人的链条只读浏览)。 */}
{/* 操作按钮:本人链条或管理员可发布 / 设置 / 删除(普通用户看别人的链条只读浏览)。
发布图标语义:管理员=发布/审核发布/取消发布;普通用户=提交审核(未发布)/
取消发布(已发布)/ 审核中(点击仅提示)。 */}
{canManage && (
<div className="flex shrink-0 items-center gap-1 opacity-80 transition-opacity group-hover:opacity-100">
<button
type="button"
onClick={onTogglePublic}
disabled={publishing}
title={chain.isPublic ? "取消发布" : "发布到公共选用库"}
title={
chain.isPublic
? "取消发布"
: isAdmin
? chain.pendingReview
? "审核通过并发布"
: "发布到公共选用库"
: chain.pendingReview
? "审核中,等待管理员发布"
: "提交审核(由管理员审核发布)"
}
className={cn(
"rounded-lg p-1.5 transition disabled:opacity-50",
chain.isPublic
@@ -1012,7 +1079,13 @@ function ChainTable({
type="button"
onClick={() => onTogglePublic(chain)}
disabled={publishingId === chain.id}
title={chain.isPublic ? "取消发布" : "发布到公共选用库"}
title={
chain.isPublic
? "取消发布"
: chain.pendingReview
? "审核通过并发布"
: "发布到公共选用库"
}
className="rounded-lg p-1.5 text-emerald-600 transition hover:bg-emerald-50 disabled:opacity-50 dark:text-[#52C41A] dark:hover:bg-[#52C41A]/15"
>
{publishingId === chain.id ? (
@@ -74,6 +74,7 @@ import {
DropdownMenuRadioItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
import { desensitize } from "@/lib/desensitize";
import { cn } from "@/lib/utils";
import { useDesensitizeSubtree } from "@/roundtable-planning/lib/use-desensitize-subtree";
@@ -3678,33 +3679,33 @@ function RoundtableEntryRail({
SEAT_CHIP_PALETTE.length
];
return (
<div
key={`${si}-${sj}-${seat.agent_id}`}
className="group/seat relative"
>
<span
className={cn(
"flex h-6 w-6 items-center justify-center rounded-full border",
palette,
)}
>
<Cpu className="h-3 w-3" />
</span>
{/* 悬停浮层显示名称 / 描述 */}
<div className="pointer-events-none absolute bottom-full left-1/2 z-50 mb-1.5 hidden -translate-x-1/2 group-hover/seat:block">
<div className="max-w-[180px] rounded-lg bg-neutral-900 px-2 py-1 text-white shadow-lg">
<div className="whitespace-nowrap text-[10px] font-semibold">
{seat.name}
</div>
{seat.description && (
<div className="mt-0.5 whitespace-normal text-[9px] leading-snug text-neutral-300">
{seat.description}
</div>
<Tooltip key={`${si}-${sj}-${seat.agent_id}`}>
<TooltipTrigger asChild>
<span
className={cn(
"flex h-6 w-6 items-center justify-center rounded-full border",
palette,
)}
>
<Cpu className="h-3 w-3" />
</span>
</TooltipTrigger>
{/* 悬停浮层显示名称 / 描述。Radix Portal 渲染到 body,
不被折叠层的 overflow-hidden / 列表滚动容器裁剪。 */}
<TooltipContent
side="top"
className="max-w-[280px] rounded-lg bg-neutral-900 px-3 py-2 text-white shadow-lg"
>
<div className="whitespace-nowrap text-[16px] font-semibold">
{seat.name}
</div>
<div className="absolute left-1/2 top-full h-0 w-0 -translate-x-1/2 border-l-4 border-r-4 border-t-4 border-l-transparent border-r-transparent border-t-neutral-900" />
</div>
</div>
{seat.description && (
<div className="mt-1 text-[16px] leading-snug text-neutral-300">
{seat.description}
</div>
)}
</TooltipContent>
</Tooltip>
);
})}
</div>