样式修改

This commit is contained in:
fengxiangdebaozi committed 2026-07-22 15:42:29 +08:00
1 parent 1bc203b5cd
commit 866bc0f8d8
1 file changed
+93 -25
@@ -1276,10 +1276,6 @@ function PositionDeliveryOverview({
chain: BusinessChain | null; chain: BusinessChain | null;
session: PositionRoundtableSession | null; session: PositionRoundtableSession | null;
}) { }) {
const seatsByAgentId = useMemo(
() => new Map((chain?.seats ?? []).map((seat) => [seat.agent_id, seat])),
[chain],
);
const items = useMemo<DeliveryOverviewItem[]>(() => { const items = useMemo<DeliveryOverviewItem[]>(() => {
const sortedNodes = [...nodes].sort( const sortedNodes = [...nodes].sort(
(left, right) => (left, right) =>
@@ -1287,39 +1283,110 @@ function PositionDeliveryOverview({
left.seatIndex - right.seatIndex || left.seatIndex - right.seatIndex ||
left.agentId.localeCompare(right.agentId), left.agentId.localeCompare(right.agentId),
); );
const nodeItems = sortedNodes.map((node, index): DeliveryOverviewItem => { const usedNodeKeys = new Set<string>();
const seat = seatsByAgentId.get(node.agentId); const makeNodeItem = (
const agentName = seat?.name ?? node.agentId; node: PositionRoundtableNode | null,
const markdownArtifact = node.artifactManifest.find(artifactIsMarkdown); fallback: {
agentId: string;
name?: string | null;
positionId?: string | null;
stageIndex: number;
seatIndex: number;
},
index: number,
): DeliveryOverviewItem => {
if (node) usedNodeKeys.add(node.nodeKey);
const agentName = fallback.name?.trim() || node?.agentId || fallback.agentId;
const status = node?.status ?? "ready";
const markdownArtifact = node?.artifactManifest.find(artifactIsMarkdown);
const deliveredArtifactName = artifactName(markdownArtifact); const deliveredArtifactName = artifactName(markdownArtifact);
const statusLabel = nodeStatusMeta(node.status).label;
const summary = const summary =
node.latestAnswer?.trim() || node?.latestAnswer?.trim() ||
(node.status === "locked" (!node
? node.invalidatedBy ? "该席位已按业务链配置排入流程,等待生成会话节点或开始问答。"
? "上游交付已被驳回或重做,等待前序节点重新完成。" : status === "locked"
: "等待上游阶段完成后解锁。" ? node.invalidatedBy
: node.status === "running" ? "上游交付已被驳回或重做,等待前序节点重新完成。"
: "等待上游阶段完成后解锁。"
: status === "running"
? "智能体正在问答并生成 Markdown 报告。" ? "智能体正在问答并生成 Markdown 报告。"
: node.status === "stale" : status === "stale"
? "上游产物已更新,该席位需要基于最新结果重做。" ? "上游产物已更新,该席位需要基于最新结果重做。"
: node.status === "rejected" : status === "rejected"
? "产物已被驳回,需要重新问答并交付。" ? "产物已被驳回,需要重新问答并交付。"
: "该席位尚未交付 Markdown 报告。"); : "该席位尚未交付 Markdown 报告。");
return { return {
id: `node:${node.nodeKey}`, id: node
? `node:${node.nodeKey}`
: `seat:${fallback.stageIndex}:${fallback.seatIndex}:${fallback.agentId}`,
kind: "node", kind: "node",
agentName, agentName,
productName: productName:
deliveredArtifactName || deliveredArtifactName ||
(node.status === "done" ? `${agentName}报告` : `待交付:${agentName} Markdown报告`), (status === "done" ? `${agentName}报告` : `待交付:${agentName} Markdown报告`),
summary, summary,
positionId: node.positionId, positionId: node?.positionId ?? fallback.positionId ?? null,
updatedAt: node.updatedAt, updatedAt: node?.updatedAt,
status: node.status, status,
accent: FLOW_NODE_COLORS[index % FLOW_NODE_COLORS.length]!, accent: FLOW_NODE_COLORS[index % FLOW_NODE_COLORS.length]!,
}; };
}); };
const stagedSeatItems = chain
? chainStages(chain).flatMap((stage, stageIndex) =>
stage.seats.map((seat, seatIndex) => {
const matchedNode =
nodes.find(
(node) =>
node.stageIndex === stageIndex &&
node.seatIndex === seatIndex &&
node.agentId === seat.agent_id,
) ??
nodes.find(
(node) =>
node.agentId === seat.agent_id && !usedNodeKeys.has(node.nodeKey),
) ??
null;
return makeNodeItem(
matchedNode,
{
agentId: seat.agent_id,
name: seat.name,
positionId: seat.position_id,
stageIndex,
seatIndex,
},
stageIndex + seatIndex,
);
}),
)
: sortedNodes.map((node, index) =>
makeNodeItem(
node,
{
agentId: node.agentId,
positionId: node.positionId,
stageIndex: node.stageIndex,
seatIndex: node.seatIndex,
},
index,
),
);
const orphanNodeItems = chain
? sortedNodes
.filter((node) => !usedNodeKeys.has(node.nodeKey) && !isIntentPositionNode(node))
.map((node, index) =>
makeNodeItem(
node,
{
agentId: node.agentId,
positionId: node.positionId,
stageIndex: node.stageIndex,
seatIndex: node.seatIndex,
},
stagedSeatItems.length + index,
),
)
: [];
const allDelivered = allExecutableNodesDone(nodes); const allDelivered = allExecutableNodesDone(nodes);
const summarySnapshot = session?.summarySnapshot; const summarySnapshot = session?.summarySnapshot;
const summaryArtifact = snapshotArtifact(summarySnapshot, "primary_artifact"); const summaryArtifact = snapshotArtifact(summarySnapshot, "primary_artifact");
@@ -1342,7 +1409,8 @@ function PositionDeliveryOverview({
status: intent ? "done" : "ready", status: intent ? "done" : "ready",
accent: "#8b5cf6", accent: "#8b5cf6",
}, },
...nodeItems, ...stagedSeatItems,
...orphanNodeItems,
{ {
id: "builtin:summary", id: "builtin:summary",
kind: "summary", kind: "summary",
@@ -1380,7 +1448,7 @@ function PositionDeliveryOverview({
accent: "#0ea5e9", accent: "#0ea5e9",
}, },
]; ];
}, [chain, intent, intentCompletedAt, nodes, seatsByAgentId, session]); }, [chain, intent, intentCompletedAt, nodes, session]);
const deliveredCount = items.filter((item) => item.status === "done").length; const deliveredCount = items.filter((item) => item.status === "done").length;
return ( return (