Merge remote-tracking branch 'origin/master' into ji
# Conflicts: # .gitignore # frontend-web/src/components/workspace/artifacts/context.tsx # frontend-web/src/components/workspace/messages/message-group.tsx # offline-backend-20260512/backend/CLAUDE.md # offline-backend-20260512/backend/README.md # offline-backend-20260512/backend/app/gateway/app.py # offline-backend-20260512/backend/app/gateway/deps.py # offline-backend-20260512/backend/app/gateway/routers/llmwiki.py
This commit is contained in:
commit
e818c24769
262 files changed
+29527
-5236
No files matched your search
@@ -0,0 +1,74 @@
|
||||
import { apiFetch } from "@/core/api/fetch-client";
|
||||
import { getBackendBaseURL } from "@/core/config";
|
||||
|
||||
export interface RoundtableArtifactReference {
|
||||
sessionId?: string | null;
|
||||
threadId: string;
|
||||
nodeKey?: string | null;
|
||||
sourceKey: string;
|
||||
path: string;
|
||||
name: string;
|
||||
mimeType?: string | null;
|
||||
revision: number;
|
||||
}
|
||||
|
||||
export interface RoundtableArtifactSubmissionRecord {
|
||||
id: string;
|
||||
taskId: string;
|
||||
version: number;
|
||||
submitted: boolean;
|
||||
submittedAt?: string | null;
|
||||
cancelledAt?: string | null;
|
||||
taskDeliveryId?: string | null;
|
||||
artifact: RoundtableArtifactReference;
|
||||
}
|
||||
|
||||
function endpoint(taskId: string): string {
|
||||
return `${getBackendBaseURL()}/api/roundtable/tasks/${encodeURIComponent(taskId)}/artifacts`;
|
||||
}
|
||||
|
||||
async function readError(response: Response, fallback: string): Promise<Error> {
|
||||
const body = await response.text().catch(() => "");
|
||||
try {
|
||||
const parsed = JSON.parse(body) as { detail?: unknown; message?: unknown };
|
||||
const detail = typeof parsed.detail === "string"
|
||||
? parsed.detail
|
||||
: typeof parsed.message === "string"
|
||||
? parsed.message
|
||||
: "";
|
||||
if (detail) return new Error(detail);
|
||||
} catch {
|
||||
// The status fallback below is more useful than an opaque HTML response.
|
||||
}
|
||||
return new Error(`${fallback}(${response.status})`);
|
||||
}
|
||||
|
||||
export async function listRoundtableArtifactSubmissions(
|
||||
taskId: string,
|
||||
submitted: boolean,
|
||||
): Promise<RoundtableArtifactSubmissionRecord[]> {
|
||||
const response = await apiFetch(`${endpoint(taskId)}?submitted=${submitted}`, { method: "GET" });
|
||||
if (!response.ok) throw await readError(response, "读取产物提交状态失败");
|
||||
const payload = await response.json() as { items?: RoundtableArtifactSubmissionRecord[] };
|
||||
return Array.isArray(payload.items) ? payload.items : [];
|
||||
}
|
||||
|
||||
export async function saveRoundtableArtifactSubmission(
|
||||
taskId: string,
|
||||
body: {
|
||||
submitted: boolean;
|
||||
registerOnly?: boolean;
|
||||
submissionId?: string;
|
||||
taskDeliveryId?: string;
|
||||
expectedVersion?: number;
|
||||
artifact: RoundtableArtifactReference;
|
||||
},
|
||||
): Promise<RoundtableArtifactSubmissionRecord> {
|
||||
const response = await apiFetch(`${endpoint(taskId)}/submission`, {
|
||||
method: "PUT",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ taskId, ...body }),
|
||||
});
|
||||
if (!response.ok) throw await readError(response, "保存产物提交状态失败");
|
||||
return response.json() as Promise<RoundtableArtifactSubmissionRecord>;
|
||||
}
|
||||
@@ -53,6 +53,8 @@ export interface ChainUpdatePayload {
|
||||
gatherFirst?: boolean;
|
||||
/** 发布开关:true 发布为公共 / false 取消发布;omit 不改。仅 owner 生效。 */
|
||||
isPublic?: boolean;
|
||||
/** 启停开关:true 启用 / false 停用;omit 不改。仅 owner / 管理员生效。 */
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,6 +90,7 @@ interface ServerChain {
|
||||
seat_mode?: string | null;
|
||||
gather_first?: boolean;
|
||||
is_public?: boolean;
|
||||
enabled?: boolean;
|
||||
is_mine?: boolean;
|
||||
owner_name?: string | null;
|
||||
created_at: string | null;
|
||||
@@ -106,6 +109,7 @@ function toChain(s: ServerChain): BusinessChain {
|
||||
seatMode: (s.seat_mode as SeatMode | null) ?? undefined,
|
||||
gatherFirst: s.gather_first ?? false,
|
||||
isPublic: s.is_public ?? false,
|
||||
enabled: s.enabled ?? true,
|
||||
// 后端缺省时按「我的」处理(向后兼容旧响应)。
|
||||
isMine: s.is_mine ?? true,
|
||||
ownerName: s.owner_name ?? undefined,
|
||||
@@ -141,6 +145,7 @@ function fromUpdate(p: ChainUpdatePayload) {
|
||||
if (p.seatMode !== undefined) out.seat_mode = p.seatMode;
|
||||
if (p.gatherFirst !== undefined) out.gather_first = p.gatherFirst;
|
||||
if (p.isPublic !== undefined) out.is_public = p.isPublic;
|
||||
if (p.enabled !== undefined) out.enabled = p.enabled;
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -171,6 +176,11 @@ export async function setChainPublic(id: string, isPublic: boolean): Promise<Bus
|
||||
return updateChain(id, { isPublic });
|
||||
}
|
||||
|
||||
/** 启用 / 停用一条链条(仅 owner / 管理员生效)。返回更新后的链条,404 返回 null。 */
|
||||
export async function setChainEnabled(id: string, enabled: boolean): Promise<BusinessChain | null> {
|
||||
return updateChain(id, { enabled });
|
||||
}
|
||||
|
||||
/** Fetch one chain. Returns null on 404. */
|
||||
export async function getChain(id: string): Promise<BusinessChain | null> {
|
||||
const res = await apiFetch(`${BASE()}/${encodeURIComponent(id)}`, { method: "GET" });
|
||||
@@ -214,10 +224,22 @@ export async function updateChain(id: string, patch: ChainUpdatePayload): Promis
|
||||
if (res.status === 404) return null;
|
||||
const data = await readJson<ServerChain>(res, "update chain");
|
||||
const chain = toChain(data);
|
||||
const enabledToggle = patch.enabled === true || patch.enabled === false;
|
||||
writeYLog({
|
||||
optType: patch.isPublic === true ? OptType.enabled : patch.isPublic === false ? OptType.disabled : OptType.edit,
|
||||
optDetail:
|
||||
patch.isPublic === true
|
||||
optType: enabledToggle
|
||||
? patch.enabled
|
||||
? OptType.enabled
|
||||
: OptType.disabled
|
||||
: patch.isPublic === true
|
||||
? OptType.enabled
|
||||
: patch.isPublic === false
|
||||
? OptType.disabled
|
||||
: OptType.edit,
|
||||
optDetail: enabledToggle
|
||||
? patch.enabled
|
||||
? "CM助手-全量-业务链条-启用"
|
||||
: "CM助手-全量-业务链条-停用"
|
||||
: patch.isPublic === true
|
||||
? "CM助手-全量-业务链条-发布"
|
||||
: patch.isPublic === false
|
||||
? "CM助手-全量-业务链条-取消发布"
|
||||
|
||||
@@ -459,7 +459,14 @@ export async function streamIntent(req: StreamIntentRequest): Promise<StreamInte
|
||||
// Clarifications collected live from `type:"tool"` frames, deduped by
|
||||
// tool_call_id, then reconciled against the complete terminal list.
|
||||
const seenClarificationIds = new Set<string>();
|
||||
// A clarification tool call is a hard pause in the Step 1 conversation.
|
||||
// Some model providers keep emitting text (and can even produce an
|
||||
// INTENT_READY terminal frame) after the tool result. That text belongs to
|
||||
// a continuation the user has not approved yet, so never let it replace the
|
||||
// assistance card in the current turn.
|
||||
let awaitingUserClarification = false;
|
||||
const collectClarification = (payload: ClarificationPayload, toolCallId: string) => {
|
||||
awaitingUserClarification = true;
|
||||
const dedupeKey = toolCallId || `idx-${result.clarifications.length}`;
|
||||
if (seenClarificationIds.has(dedupeKey)) return;
|
||||
seenClarificationIds.add(dedupeKey);
|
||||
@@ -501,6 +508,25 @@ export async function streamIntent(req: StreamIntentRequest): Promise<StreamInte
|
||||
}
|
||||
|
||||
if (isFinalIntentFrame(parsed)) {
|
||||
// Reconcile any terminal clarification cards, but preserve the first
|
||||
// tool-call pause as the authoritative state for this turn. In
|
||||
// particular, do not accept a later `done` frame / summary before the
|
||||
// user has answered the displayed questions.
|
||||
if (awaitingUserClarification) {
|
||||
if (parsed.status === "clarification") {
|
||||
const terminalCards = Array.isArray(parsed.clarifications)
|
||||
? parsed.clarifications
|
||||
.map(parseTerminalClarification)
|
||||
.filter((item): item is { payload: ClarificationPayload; toolCallId: string } => item !== null)
|
||||
: [];
|
||||
if (terminalCards.length > 0) {
|
||||
terminalCards.forEach((card, index) => {
|
||||
collectClarification(card.payload, card.toolCallId || `terminal-${index}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
result.status = parsed.status;
|
||||
if (typeof parsed.content === "string") result.content = parsed.content;
|
||||
if (parsed.summary && typeof parsed.summary === "object") {
|
||||
@@ -548,6 +574,11 @@ export async function streamIntent(req: StreamIntentRequest): Promise<StreamInte
|
||||
continue;
|
||||
}
|
||||
|
||||
// Do not show follow-up thinking / generated summary text while the
|
||||
// user-assistance card is waiting for an answer. This also prevents a
|
||||
// later AI delta from hiding the card through an [INTENT_READY] block.
|
||||
if (awaitingUserClarification) continue;
|
||||
|
||||
// Phase inference from LangGraph messages-tuple frames. Tool calls
|
||||
// (typically ask_clarification) flip phase to tool_calling; AI text
|
||||
// chunks flip to streaming. Everything else leaves phase alone.
|
||||
@@ -592,5 +623,11 @@ export async function streamIntent(req: StreamIntentRequest): Promise<StreamInte
|
||||
}
|
||||
}
|
||||
|
||||
if (awaitingUserClarification && result.clarifications.length > 0) {
|
||||
result.status = "clarification";
|
||||
result.summary = null;
|
||||
result.clarification = result.clarifications[0] ?? null;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -584,18 +584,55 @@ export async function streamMultiAgent(
|
||||
|
||||
// Inferred SSE phase + a tiny helper so we only fire onPhaseChange when the
|
||||
// value actually changes (the reader loop sees many frames per phase).
|
||||
//
|
||||
// `write_file` 的 `content`、`str_replace` 的 old_str/new_str 会在每个
|
||||
// tool_call chunk 中持续增长。它们属于实时预览数据,已经由 onUpstreamFrame
|
||||
// 写入 stub;若用它们判断 phase 变化,会在单次工具调用里反复触发 React 状态
|
||||
// 更新,严重时会形成 Maximum update depth loop。因此这里只比较工具的身份入参。
|
||||
const phaseArgsSignature = (args?: Record<string, unknown>) => {
|
||||
if (!args) return "";
|
||||
const streamedPayloadKeys = new Set([
|
||||
"content",
|
||||
"old_str",
|
||||
"new_str",
|
||||
"patch",
|
||||
"diff",
|
||||
]);
|
||||
try {
|
||||
return JSON.stringify(
|
||||
Object.fromEntries(
|
||||
Object.entries(args)
|
||||
.filter(([key]) => !streamedPayloadKeys.has(key))
|
||||
.sort(([left], [right]) => left.localeCompare(right)),
|
||||
),
|
||||
);
|
||||
} catch {
|
||||
return "[unserializable]";
|
||||
}
|
||||
};
|
||||
let currentPhase: StreamPhase = "connecting";
|
||||
let currentPhaseName = "";
|
||||
let currentPhaseArgsSignature = "";
|
||||
req.onPhaseChange?.("connecting");
|
||||
const setPhase = (
|
||||
next: StreamPhase,
|
||||
name?: string,
|
||||
args?: Record<string, unknown>,
|
||||
) => {
|
||||
// 同一个 phase + 同一个 toolName 才认为是"重复",此时不再回调上层;
|
||||
// 但 args 单独是新的(如同一工具被多次 call 携带不同入参)时也不回调 —— 上层
|
||||
// appendStepIfNew 用 `phase:toolName` 做 key 去重,本来也不会因 args 变化产生新步骤。
|
||||
if (next === currentPhase && !name) return;
|
||||
const nextName = name ?? "";
|
||||
const nextArgsSignature = phaseArgsSignature(args);
|
||||
// 同 phase、同工具、同身份入参的帧只是流式重复帧,不通知 UI。保留 path/filepaths
|
||||
// 等身份变化,确保工具参数从不完整变完整时仍可自动打开沙箱。
|
||||
if (
|
||||
next === currentPhase &&
|
||||
nextName === currentPhaseName &&
|
||||
nextArgsSignature === currentPhaseArgsSignature
|
||||
) {
|
||||
return;
|
||||
}
|
||||
currentPhase = next;
|
||||
currentPhaseName = nextName;
|
||||
currentPhaseArgsSignature = nextArgsSignature;
|
||||
req.onPhaseChange?.(next, name, args);
|
||||
};
|
||||
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
* 卡片席位名优先用实时 agent 数据(`listAgents()`,与 `BusinessChainPicker` 一致),
|
||||
* agent 改名后此弹窗也能同步显示;解析不到才回退到落库快照(`seat.name`)。
|
||||
*/
|
||||
import { Fragment, useCallback, useEffect, useState } from "react";
|
||||
import { Fragment, useCallback, useEffect, useMemo, useState } from "react";
|
||||
import {
|
||||
ArrowRightIcon,
|
||||
ClockIcon,
|
||||
GlobeIcon,
|
||||
LayersIcon,
|
||||
Loader2Icon,
|
||||
@@ -28,14 +29,15 @@ import {
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "@/components/ui/dialog";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { useDesensitizeSubtree } from "@/roundtable-planning/lib/use-desensitize-subtree";
|
||||
|
||||
import { getStoredAuth } from "@/core/auth";
|
||||
import { listAgents } from "@/core/agents";
|
||||
|
||||
import { listChains, setChainPublic, type ChainScope } from "../api/chains";
|
||||
import { chainTagClasses, type BusinessChain } from "../lib/business-chain";
|
||||
import { listChains, setChainEnabled, setChainPublic, type ChainScope } from "../api/chains";
|
||||
import { chainTagClasses, isChainEnabled, type BusinessChain } from "../lib/business-chain";
|
||||
import { getAvatarTypeFor } from "../lib/roundtable-constants";
|
||||
|
||||
export interface BusinessChainListDialogProps {
|
||||
@@ -57,6 +59,8 @@ export interface BusinessChainListBodyProps {
|
||||
emptyHint?: string;
|
||||
}
|
||||
|
||||
export type EnabledFilter = "all" | "enabled" | "disabled";
|
||||
|
||||
/**
|
||||
* 业务链条列表主体(筛选 tab + 滚动卡片列表)。
|
||||
*
|
||||
@@ -76,7 +80,10 @@ export function BusinessChainListBody({
|
||||
const isAdmin = getStoredAuth()?.system_role === "admin";
|
||||
// 筛选:我的 / 公共(已发布)/(管理员)全部。
|
||||
const [scope, setScope] = useState<ChainScope>("mine");
|
||||
// 启停筛选:全部 / 启用 / 停用。默认全部,关掉开关后卡片仍留在当前列表。
|
||||
const [enabledFilter, setEnabledFilter] = useState<EnabledFilter>("all");
|
||||
const [publishingId, setPublishingId] = useState<string | null>(null);
|
||||
const [togglingId, setTogglingId] = useState<string | null>(null);
|
||||
// 实时名称表(id 小写 → 最新 name):用于把席位的落库快照名刷新成最新(agent 改名同步)。
|
||||
const [nameById, setNameById] = useState<Map<string, string>>(new Map());
|
||||
|
||||
@@ -137,8 +144,12 @@ export function BusinessChainListBody({
|
||||
async (chain: BusinessChain) => {
|
||||
setPublishingId(chain.id);
|
||||
try {
|
||||
await setChainPublic(chain.id, !chain.isPublic);
|
||||
await refresh(scope);
|
||||
const updated = await setChainPublic(chain.id, !chain.isPublic);
|
||||
if (updated) {
|
||||
setChains((prev) => prev.map((c) => (c.id === updated.id ? updated : c)));
|
||||
} else {
|
||||
await refresh(scope);
|
||||
}
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : String(err));
|
||||
} finally {
|
||||
@@ -148,25 +159,69 @@ export function BusinessChainListBody({
|
||||
[refresh, scope],
|
||||
);
|
||||
|
||||
const handleToggleEnabled = useCallback(
|
||||
async (chain: BusinessChain) => {
|
||||
setTogglingId(chain.id);
|
||||
try {
|
||||
const updated = await setChainEnabled(chain.id, !isChainEnabled(chain));
|
||||
if (updated) {
|
||||
setChains((prev) => prev.map((c) => (c.id === updated.id ? updated : c)));
|
||||
} else {
|
||||
await refresh(scope);
|
||||
}
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : String(err));
|
||||
} finally {
|
||||
setTogglingId(null);
|
||||
}
|
||||
},
|
||||
[refresh, scope],
|
||||
);
|
||||
|
||||
const visibleChains = useMemo(() => {
|
||||
if (enabledFilter === "enabled") return chains.filter((c) => isChainEnabled(c));
|
||||
if (enabledFilter === "disabled") return chains.filter((c) => !isChainEnabled(c));
|
||||
return chains;
|
||||
}, [chains, enabledFilter]);
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* 筛选:我的 / 公共 /(管理员)全部 */}
|
||||
<div className="shrink-0 flex items-center gap-1 rounded-lg border border-border bg-muted/40 p-0.5 self-start">
|
||||
{((isAdmin ? ["mine", "public", "all"] : ["mine", "public"]) as ChainScope[]).map((s) => (
|
||||
<button
|
||||
key={s}
|
||||
type="button"
|
||||
onClick={() => setScope(s)}
|
||||
className={cn(
|
||||
"rounded-md px-3 py-1 text-xs font-medium transition",
|
||||
scope === s
|
||||
? "bg-primary text-primary-foreground shadow-sm"
|
||||
: "text-muted-foreground hover:text-foreground",
|
||||
)}
|
||||
>
|
||||
{s === "mine" ? "我的" : s === "public" ? "公共" : "全部"}
|
||||
</button>
|
||||
))}
|
||||
{/* 筛选:我的 / 公共 /(管理员)全部 + 全部 / 启用 / 停用 */}
|
||||
<div className="flex shrink-0 flex-wrap items-center gap-2">
|
||||
<div className="flex items-center gap-1 rounded-lg border border-border bg-muted/40 p-0.5 self-start">
|
||||
{((isAdmin ? ["mine", "public", "all"] : ["mine", "public"]) as ChainScope[]).map((s) => (
|
||||
<button
|
||||
key={s}
|
||||
type="button"
|
||||
onClick={() => setScope(s)}
|
||||
className={cn(
|
||||
"rounded-md px-3 py-1 text-xs font-medium transition",
|
||||
scope === s
|
||||
? "bg-primary text-primary-foreground shadow-sm"
|
||||
: "text-muted-foreground hover:text-foreground",
|
||||
)}
|
||||
>
|
||||
{s === "mine" ? "我的" : s === "public" ? "公共" : "全部"}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<div className="flex items-center gap-1 rounded-lg border border-border bg-muted/40 p-0.5 self-start">
|
||||
{(["all", "enabled", "disabled"] as EnabledFilter[]).map((f) => (
|
||||
<button
|
||||
key={f}
|
||||
type="button"
|
||||
onClick={() => setEnabledFilter(f)}
|
||||
className={cn(
|
||||
"rounded-md px-3 py-1 text-xs font-medium transition",
|
||||
enabledFilter === f
|
||||
? "bg-primary text-primary-foreground shadow-sm"
|
||||
: "text-muted-foreground hover:text-foreground",
|
||||
)}
|
||||
>
|
||||
{f === "all" ? "全部状态" : f === "enabled" ? "启用" : "停用"}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="custom-scrollbar -mr-1 min-h-0 flex-1 overflow-y-auto py-3 pr-1">
|
||||
@@ -179,30 +234,40 @@ export function BusinessChainListBody({
|
||||
<div className="rounded-md border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive">
|
||||
加载业务链条失败:{error}
|
||||
</div>
|
||||
) : chains.length === 0 ? (
|
||||
) : visibleChains.length === 0 ? (
|
||||
<div className="flex flex-col items-center justify-center gap-3 px-6 py-12 text-center">
|
||||
<LayersIcon className="size-10 text-primary/40" />
|
||||
<div className="text-sm font-semibold">
|
||||
{scope === "public" ? "还没有公共链条" : "还没有业务链条"}
|
||||
{enabledFilter !== "all"
|
||||
? enabledFilter === "enabled"
|
||||
? "没有启用的业务链条"
|
||||
: "没有停用的业务链条"
|
||||
: scope === "public"
|
||||
? "还没有公共链条"
|
||||
: "还没有业务链条"}
|
||||
</div>
|
||||
<p className="max-w-sm text-xs leading-relaxed text-muted-foreground">
|
||||
{scope === "public"
|
||||
? "公共链条是其他账号(或你自己)发布出来、所有人可见的链条。去「我的」里发布一条试试。"
|
||||
: emptyHint ??
|
||||
"业务链条是可复用的有序智能体编排。点击下方「配置」去创建第一条链条。"}
|
||||
{enabledFilter !== "all"
|
||||
? "试试切换「全部状态」,或到卡片上用开关切换启停。"
|
||||
: scope === "public"
|
||||
? "公共链条是其他账号(或你自己)发布出来、所有人可见的链条。去「我的」里发布一条试试。"
|
||||
: emptyHint ??
|
||||
"业务链条是可复用的有序智能体编排。点击下方「配置」去创建第一条链条。"}
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-3.5">
|
||||
{chains.map((chain) => (
|
||||
{visibleChains.map((chain) => (
|
||||
<ChainRow
|
||||
key={chain.id}
|
||||
chain={chain}
|
||||
canManage={isAdmin || chain.isMine !== false}
|
||||
nameById={nameById}
|
||||
publishing={publishingId === chain.id}
|
||||
toggling={togglingId === chain.id}
|
||||
onSettings={() => onConfigure(chain.id)}
|
||||
onTogglePublic={() => handleTogglePublic(chain)}
|
||||
onToggleEnabled={() => handleToggleEnabled(chain)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
@@ -252,22 +317,33 @@ function ChainRow({
|
||||
canManage,
|
||||
nameById,
|
||||
publishing,
|
||||
toggling,
|
||||
onSettings,
|
||||
onTogglePublic,
|
||||
onToggleEnabled,
|
||||
}: {
|
||||
chain: BusinessChain;
|
||||
/** 能否编辑 / 发布(本人链条 或 管理员)。 */
|
||||
/** 能否编辑 / 发布 / 启停(本人链条 或 管理员)。 */
|
||||
canManage: boolean;
|
||||
nameById: Map<string, string>;
|
||||
publishing: boolean;
|
||||
toggling: boolean;
|
||||
onSettings: () => void;
|
||||
onTogglePublic: () => void;
|
||||
onToggleEnabled: () => void;
|
||||
}) {
|
||||
// 配置者用户名:后端返回 email,展示时取 @ 前的本地部分更像「用户名」。
|
||||
const ownerName = chain.ownerName ? chain.ownerName.split("@")[0] : "";
|
||||
const enabled = isChainEnabled(chain);
|
||||
const updatedLabel = formatUpdatedAt(chain.updatedAt);
|
||||
return (
|
||||
<div className="rounded-2xl border border-border bg-card p-5 transition-colors hover:border-primary/40">
|
||||
{/* 标题行 + 公共徽标 + 发布/设置按钮 */}
|
||||
<div
|
||||
className={cn(
|
||||
"rounded-2xl border border-border bg-card p-5 transition-colors hover:border-primary/40",
|
||||
!enabled && "opacity-70",
|
||||
)}
|
||||
>
|
||||
{/* 标题行 + 公共/停用徽标 + 启停开关 / 发布 / 设置按钮 */}
|
||||
<div className="flex items-center gap-2.5">
|
||||
<div className="truncate text-base font-semibold">{chain.title || "未命名链条"}</div>
|
||||
<span className="shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs font-medium tabular-nums text-muted-foreground">
|
||||
@@ -279,7 +355,26 @@ function ChainRow({
|
||||
公共
|
||||
</span>
|
||||
)}
|
||||
{!enabled && (
|
||||
<span className="shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground">
|
||||
已停用
|
||||
</span>
|
||||
)}
|
||||
<div className="ml-auto flex shrink-0 items-center gap-1.5">
|
||||
{/* 启停:本人的链条或管理员可操作。 */}
|
||||
{canManage && (
|
||||
<label className="flex items-center gap-1.5 pr-1 text-xs text-muted-foreground">
|
||||
<Switch
|
||||
checked={enabled}
|
||||
disabled={toggling}
|
||||
onCheckedChange={() => onToggleEnabled()}
|
||||
aria-label={enabled ? "停用该业务链条" : "启用该业务链条"}
|
||||
/>
|
||||
<span className={cn("min-w-[2em]", enabled ? "text-foreground" : "text-muted-foreground")}>
|
||||
{enabled ? "启用" : "停用"}
|
||||
</span>
|
||||
</label>
|
||||
)}
|
||||
{/* 发布 / 取消发布:本人的链条或管理员可操作。 */}
|
||||
{canManage && (
|
||||
<Button
|
||||
@@ -312,13 +407,20 @@ function ChainRow({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{ownerName && (
|
||||
<div
|
||||
className="mt-1.5 flex items-center gap-1 text-xs text-muted-foreground"
|
||||
title={chain.ownerName}
|
||||
>
|
||||
<UserIcon className="size-3.5 shrink-0" />
|
||||
<span className="truncate">配置人:{ownerName}</span>
|
||||
{(ownerName || updatedLabel) && (
|
||||
<div className="mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground">
|
||||
{ownerName && (
|
||||
<div className="flex items-center gap-1" title={chain.ownerName}>
|
||||
<UserIcon className="size-3.5 shrink-0" />
|
||||
<span className="truncate">配置人:{ownerName}</span>
|
||||
</div>
|
||||
)}
|
||||
{updatedLabel && (
|
||||
<div className="flex items-center gap-1" title={chain.updatedAt}>
|
||||
<ClockIcon className="size-3.5 shrink-0" />
|
||||
<span>最后修改:{updatedLabel}</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -401,3 +503,21 @@ function ChainSeatsFlow({
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** 后端 `updated_at` 形如 `2026-08-19T17:50:00+08:00`;展示到分钟。 */
|
||||
function formatUpdatedAt(iso: string | undefined): string {
|
||||
if (!iso) return "";
|
||||
const date = new Date(iso);
|
||||
if (!Number.isNaN(date.getTime())) {
|
||||
return date.toLocaleString("zh-CN", {
|
||||
year: "numeric",
|
||||
month: "2-digit",
|
||||
day: "2-digit",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
});
|
||||
}
|
||||
const s = iso.replace("T", " ");
|
||||
return s.length >= 16 ? s.slice(0, 16) : s;
|
||||
}
|
||||
@@ -34,6 +34,7 @@ import { listChains, type ChainScope } from "../api/chains";
|
||||
import {
|
||||
CHAIN_MIN_SEATS,
|
||||
chainTagClasses,
|
||||
isChainEnabled,
|
||||
type BusinessChain,
|
||||
type SeatSelectionResult,
|
||||
} from "../lib/business-chain";
|
||||
@@ -77,7 +78,7 @@ export function BusinessChainPicker({
|
||||
listAgents().catch(() => null), // agent 列表失败不阻断链条展示
|
||||
]);
|
||||
if (cancelled) return;
|
||||
setChains(chainList);
|
||||
setChains(chainList.filter(isChainEnabled));
|
||||
if (agents) {
|
||||
const candidates = filterRecommendCandidates(agents);
|
||||
setExistingIds(new Set(candidates.map((c) => c.agent_id)));
|
||||
|
||||
@@ -32,6 +32,7 @@ import {
|
||||
type ThreadIdMap,
|
||||
} from "@/roundtable-planning/api/multi-agent";
|
||||
import { ConsensusDocxDownloadButton } from "@/roundtable-planning/components/ConsensusDocxDownloadButton";
|
||||
import { TaskArtifactSubmitButton } from "@/roundtable-planning/components/TaskArtifactSubmitButton";
|
||||
import { desensitize } from "@/lib/desensitize";
|
||||
import { markdownComponents } from "@/roundtable-planning/components/markdown-components";
|
||||
import {
|
||||
@@ -46,6 +47,7 @@ import type {
|
||||
import type { UseStep3DashboardReturn } from "@/roundtable-planning/hooks/useStep3Dashboard";
|
||||
import type { ReportIntent, UseStep3ReportReturn } from "@/roundtable-planning/hooks/useStep3Report";
|
||||
import type { UseStep3SummaryReturn } from "@/roundtable-planning/hooks/useStep3Summary";
|
||||
import type { TaskArtifactSubmissionController } from "@/roundtable-planning/lib/task-artifact-submission";
|
||||
|
||||
interface SeatDelivery {
|
||||
/** Display name of the seat (e.g. "情报收集"). */
|
||||
@@ -57,6 +59,8 @@ interface SeatDelivery {
|
||||
}
|
||||
|
||||
interface HighFidelityReportProps {
|
||||
useStep1Chrome?: boolean;
|
||||
headerTitle?: string;
|
||||
threadIds: ThreadIdMap | null;
|
||||
coordinatorName: string | null;
|
||||
/** The most recent leader-agent text — rendered as the final consensus. */
|
||||
@@ -93,6 +97,7 @@ interface HighFidelityReportProps {
|
||||
onReset: () => void;
|
||||
openArtifactPreview: (threadId: string, path: string) => void;
|
||||
seatStubMessages: Record<string, unknown[]>;
|
||||
taskArtifactSubmission?: TaskArtifactSubmissionController;
|
||||
}
|
||||
|
||||
interface SeatArtifacts {
|
||||
@@ -117,6 +122,8 @@ function formatGeneratedAt(d: Date): string {
|
||||
}
|
||||
|
||||
export const HighFidelityReport: React.FC<HighFidelityReportProps> = ({
|
||||
useStep1Chrome = false,
|
||||
headerTitle,
|
||||
threadIds,
|
||||
coordinatorName,
|
||||
consensusText,
|
||||
@@ -139,6 +146,7 @@ export const HighFidelityReport: React.FC<HighFidelityReportProps> = ({
|
||||
onReset,
|
||||
openArtifactPreview,
|
||||
seatStubMessages,
|
||||
taskArtifactSubmission,
|
||||
}) => {
|
||||
// 「结果绘制」模式:把现有报告内容收起到左栏,右侧由方案可视化智能体绘制图表 HTML。
|
||||
const consensusDocTitle = useMemo(() => {
|
||||
@@ -148,8 +156,7 @@ export const HighFidelityReport: React.FC<HighFidelityReportProps> = ({
|
||||
return `圆桌总控结论-${short}`;
|
||||
}, [intentReady?.objective]);
|
||||
|
||||
// 第 3 步**主页** = 总结报告(进第三步默认自动跑「方案总结报告智能体」)。
|
||||
// 用户点「最终方案展示」切到静态页(summaryMode=false),再从静态页可进「结果绘制」HTML。
|
||||
// 第 3 步只保留「总结报告」工作台;旧的最终方案展示 / HTML 绘制入口不再开放。
|
||||
const [summaryMode, setSummaryMode] = useState(true);
|
||||
const [drawMode, setDrawMode] = useState(false);
|
||||
// 文件沙箱(2026-06-13 改内联):点文件卡片在右侧滑入沙箱面板、左侧席位栏收起
|
||||
@@ -430,6 +437,8 @@ export const HighFidelityReport: React.FC<HighFidelityReportProps> = ({
|
||||
if (summaryMode) {
|
||||
return (
|
||||
<Step3SummaryMode
|
||||
useStep1Chrome={useStep1Chrome}
|
||||
headerTitle={headerTitle}
|
||||
threadIds={threadIds}
|
||||
coordinatorName={coordinatorName}
|
||||
consensusText={consensusText}
|
||||
@@ -439,12 +448,11 @@ export const HighFidelityReport: React.FC<HighFidelityReportProps> = ({
|
||||
intentReady={intentReady}
|
||||
selectedModel={selectedModel}
|
||||
availableModels={availableModels}
|
||||
modelsLoading={modelsLoading}
|
||||
setSelectedModel={setSelectedModel}
|
||||
coordinatorPrompt={coordinatorPrompt}
|
||||
savedSummary={savedSummary}
|
||||
summary={summaryFlow}
|
||||
onViewStatic={() => setSummaryMode(false)}
|
||||
taskArtifactSubmission={taskArtifactSubmission}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -467,6 +475,7 @@ export const HighFidelityReport: React.FC<HighFidelityReportProps> = ({
|
||||
report={reportFlow}
|
||||
dashboard={dashboardFlow}
|
||||
onBack={() => setDrawMode(false)}
|
||||
taskArtifactSubmission={taskArtifactSubmission}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -917,6 +926,27 @@ export const HighFidelityReport: React.FC<HighFidelityReportProps> = ({
|
||||
</div>
|
||||
<div className="flex items-center gap-1 shrink-0">
|
||||
<Eye className="w-3.5 h-3.5 text-slate-300 transition group-hover:text-primary dark:text-muted-foreground" />
|
||||
{seat.threadId && (
|
||||
<TaskArtifactSubmitButton
|
||||
compact
|
||||
controller={taskArtifactSubmission}
|
||||
target={taskArtifactSubmission?.targetFor({
|
||||
threadId: seat.threadId,
|
||||
path: f.path,
|
||||
name: f.name,
|
||||
mimeType: f.mimeType,
|
||||
agentId: seat.key,
|
||||
agentName: seat.displayName,
|
||||
}) ?? {
|
||||
threadId: seat.threadId,
|
||||
path: f.path,
|
||||
name: f.name,
|
||||
mimeType: f.mimeType,
|
||||
agentId: seat.key,
|
||||
agentName: seat.displayName,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => {
|
||||
@@ -1011,6 +1041,24 @@ export const HighFidelityReport: React.FC<HighFidelityReportProps> = ({
|
||||
threadId={fileSandboxTarget.threadId}
|
||||
onClose={handleCloseFileSandbox}
|
||||
allowVirtualMarkdownEdit
|
||||
headerLeadingActionBare
|
||||
headerLeadingAction={(
|
||||
<TaskArtifactSubmitButton
|
||||
compact
|
||||
controller={taskArtifactSubmission}
|
||||
target={taskArtifactSubmission?.targetFor({
|
||||
threadId: fileSandboxTarget.threadId,
|
||||
path: fileSandboxTarget.file.path,
|
||||
name: fileSandboxTarget.file.name,
|
||||
mimeType: fileSandboxTarget.file.mimeType,
|
||||
}) ?? {
|
||||
threadId: fileSandboxTarget.threadId,
|
||||
path: fileSandboxTarget.file.path,
|
||||
name: fileSandboxTarget.file.name,
|
||||
mimeType: fileSandboxTarget.file.mimeType,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</ThreadContext.Provider>
|
||||
)}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* 状态全部来自 `useStep2Orchestration` —— 本组件不调任何后端、不持久化。
|
||||
*/
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
|
||||
import {
|
||||
Cpu,
|
||||
FileIcon,
|
||||
@@ -41,6 +41,7 @@ function formatFileSize(bytes: number): string {
|
||||
const SHOW_BACKGROUND_SUSPEND = true;
|
||||
|
||||
import { AutoGrowTextarea } from "@/components/ui/auto-grow-textarea";
|
||||
import { PositionIntentInput } from "@/position-roundtable/components/PositionIntentInput";
|
||||
import { useLocalSettings } from "@/core/settings";
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { MessageMetric } from "@/components/workspace/messages/use-message-metrics";
|
||||
@@ -49,6 +50,7 @@ import { DialogueSpeedMeter } from "@/roundtable-planning/components/DialogueSpe
|
||||
import { PersonaDrawer } from "@/roundtable-planning/components/PersonaDrawer";
|
||||
import { ScrollToBottomButton } from "@/roundtable-planning/components/ScrollToBottomButton";
|
||||
import { Step2SandboxLayout } from "@/roundtable-planning/components/Step2SandboxLayout";
|
||||
import { TaskArtifactSubmitButton } from "@/roundtable-planning/components/TaskArtifactSubmitButton";
|
||||
import { getAvatar } from "@/roundtable-planning/components/Avatars";
|
||||
import {
|
||||
MarkdownContent,
|
||||
@@ -86,6 +88,7 @@ import { desensitize } from "@/lib/desensitize";
|
||||
import { useDesensitizeSubtree } from "@/roundtable-planning/lib/use-desensitize-subtree";
|
||||
import { splitInlineReasoning } from "@/roundtable-planning/lib/reasoning";
|
||||
import type { ClarificationPayload } from "@/roundtable-planning/api/multi-agent";
|
||||
import type { TaskArtifactSubmissionController } from "@/roundtable-planning/lib/task-artifact-submission";
|
||||
|
||||
interface ModelOption {
|
||||
name: string;
|
||||
@@ -93,6 +96,12 @@ interface ModelOption {
|
||||
}
|
||||
|
||||
export interface Step2PanelProps {
|
||||
/** 独立业务页需要与第一步完全相同的输入组件(8BF 专用,默认不改变原会商)。 */
|
||||
useStep1InputAppearance?: boolean;
|
||||
/** 8BF 第二步对话区标题,与第一步「业务链 · 意图识别」同一套顶栏。 */
|
||||
headerTitle?: string;
|
||||
/** 8BF 第二步顶栏右侧附加操作(如返回)。 */
|
||||
headerRightSlot?: ReactNode;
|
||||
// ─── State ────────────────────────────────────────────────────
|
||||
step2RoundtableDialogues: Step2Dialogue[];
|
||||
isInitializing: boolean;
|
||||
@@ -157,10 +166,15 @@ export interface Step2PanelProps {
|
||||
/** 是否在「查看历史记录」(从草稿/后台作业加载)—— 为 true 时隐藏「后台挂起」按钮。 */
|
||||
isViewingHistory?: boolean;
|
||||
onTriggerToast: (msg: string) => void;
|
||||
/** 任务深链页面注入的外部过程产物提交控制器。 */
|
||||
taskArtifactSubmission?: TaskArtifactSubmissionController;
|
||||
}
|
||||
|
||||
export function Step2Panel(props: Step2PanelProps) {
|
||||
const {
|
||||
useStep1InputAppearance = false,
|
||||
headerTitle,
|
||||
headerRightSlot,
|
||||
step2RoundtableDialogues,
|
||||
isInitializing,
|
||||
isRoundTableRunning,
|
||||
@@ -203,6 +217,7 @@ export function Step2Panel(props: Step2PanelProps) {
|
||||
onBackgroundSuspend,
|
||||
isViewingHistory,
|
||||
onTriggerToast,
|
||||
taskArtifactSubmission,
|
||||
} = props;
|
||||
|
||||
const step2ScrollRef = useRef<HTMLDivElement>(null);
|
||||
@@ -372,23 +387,17 @@ export function Step2Panel(props: Step2PanelProps) {
|
||||
prevArtifactsOpenRef.current = artifactsOpenForFlow;
|
||||
}, [artifactsOpenForFlow]);
|
||||
|
||||
// 干预研审:记录指令并自动恢复会商,右上角按钮状态由 isRoundTableRunning 驱动
|
||||
const [pauseFlash, setPauseFlash] = useState(false);
|
||||
|
||||
// 干预消息携带的本地附件(点「干预并发送」时连同指令一起上传)。
|
||||
const [injectFiles, setInjectFiles] = useState<File[]>([]);
|
||||
const injectFileInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
const handlePickInjectFiles = useCallback(
|
||||
(e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const picked = Array.from(e.target.files ?? []);
|
||||
const addInjectFiles = useCallback(
|
||||
(picked: File[]) => {
|
||||
if (picked.length > 0) {
|
||||
setInjectFiles((prev) => {
|
||||
const seen = new Set(prev.map((f) => `${f.name}:${f.size}`));
|
||||
return [...prev, ...picked.filter((f) => !seen.has(`${f.name}:${f.size}`))];
|
||||
});
|
||||
}
|
||||
e.target.value = "";
|
||||
},
|
||||
[],
|
||||
);
|
||||
@@ -400,13 +409,14 @@ export function Step2Panel(props: Step2PanelProps) {
|
||||
const handleInject = useCallback(() => {
|
||||
onHandleInjectToRoundtable(injectFiles.length > 0 ? injectFiles : undefined);
|
||||
setInjectFiles([]);
|
||||
setPauseFlash(true);
|
||||
window.setTimeout(() => setPauseFlash(false), 1600);
|
||||
}, [onHandleInjectToRoundtable, injectFiles]);
|
||||
|
||||
const isSandboxStreaming =
|
||||
isOrchestrating ||
|
||||
step2RoundtableDialogues.some((dialogue) => dialogue.streaming === true);
|
||||
// 顶部「会商运行」状态在等待用户输入时仍可能保持 true,不能据此把发送键误显示成暂停。
|
||||
// 仅在初始化或实际流式输出时,沿用第一步输入框的暂停态。
|
||||
const isStep2Responding = isInitializing || isSandboxStreaming;
|
||||
|
||||
// 顶部标题栏整片脱敏(消息列表正文不在此容器,保持原文)。
|
||||
const headerDzRef = useDesensitizeSubtree<HTMLDivElement>();
|
||||
@@ -414,62 +424,92 @@ export function Step2Panel(props: Step2PanelProps) {
|
||||
const chatBody = (
|
||||
<>
|
||||
{/* Headline */}
|
||||
<div ref={headerDzRef} className="shrink-0 px-6 py-4.5 border-b border-slate-100 flex items-center justify-between bg-white shadow-sm">
|
||||
<div className="flex items-center gap-2">
|
||||
<Cpu className="w-5 h-5 text-primary" strokeWidth={2.5} />
|
||||
<div>
|
||||
<h3 className="text-sm font-extrabold text-slate-900">多智能体圆桌会商中心</h3>
|
||||
<p className="text-[calc(10px*var(--ui-font-scale,1))] text-slate-400 font-medium">
|
||||
分布式领域专家实时动态博弈与纳什协商收敛中
|
||||
</p>
|
||||
<div
|
||||
ref={headerDzRef}
|
||||
className={
|
||||
useStep1InputAppearance
|
||||
? "shrink-0 flex items-center justify-between gap-3"
|
||||
: "shrink-0 px-6 py-4.5 border-b border-slate-100 flex items-center justify-between bg-white shadow-sm"
|
||||
}
|
||||
>
|
||||
{useStep1InputAppearance ? (
|
||||
<div className="position-roundtable-intent-header-title">
|
||||
<span aria-hidden="true" />
|
||||
<h2>{headerTitle || "多智能体会商"}</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2.5 shrink-0">
|
||||
<select
|
||||
id="step2-global-model-select"
|
||||
value={selectedModel}
|
||||
onChange={(e) => setSelectedModel(e.target.value)}
|
||||
disabled={modelsLoading || availableModels.length === 0}
|
||||
title={
|
||||
modelsLoading
|
||||
? "正在加载模型列表…"
|
||||
: availableModels.length === 0
|
||||
? "未在 config.yaml 中配置任何模型"
|
||||
: "切换全局推理模型"
|
||||
}
|
||||
className="max-w-[220px] bg-slate-50/50 border border-slate-200 rounded-xl px-3 py-1.5 text-xs font-bold text-slate-700 cursor-pointer focus:outline-none focus:border-primary focus:ring-1 focus:ring-[var(--brand-200)]/50 disabled:opacity-50 disabled:cursor-not-allowed dark:bg-secondary dark:text-foreground dark:border-border"
|
||||
>
|
||||
{availableModels.length === 0 && (
|
||||
<option value="">{modelsLoading ? "加载中…" : "未配置模型"}</option>
|
||||
)}
|
||||
{availableModels.map((m) => (
|
||||
<option key={m.name} value={m.name}>
|
||||
{m.display_name && m.display_name !== m.name
|
||||
? `${m.display_name} (${m.name})`
|
||||
: m.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
) : (
|
||||
<div className="flex items-center gap-2">
|
||||
<Cpu className="w-5 h-5 text-primary" strokeWidth={2.5} />
|
||||
<div>
|
||||
<h3 className="text-sm font-extrabold text-slate-900">多智能体圆桌会商中心</h3>
|
||||
<p className="text-[calc(10px*var(--ui-font-scale,1))] text-slate-400 font-medium">
|
||||
分布式领域专家实时动态博弈与纳什协商收敛中
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<div
|
||||
className={
|
||||
useStep1InputAppearance
|
||||
? "position-roundtable-intent-header-actions"
|
||||
: "flex items-center gap-2.5 shrink-0"
|
||||
}
|
||||
>
|
||||
{!useStep1InputAppearance && (
|
||||
<select
|
||||
id="step2-global-model-select"
|
||||
value={selectedModel}
|
||||
onChange={(e) => setSelectedModel(e.target.value)}
|
||||
disabled={modelsLoading || availableModels.length === 0}
|
||||
title={
|
||||
modelsLoading
|
||||
? "正在加载模型列表…"
|
||||
: availableModels.length === 0
|
||||
? "未在 config.yaml 中配置任何模型"
|
||||
: "切换全局推理模型"
|
||||
}
|
||||
className="max-w-[220px] bg-slate-50/50 border border-slate-200 rounded-xl px-3 py-1.5 text-xs font-bold text-slate-700 cursor-pointer focus:outline-none focus:border-primary focus:ring-1 focus:ring-[var(--brand-200)]/50 disabled:opacity-50 disabled:cursor-not-allowed dark:bg-secondary dark:text-foreground dark:border-border"
|
||||
>
|
||||
{availableModels.length === 0 && (
|
||||
<option value="">{modelsLoading ? "加载中…" : "未配置模型"}</option>
|
||||
)}
|
||||
{availableModels.map((m) => (
|
||||
<option key={m.name} value={m.name}>
|
||||
{m.display_name && m.display_name !== m.name
|
||||
? `${m.display_name} (${m.name})`
|
||||
: m.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
)}
|
||||
{!isRoundTableRunning ? (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onResumeRoundtable}
|
||||
className={`bg-emerald-100 hover:bg-emerald-200 text-emerald-800 text-[calc(10px*var(--ui-font-scale,1))] font-bold px-2.5 py-1 rounded-xl flex items-center gap-1 transition border border-emerald-200/40 shadow-sm ${
|
||||
pauseFlash
|
||||
? "ring-2 ring-emerald-400 ring-offset-1 animate-pulse"
|
||||
: ""
|
||||
}`}
|
||||
title="恢复自动研讨"
|
||||
className={
|
||||
useStep1InputAppearance
|
||||
? "eightbf-roundtable__resume-button"
|
||||
: "bg-emerald-100 hover:bg-emerald-200 text-emerald-800 text-[calc(10px*var(--ui-font-scale,1))] font-bold px-2.5 py-1 rounded-xl flex items-center gap-1 transition border border-emerald-200/40 shadow-sm"
|
||||
}
|
||||
>
|
||||
<Play className="w-3.5 h-3.5 fill-emerald-800" />
|
||||
{!useStep1InputAppearance && (
|
||||
<Play className="w-3.5 h-3.5 fill-emerald-800" />
|
||||
)}
|
||||
恢复会商
|
||||
</button>
|
||||
) : (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onPauseRoundtable}
|
||||
className="bg-amber-100 hover:bg-amber-200 text-amber-800 text-[calc(10px*var(--ui-font-scale,1))] font-bold px-2.5 py-1 rounded-xl flex items-center gap-1 transition border border-amber-200/40 shadow-sm"
|
||||
title="暂停当前会商编排,可稍后恢复"
|
||||
className={
|
||||
useStep1InputAppearance
|
||||
? "eightbf-roundtable__pause-button"
|
||||
: "bg-amber-100 hover:bg-amber-200 text-amber-800 text-[calc(10px*var(--ui-font-scale,1))] font-bold px-2.5 py-1 rounded-xl flex items-center gap-1 transition border border-amber-200/40 shadow-sm"
|
||||
}
|
||||
>
|
||||
<Pause className="w-3.5 h-3.5" />
|
||||
{!useStep1InputAppearance && <Pause className="w-3.5 h-3.5" />}
|
||||
暂停会商
|
||||
</button>
|
||||
)}
|
||||
@@ -480,12 +520,17 @@ export function Step2Panel(props: Step2PanelProps) {
|
||||
type="button"
|
||||
onClick={onBackgroundSuspend}
|
||||
title="把当前研讨转入后台自动跑到结果绘制完成;可离开页面,进度在历史记录里查看"
|
||||
className="bg-slate-100 hover:bg-slate-200 text-slate-700 text-[calc(10px*var(--ui-font-scale,1))] font-bold px-2.5 py-1 rounded-xl flex items-center gap-1 transition border border-slate-200/60 shadow-sm dark:bg-secondary dark:text-foreground dark:border-border"
|
||||
className={
|
||||
useStep1InputAppearance
|
||||
? "eightbf-roundtable__suspend-button"
|
||||
: "bg-slate-100 hover:bg-slate-200 text-slate-700 text-[calc(10px*var(--ui-font-scale,1))] font-bold px-2.5 py-1 rounded-xl flex items-center gap-1 transition border border-slate-200/60 shadow-sm dark:bg-secondary dark:text-foreground dark:border-border"
|
||||
}
|
||||
>
|
||||
<Network className="w-3.5 h-3.5" />
|
||||
{!useStep1InputAppearance && <Network className="w-3.5 h-3.5" />}
|
||||
后台挂起
|
||||
</button>
|
||||
)}
|
||||
{headerRightSlot}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -555,7 +600,12 @@ export function Step2Panel(props: Step2PanelProps) {
|
||||
// 另一轴会被计算成 auto,任何子元素溢出一两像素都会让整列横向可滚 → 鼠标移到右侧
|
||||
// 竖滚条滑块时极易误触发横向拖动、抓不住滑块。宽内容(代码块/表格)在各自气泡内
|
||||
// 已有 max-w-full + overflow-x-auto 自带横滚,故此处裁掉横向不影响查看。
|
||||
className="flex-1 min-h-0 overflow-y-auto overflow-x-hidden p-6 space-y-4 bg-white border-t border-slate-150 border-b border-slate-150 shadow-inner"
|
||||
className={cn(
|
||||
"flex-1 min-h-0 overflow-y-auto overflow-x-hidden p-6 space-y-4",
|
||||
useStep1InputAppearance
|
||||
? "eightbf-roundtable-step2-log"
|
||||
: "bg-white border-t border-slate-150 border-b border-slate-150 shadow-inner",
|
||||
)}
|
||||
>
|
||||
{isInitializing && step2RoundtableDialogues.length === 0 && (
|
||||
<div className="flex h-full flex-col items-center justify-center gap-3 py-12 text-slate-500">
|
||||
@@ -591,6 +641,7 @@ export function Step2Panel(props: Step2PanelProps) {
|
||||
onFileCardClick={(path) => {
|
||||
if (msg.agentThreadId) openArtifactPreview(msg.agentThreadId, path);
|
||||
}}
|
||||
taskArtifactSubmission={taskArtifactSubmission}
|
||||
/>
|
||||
) : (
|
||||
<div className="py-6 text-center text-xs text-slate-400">
|
||||
@@ -647,13 +698,19 @@ export function Step2Panel(props: Step2PanelProps) {
|
||||
openArtifactPreview(msg.agentThreadId, path);
|
||||
}
|
||||
}}
|
||||
taskArtifactSubmission={taskArtifactSubmission}
|
||||
/>
|
||||
))
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{!step2AtBottom && <ScrollToBottomButton onClick={scrollStep2ToBottom} />}
|
||||
{!step2AtBottom && (
|
||||
<ScrollToBottomButton
|
||||
onClick={scrollStep2ToBottom}
|
||||
className="!bottom-1/2 translate-y-1/2"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Clarification card */}
|
||||
@@ -730,92 +787,71 @@ export function Step2Panel(props: Step2PanelProps) {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Console + intervention bar */}
|
||||
<div className="shrink-0 p-4 bg-slate-50 border-t border-slate-100 flex flex-col gap-2">
|
||||
{/* 已选附件预览(点「干预并发送」时随指令上传) */}
|
||||
{injectFiles.length > 0 && (
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{injectFiles.map((file, idx) => (
|
||||
<span
|
||||
key={`${file.name}-${file.size}-${idx}`}
|
||||
className="inline-flex items-center gap-1.5 bg-white border border-slate-200 rounded-lg pl-2 pr-1 py-1 text-[11px] text-slate-600 max-w-[200px]"
|
||||
{useStep1InputAppearance ? (
|
||||
/* 8BF 直接复用第一步 PositionIntentInput 的 DOM、图标和深蓝框体;仅替换成会商干预的状态与动作。 */
|
||||
<div className="position-roundtable-intent-page eightbf-roundtable-step2-input [&_#suggest-followup-btn]:hidden [&_#skip-question-btn]:hidden [&_#save-draft-btn]:hidden">
|
||||
<PositionIntentInput
|
||||
value={customAgentInput}
|
||||
onValueChange={setCustomAgentInput}
|
||||
attachedFiles={injectFiles}
|
||||
onAddFiles={addInjectFiles}
|
||||
onRemoveFile={removeInjectFile}
|
||||
charactersLeft={Math.max(0, 500 - customAgentInput.length)}
|
||||
isSending={isStep2Responding}
|
||||
canSend={customAgentInput.trim().length > 0 || injectFiles.length > 0}
|
||||
pendingClarification={false}
|
||||
onSend={handleInject}
|
||||
onStop={onPauseRoundtable}
|
||||
onFollowUp={() => undefined}
|
||||
onSkip={() => undefined}
|
||||
onEnterRoundtable={() => undefined}
|
||||
enterButtonLabel=""
|
||||
intentReady={null}
|
||||
hideEnterRoundtable
|
||||
onManualSave={() => undefined}
|
||||
onTriggerToast={() => undefined}
|
||||
modelOptions={availableModels.map((model) => ({
|
||||
label: model.display_name && model.display_name !== model.name
|
||||
? `${model.display_name} (${model.name})`
|
||||
: model.name,
|
||||
value: model.name,
|
||||
}))}
|
||||
selectedModel={selectedModel}
|
||||
onSelectedModelChange={setSelectedModel}
|
||||
footerAction={(
|
||||
/* 与第一步「确认意图并启动业务链」复用相同的稳定 id 和样式规则。 */
|
||||
<button
|
||||
id="enter-roundtable-btn"
|
||||
type="button"
|
||||
onClick={onProceedToStep3}
|
||||
disabled={!hasConsensus}
|
||||
aria-disabled={!hasConsensus}
|
||||
title={hasConsensus ? undefined : "圆桌尚未达成共识,请等待总控自然收敛"}
|
||||
className={cn(
|
||||
"flex h-10 shrink-0 items-center gap-1.5 rounded-[4px] px-3 text-xs font-black transition active:scale-[0.98] shadow-md shadow-emerald-500/10",
|
||||
hasConsensus
|
||||
? "cursor-pointer bg-emerald-600 text-white hover:bg-emerald-700"
|
||||
: "cursor-not-allowed bg-emerald-600/40 text-white",
|
||||
)}
|
||||
>
|
||||
<FileIcon className="w-3 h-3 shrink-0 text-primary" />
|
||||
<span className="truncate font-medium" title={file.name}>
|
||||
{file.name}
|
||||
</span>
|
||||
<span className="shrink-0 text-slate-400">
|
||||
{formatFileSize(file.size)}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => removeInjectFile(idx)}
|
||||
className="shrink-0 p-0.5 rounded hover:bg-slate-200 text-slate-400 hover:text-slate-600 transition"
|
||||
title="移除"
|
||||
>
|
||||
<X className="w-3 h-3" />
|
||||
</button>
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
<div className="flex items-end gap-3">
|
||||
<AutoGrowTextarea
|
||||
value={customAgentInput}
|
||||
onChange={(e) => setCustomAgentInput(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter" && !e.shiftKey) {
|
||||
e.preventDefault();
|
||||
handleInject();
|
||||
}
|
||||
}}
|
||||
placeholder="作为指挥官,您可以随时插话输入指令,对智能体博弈朝向实施人工干预...(Enter 发送 / Shift+Enter 换行)"
|
||||
className="flex-1 bg-white border border-slate-200 rounded-xl px-3.5 py-2.5 text-xs leading-relaxed focus:outline-none focus:border-primary focus:ring-1 focus:ring-[var(--brand-200)]/50 font-medium"
|
||||
maxHeight={280}
|
||||
/>
|
||||
|
||||
<input
|
||||
ref={injectFileInputRef}
|
||||
type="file"
|
||||
multiple
|
||||
className="hidden"
|
||||
onChange={handlePickInjectFiles}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => injectFileInputRef.current?.click()}
|
||||
title="上传参考文件(席位/总控将读取文件内容辅助研讨)"
|
||||
className="bg-white border border-slate-200 hover:bg-slate-50 text-slate-500 hover:text-primary p-2.5 rounded-xl transition shrink-0 cursor-pointer active:scale-95"
|
||||
>
|
||||
<Paperclip className="w-4 h-4" />
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleInject}
|
||||
title="记录干预指令并立即恢复会商执行"
|
||||
className="bg-primary hover:bg-[var(--brand-900)] text-white text-xs font-bold px-4 py-2.5 rounded-xl transition shrink-0 cursor-pointer active:scale-95 shadow-md shadow-primary/10"
|
||||
>
|
||||
干预并发送
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={onProceedToStep3}
|
||||
disabled={!hasConsensus}
|
||||
aria-disabled={!hasConsensus}
|
||||
title={hasConsensus ? undefined : "圆桌尚未达成共识,请等待总控自然收敛"}
|
||||
className={`text-xs font-black px-4 py-2.5 rounded-xl transition shrink-0 flex items-center gap-1 active:scale-95 shadow-md shadow-emerald-500/10 ${
|
||||
hasConsensus
|
||||
? "bg-emerald-600 hover:bg-emerald-700 text-white cursor-pointer"
|
||||
: "bg-emerald-600/40 text-white cursor-not-allowed"
|
||||
}`}
|
||||
>
|
||||
<Sparkles className="w-3.5 h-3.5 text-emerald-100" />
|
||||
达成共识生成全案成果 >
|
||||
</button>
|
||||
<Sparkles className="size-3.5 text-emerald-100" />
|
||||
达成共识生成全案成果 >
|
||||
</button>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<Step2LegacyComposer
|
||||
value={customAgentInput}
|
||||
onValueChange={setCustomAgentInput}
|
||||
files={injectFiles}
|
||||
onAddFiles={addInjectFiles}
|
||||
onRemoveFile={removeInjectFile}
|
||||
onSend={handleInject}
|
||||
hasConsensus={hasConsensus}
|
||||
onProceed={onProceedToStep3}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -828,12 +864,129 @@ export function Step2Panel(props: Step2PanelProps) {
|
||||
activeThreadId={activeArtifactThreadId}
|
||||
isStreaming={isSandboxStreaming}
|
||||
seatMessages={activeSeatMessages}
|
||||
taskArtifactSubmission={taskArtifactSubmission}
|
||||
>
|
||||
<div className="flex h-full min-h-0 flex-col bg-slate-50/20">{chatBody}</div>
|
||||
<div
|
||||
className={cn(
|
||||
"flex h-full min-h-0 flex-col",
|
||||
useStep1InputAppearance
|
||||
? "position-roundtable-intent-panel eightbf-roundtable-intent-panel eightbf-roundtable-step2-chat"
|
||||
: "bg-slate-50/20",
|
||||
)}
|
||||
>
|
||||
{chatBody}
|
||||
</div>
|
||||
</Step2SandboxLayout>
|
||||
);
|
||||
}
|
||||
|
||||
/** 原通用会商的输入区。8BF 使用第一步复用组件时,其他会商页面保持此既有结构。 */
|
||||
function Step2LegacyComposer({
|
||||
value,
|
||||
onValueChange,
|
||||
files,
|
||||
onAddFiles,
|
||||
onRemoveFile,
|
||||
onSend,
|
||||
hasConsensus,
|
||||
onProceed,
|
||||
}: {
|
||||
value: string;
|
||||
onValueChange: React.Dispatch<React.SetStateAction<string>>;
|
||||
files: File[];
|
||||
onAddFiles: (files: File[]) => void;
|
||||
onRemoveFile: (index: number) => void;
|
||||
onSend: () => void;
|
||||
hasConsensus: boolean;
|
||||
onProceed: () => void;
|
||||
}) {
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
return (
|
||||
<div className="shrink-0 flex flex-col gap-2 border-t border-slate-100 bg-slate-50 p-4">
|
||||
{files.length > 0 && (
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{files.map((file, index) => (
|
||||
<span
|
||||
key={`${file.name}-${file.size}-${index}`}
|
||||
className="inline-flex max-w-[200px] items-center gap-1.5 rounded-lg border border-slate-200 bg-white py-1 pl-2 pr-1 text-[11px] text-slate-600"
|
||||
>
|
||||
<FileIcon className="size-3 shrink-0 text-primary" />
|
||||
<span className="truncate font-medium" title={file.name}>{file.name}</span>
|
||||
<span className="shrink-0 text-slate-400">{formatFileSize(file.size)}</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => onRemoveFile(index)}
|
||||
className="shrink-0 rounded p-0.5 text-slate-400 transition hover:bg-slate-200 hover:text-slate-600"
|
||||
title="移除"
|
||||
>
|
||||
<X className="size-3" />
|
||||
</button>
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
<div className="flex items-end gap-3">
|
||||
<AutoGrowTextarea
|
||||
value={value}
|
||||
onChange={(event) => onValueChange(event.target.value)}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === "Enter" && !event.shiftKey) {
|
||||
event.preventDefault();
|
||||
onSend();
|
||||
}
|
||||
}}
|
||||
placeholder="作为指挥官,您可以随时插话输入指令,对智能体博弈朝向实施人工干预...(Enter 发送 / Shift+Enter 换行)"
|
||||
className="min-h-[48px] flex-1 rounded-xl border border-slate-200 bg-white px-3.5 py-2.5 text-xs font-medium leading-relaxed focus:border-primary focus:outline-none focus:ring-1 focus:ring-[var(--brand-200)]/50"
|
||||
maxHeight={280}
|
||||
/>
|
||||
<input
|
||||
ref={fileInputRef}
|
||||
type="file"
|
||||
multiple
|
||||
className="hidden"
|
||||
onChange={(event) => {
|
||||
onAddFiles(Array.from(event.target.files ?? []));
|
||||
event.target.value = "";
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => fileInputRef.current?.click()}
|
||||
title="上传参考文件(席位/总控将读取文件内容辅助研讨)"
|
||||
className="shrink-0 cursor-pointer rounded-xl border border-slate-200 bg-white p-2.5 text-slate-500 transition hover:bg-slate-50 hover:text-primary active:scale-95"
|
||||
>
|
||||
<Paperclip className="size-4" />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onSend}
|
||||
title="记录干预指令并立即恢复会商执行"
|
||||
className="shrink-0 cursor-pointer rounded-xl bg-primary px-4 py-2.5 text-xs font-bold text-white shadow-md shadow-primary/10 transition hover:bg-[var(--brand-900)] active:scale-95"
|
||||
>
|
||||
干预并发送
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onProceed}
|
||||
disabled={!hasConsensus}
|
||||
aria-disabled={!hasConsensus}
|
||||
title={hasConsensus ? undefined : "圆桌尚未达成共识,请等待总控自然收敛"}
|
||||
className={cn(
|
||||
"flex shrink-0 items-center gap-1 rounded-xl px-4 py-2.5 text-xs font-black shadow-md shadow-emerald-500/10 transition active:scale-95",
|
||||
hasConsensus
|
||||
? "cursor-pointer bg-emerald-600 text-white hover:bg-emerald-700"
|
||||
: "cursor-not-allowed bg-emerald-600/40 text-white",
|
||||
)}
|
||||
>
|
||||
<Sparkles className="size-3.5 text-emerald-100" />
|
||||
达成共识生成全案成果 >
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 单条 Step 2 对话气泡。包含:
|
||||
* - ChainOfThought 折叠卡(若 msg.steps 非空)
|
||||
@@ -863,6 +1016,7 @@ export interface Step2MessageProps {
|
||||
) => void;
|
||||
/** 点击气泡下方 `present_files` 文件卡时打开沙箱(走真实 HTTP 路径)。 */
|
||||
onFileCardClick?: (path: string) => void;
|
||||
taskArtifactSubmission?: TaskArtifactSubmissionController;
|
||||
}
|
||||
|
||||
export function Step2Message({
|
||||
@@ -873,6 +1027,7 @@ export function Step2Message({
|
||||
resolveAgentName,
|
||||
onArtifactStepClick,
|
||||
onFileCardClick,
|
||||
taskArtifactSubmission,
|
||||
}: Step2MessageProps) {
|
||||
const isInjected = msg.sender === "用户 (插话干预)";
|
||||
const isStreaming = msg.streaming === true;
|
||||
@@ -951,6 +1106,8 @@ export function Step2Message({
|
||||
files={presentedFiles}
|
||||
onClick={onFileCardClick}
|
||||
disabled={!msg.agentThreadId}
|
||||
threadId={msg.agentThreadId}
|
||||
taskArtifactSubmission={taskArtifactSubmission}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -1016,10 +1173,14 @@ function PresentFilesRow({
|
||||
files,
|
||||
onClick,
|
||||
disabled,
|
||||
threadId,
|
||||
taskArtifactSubmission,
|
||||
}: {
|
||||
files: string[];
|
||||
onClick?: (path: string) => void;
|
||||
disabled: boolean;
|
||||
threadId?: string;
|
||||
taskArtifactSubmission?: TaskArtifactSubmissionController;
|
||||
}) {
|
||||
return (
|
||||
<div className="mt-2 flex min-w-0 flex-wrap gap-2">
|
||||
@@ -1029,6 +1190,12 @@ function PresentFilesRow({
|
||||
path={path}
|
||||
disabled={disabled || !onClick}
|
||||
onClick={() => onClick?.(path)}
|
||||
submitButton={threadId ? (
|
||||
<TaskArtifactSubmitButton
|
||||
controller={taskArtifactSubmission}
|
||||
target={taskArtifactSubmission?.targetFor({ threadId, path }) ?? { threadId, path }}
|
||||
/>
|
||||
) : null}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
@@ -1062,37 +1229,41 @@ function PresentFileCard({
|
||||
path,
|
||||
disabled,
|
||||
onClick,
|
||||
submitButton,
|
||||
}: {
|
||||
path: string;
|
||||
disabled: boolean;
|
||||
onClick: () => void;
|
||||
submitButton?: ReactNode;
|
||||
}) {
|
||||
const filename = path.split("/").pop() ?? path;
|
||||
const ext = filename.split(".").pop()?.toLowerCase() ?? "";
|
||||
const typeLabel = FILE_EXT_LABELS[ext] ?? (ext.toUpperCase() || "FILE");
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClick}
|
||||
disabled={disabled}
|
||||
title={disabled ? "席位线程未就绪,暂无法预览" : path}
|
||||
className="box-border flex w-[12.5rem] max-w-full min-w-0 flex-col gap-1 overflow-hidden rounded-lg border border-slate-200 bg-white p-3 text-left shadow-sm transition hover:border-primary/50 hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60"
|
||||
>
|
||||
<div className="flex min-w-0 items-start gap-2">
|
||||
<FileIcon className="mt-0.5 size-4 shrink-0 text-slate-400" />
|
||||
<span
|
||||
className="roundtable-chat-message min-w-0 flex-1 truncate font-medium text-slate-700"
|
||||
title={filename}
|
||||
>
|
||||
{filename}
|
||||
</span>
|
||||
</div>
|
||||
<div className="box-border flex w-[12.5rem] max-w-full min-w-0 flex-col gap-1 overflow-hidden rounded-lg border border-slate-200 bg-white p-3 text-left shadow-sm transition hover:border-primary/50 hover:bg-slate-50">
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClick}
|
||||
disabled={disabled}
|
||||
title={disabled ? "席位线程未就绪,暂无法预览" : path}
|
||||
className="flex min-w-0 flex-col gap-1 text-left disabled:cursor-not-allowed disabled:opacity-60"
|
||||
>
|
||||
<div className="flex min-w-0 items-start gap-2">
|
||||
<FileIcon className="mt-0.5 size-4 shrink-0 text-slate-400" />
|
||||
<span
|
||||
className="roundtable-chat-message min-w-0 flex-1 truncate font-medium text-slate-700"
|
||||
title={filename}
|
||||
>
|
||||
{filename}
|
||||
</span>
|
||||
</div>
|
||||
</button>
|
||||
<div className="flex min-w-0 items-center justify-between gap-2">
|
||||
<span className="roundtable-chat-meta rounded bg-slate-100 px-1.5 py-0.5 font-mono font-semibold text-slate-500">
|
||||
{typeLabel}
|
||||
</span>
|
||||
<span className="roundtable-chat-meta text-slate-400">点击预览</span>
|
||||
{submitButton}
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -24,9 +24,47 @@ import {
|
||||
import { ThreadContext } from "@/components/workspace/messages/context";
|
||||
import type { AgentThreadState } from "@/core/threads";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { TaskArtifactSubmitButton } from "@/roundtable-planning/components/TaskArtifactSubmitButton";
|
||||
import type { TaskArtifactSubmissionController } from "@/roundtable-planning/lib/task-artifact-submission";
|
||||
|
||||
const CLOSE_MODE = { chat: 100, artifacts: 0 };
|
||||
const OPEN_MODE = { chat: 60, artifacts: 40 };
|
||||
|
||||
/** 从 write_file 虚拟地址反查流式工具调用中的正文,供任务产物提交直接使用。 */
|
||||
function virtualMarkdownContent(
|
||||
artifact: string | null,
|
||||
messages: unknown[] | undefined,
|
||||
): string | undefined {
|
||||
if (!artifact?.startsWith("write-file:") || !messages?.length) return undefined;
|
||||
try {
|
||||
const url = new URL(artifact);
|
||||
const toolCallId = url.searchParams.get("tool_call_id");
|
||||
const path = decodeURIComponent(url.pathname).trim();
|
||||
for (const message of messages) {
|
||||
if (!message || typeof message !== "object") continue;
|
||||
const toolCalls = (message as { tool_calls?: unknown }).tool_calls;
|
||||
if (!Array.isArray(toolCalls)) continue;
|
||||
for (const call of toolCalls) {
|
||||
if (!call || typeof call !== "object") continue;
|
||||
const toolCall = call as {
|
||||
id?: unknown;
|
||||
name?: unknown;
|
||||
args?: { path?: unknown; content?: unknown };
|
||||
};
|
||||
if (toolCall.name !== "write_file") continue;
|
||||
if (toolCallId && toolCall.id !== toolCallId) continue;
|
||||
if (!toolCallId && toolCall.args?.path !== path) continue;
|
||||
return typeof toolCall.args?.content === "string"
|
||||
? toolCall.args.content
|
||||
: undefined;
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// 虚拟路径解析失败时交给提交层走它原有的真实文件读取兜底。
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
interface Step2SandboxLayoutProps {
|
||||
children?: React.ReactNode;
|
||||
/** 当前预览文件所属的席位 thread id。 */
|
||||
@@ -48,6 +86,8 @@ interface Step2SandboxLayoutProps {
|
||||
* 左侧消息列表保持可见;置空即恢复沙箱(文件预览/列表)。
|
||||
*/
|
||||
sidePanel?: React.ReactNode;
|
||||
/** 任务深链页面的 Markdown 过程产物提交能力。 */
|
||||
taskArtifactSubmission?: TaskArtifactSubmissionController;
|
||||
}
|
||||
|
||||
export function Step2SandboxLayout({
|
||||
@@ -58,6 +98,7 @@ export function Step2SandboxLayout({
|
||||
artifactsFill = false,
|
||||
onArtifactsClose,
|
||||
sidePanel,
|
||||
taskArtifactSubmission,
|
||||
}: Step2SandboxLayoutProps) {
|
||||
const layoutRef = useRef<GroupImperativeHandle>(null);
|
||||
const {
|
||||
@@ -68,6 +109,10 @@ export function Step2SandboxLayout({
|
||||
deselect,
|
||||
} = useArtifacts();
|
||||
const artifacts = rawArtifacts ?? [];
|
||||
const selectedArtifactContent = useMemo(
|
||||
() => virtualMarkdownContent(selectedArtifact, seatMessages),
|
||||
[selectedArtifact, seatMessages],
|
||||
);
|
||||
|
||||
const artifactPanelOpen = artifactsOpen;
|
||||
// sidePanel(流程图等)非空时即使沙箱没开也要把右栏撑开。
|
||||
@@ -115,9 +160,20 @@ export function Step2SandboxLayout({
|
||||
filepath={selectedArtifact}
|
||||
threadId={previewThreadId}
|
||||
onClose={artifactsFill && onArtifactsClose ? handleArtifactsClose : undefined}
|
||||
allowVirtualMarkdownEdit
|
||||
// 会商「消息列表沙箱」按需求不脱敏产物内容(用户要拿原始文件)。
|
||||
disableDesensitize
|
||||
headerLeadingActionBare
|
||||
headerLeadingAction={(
|
||||
<TaskArtifactSubmitButton
|
||||
compact
|
||||
controller={taskArtifactSubmission}
|
||||
target={taskArtifactSubmission?.targetFor({
|
||||
threadId: previewThreadId,
|
||||
path: selectedArtifact,
|
||||
content: selectedArtifactContent,
|
||||
}) ?? { threadId: previewThreadId, path: selectedArtifact }}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
) : (
|
||||
<div className="relative flex size-full justify-center">
|
||||
|
||||
@@ -20,8 +20,12 @@ import type { UseStep3SummaryReturn } from "@/roundtable-planning/hooks/useStep3
|
||||
import type { ThreadIdMap } from "@/roundtable-planning/api/multi-agent";
|
||||
import { stripReasoning } from "@/roundtable-planning/lib/reasoning";
|
||||
import { useMemo } from "react";
|
||||
import type { TaskArtifactSubmissionController } from "@/roundtable-planning/lib/task-artifact-submission";
|
||||
|
||||
export interface Step3PanelProps {
|
||||
/** 8BF 第三步对话区与第一、二步共用深蓝顶栏;默认不改变原会商。 */
|
||||
useStep1Chrome?: boolean;
|
||||
headerTitle?: string;
|
||||
threadIds: ThreadIdMap | null;
|
||||
coordinatorName: string | null;
|
||||
consensusText: string;
|
||||
@@ -54,10 +58,13 @@ export interface Step3PanelProps {
|
||||
/** Step 2 沙箱预览产出文件(与第二步相同)。 */
|
||||
openArtifactPreview: (threadId: string, path: string) => void;
|
||||
seatStubMessages: Record<string, unknown[]>;
|
||||
taskArtifactSubmission?: TaskArtifactSubmissionController;
|
||||
}
|
||||
|
||||
export function Step3Panel(props: Step3PanelProps) {
|
||||
const {
|
||||
useStep1Chrome = false,
|
||||
headerTitle,
|
||||
threadIds,
|
||||
coordinatorName,
|
||||
consensusText,
|
||||
@@ -80,6 +87,7 @@ export function Step3Panel(props: Step3PanelProps) {
|
||||
onReset,
|
||||
openArtifactPreview,
|
||||
seatStubMessages,
|
||||
taskArtifactSubmission,
|
||||
} = props;
|
||||
|
||||
const seatDeliveries = useMemo(
|
||||
@@ -105,6 +113,8 @@ export function Step3Panel(props: Step3PanelProps) {
|
||||
|
||||
return (
|
||||
<HighFidelityReport
|
||||
useStep1Chrome={useStep1Chrome}
|
||||
headerTitle={headerTitle}
|
||||
threadIds={threadIds}
|
||||
coordinatorName={coordinatorName}
|
||||
consensusText={consensusText}
|
||||
@@ -127,6 +137,7 @@ export function Step3Panel(props: Step3PanelProps) {
|
||||
onReset={onReset}
|
||||
openArtifactPreview={openArtifactPreview}
|
||||
seatStubMessages={seatStubMessages}
|
||||
taskArtifactSubmission={taskArtifactSubmission}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -45,6 +45,7 @@ import { ConsensusDocxDownloadButton } from "@/roundtable-planning/components/Co
|
||||
import { ScrollToBottomButton } from "@/roundtable-planning/components/ScrollToBottomButton";
|
||||
import { Step2Message } from "@/roundtable-planning/components/Step2Panel";
|
||||
import { Step2SandboxLayout } from "@/roundtable-planning/components/Step2SandboxLayout";
|
||||
import { TaskArtifactSubmitButton } from "@/roundtable-planning/components/TaskArtifactSubmitButton";
|
||||
import { desensitize } from "@/lib/desensitize";
|
||||
import { markdownComponents } from "@/roundtable-planning/components/markdown-components";
|
||||
import type { DraftStep3Snapshot } from "@/roundtable-planning/api/drafts";
|
||||
@@ -57,6 +58,7 @@ import type {
|
||||
ReportIntent,
|
||||
UseStep3ReportReturn,
|
||||
} from "@/roundtable-planning/hooks/useStep3Report";
|
||||
import type { TaskArtifactSubmissionController } from "@/roundtable-planning/lib/task-artifact-submission";
|
||||
|
||||
interface SeatDelivery {
|
||||
sender: string;
|
||||
@@ -88,6 +90,7 @@ interface Step3ReportModeProps {
|
||||
/** 页面层常驻的大屏多页流(模式二)。 */
|
||||
dashboard: UseStep3DashboardReturn;
|
||||
onBack: () => void;
|
||||
taskArtifactSubmission?: TaskArtifactSubmissionController;
|
||||
}
|
||||
|
||||
type SourceModal = "consensus" | "seats" | "files" | null;
|
||||
@@ -108,6 +111,7 @@ export function Step3ReportMode({
|
||||
report,
|
||||
dashboard,
|
||||
onBack,
|
||||
taskArtifactSubmission,
|
||||
}: Step3ReportModeProps) {
|
||||
const reportSeatDeliveries = useMemo(
|
||||
() => seatDeliveries.map((d) => ({ sender: d.sender, content: d.content })),
|
||||
@@ -376,6 +380,7 @@ export function Step3ReportMode({
|
||||
activeThreadId={activeArtifactThreadId ?? reportThreadId}
|
||||
isStreaming={isStreaming}
|
||||
seatMessages={activeSeatMessages}
|
||||
taskArtifactSubmission={taskArtifactSubmission}
|
||||
>
|
||||
<AgentProgressPanel
|
||||
phase={phase}
|
||||
@@ -390,6 +395,7 @@ export function Step3ReportMode({
|
||||
availableModels={availableModels}
|
||||
modelsLoading={modelsLoading}
|
||||
setSelectedModel={setSelectedModel}
|
||||
taskArtifactSubmission={taskArtifactSubmission}
|
||||
/>
|
||||
</Step2SandboxLayout>
|
||||
</section>
|
||||
@@ -428,6 +434,7 @@ export function Step3ReportMode({
|
||||
threadIds={threadIds}
|
||||
coordinatorName={coordinatorName}
|
||||
seatNameMap={seatNameMap}
|
||||
taskArtifactSubmission={taskArtifactSubmission}
|
||||
onClose={() => setModal(null)}
|
||||
/>
|
||||
)}
|
||||
@@ -513,6 +520,7 @@ function AgentProgressPanel({
|
||||
availableModels,
|
||||
modelsLoading,
|
||||
setSelectedModel,
|
||||
taskArtifactSubmission,
|
||||
}: {
|
||||
phase: UseStep3ReportReturn["phase"];
|
||||
dialogues: UseStep3ReportReturn["dialogues"];
|
||||
@@ -526,6 +534,7 @@ function AgentProgressPanel({
|
||||
availableModels: ReadonlyArray<ModelOption>;
|
||||
modelsLoading: boolean;
|
||||
setSelectedModel: (model: string) => void;
|
||||
taskArtifactSubmission?: TaskArtifactSubmissionController;
|
||||
}) {
|
||||
const busy = phase === "creating" || phase === "streaming";
|
||||
// 只有「正在建线程」时锁输入(线程没建好没法插话);绘制中允许输入并发送——
|
||||
@@ -610,6 +619,7 @@ function AgentProgressPanel({
|
||||
onFileCardClick={(path) => {
|
||||
if (msg.agentThreadId) onArtifactPreview(msg.agentThreadId, path);
|
||||
}}
|
||||
taskArtifactSubmission={taskArtifactSubmission}
|
||||
/>
|
||||
))}
|
||||
|
||||
@@ -822,11 +832,13 @@ function SeatFilesModal({
|
||||
threadIds,
|
||||
coordinatorName,
|
||||
seatNameMap,
|
||||
taskArtifactSubmission,
|
||||
onClose,
|
||||
}: {
|
||||
threadIds: ThreadIdMap | null;
|
||||
coordinatorName: string | null;
|
||||
seatNameMap: Record<string, string>;
|
||||
taskArtifactSubmission?: TaskArtifactSubmissionController;
|
||||
onClose: () => void;
|
||||
}) {
|
||||
const seatEntries = useMemo(() => {
|
||||
@@ -932,6 +944,25 @@ function SeatFilesModal({
|
||||
</div>
|
||||
<div className="flex items-center gap-2 shrink-0">
|
||||
<span className="text-[10px] font-mono text-slate-400">{formatBytes(f.sizeBytes)}</span>
|
||||
<TaskArtifactSubmitButton
|
||||
compact
|
||||
controller={taskArtifactSubmission}
|
||||
target={taskArtifactSubmission?.targetFor({
|
||||
threadId: seat.threadId,
|
||||
path: f.path,
|
||||
name: f.name,
|
||||
mimeType: f.mimeType,
|
||||
agentId: seat.agentName,
|
||||
agentName: seat.displayName,
|
||||
}) ?? {
|
||||
threadId: seat.threadId,
|
||||
path: f.path,
|
||||
name: f.name,
|
||||
mimeType: f.mimeType,
|
||||
agentId: seat.agentName,
|
||||
agentName: seat.displayName,
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => handlePreview(seat.threadId, f)}
|
||||
|
||||
@@ -14,9 +14,7 @@ import { createPortal } from "react-dom";
|
||||
import ReactMarkdown from "react-markdown";
|
||||
import remarkGfm from "remark-gfm";
|
||||
import {
|
||||
ArrowRight,
|
||||
CheckCircle,
|
||||
Database,
|
||||
Download,
|
||||
Eye,
|
||||
FileText,
|
||||
@@ -28,7 +26,6 @@ import {
|
||||
RefreshCw,
|
||||
SendHorizontal,
|
||||
Sparkles,
|
||||
Workflow,
|
||||
X,
|
||||
} from "lucide-react";
|
||||
|
||||
@@ -36,6 +33,7 @@ import { AutoGrowTextarea } from "@/components/ui/auto-grow-textarea";
|
||||
import { useArtifacts } from "@/components/workspace/artifacts";
|
||||
import { useLocalSettings } from "@/core/settings";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { PositionIntentInput } from "@/position-roundtable/components/PositionIntentInput";
|
||||
import {
|
||||
buildArtifactDownloadUrl,
|
||||
listSessionArtifacts,
|
||||
@@ -44,15 +42,10 @@ import {
|
||||
} from "@/roundtable-planning/api/multi-agent";
|
||||
import { ArtifactPreviewModal } from "@/roundtable-planning/components/ArtifactPreviewModal";
|
||||
import { ConsensusDocxDownloadButton } from "@/roundtable-planning/components/ConsensusDocxDownloadButton";
|
||||
import { FlowGraphPanel } from "@/roundtable-planning/components/FlowGraphPanel";
|
||||
import {
|
||||
detectFlowIntent,
|
||||
extractFlowGraph,
|
||||
FLOW_FENCE_OPEN,
|
||||
} from "@/roundtable-planning/lib/flow-graph";
|
||||
import { ScrollToBottomButton } from "@/roundtable-planning/components/ScrollToBottomButton";
|
||||
import { Step2Message } from "@/roundtable-planning/components/Step2Panel";
|
||||
import { Step2SandboxLayout } from "@/roundtable-planning/components/Step2SandboxLayout";
|
||||
import { TaskArtifactSubmitButton } from "@/roundtable-planning/components/TaskArtifactSubmitButton";
|
||||
import { desensitize } from "@/lib/desensitize";
|
||||
import { markdownComponents } from "@/roundtable-planning/components/markdown-components";
|
||||
import type { ModelOption } from "@/roundtable-planning/components/Step3ReportMode";
|
||||
@@ -61,6 +54,7 @@ import { useAutoScroll } from "@/roundtable-planning/hooks/useAutoScroll";
|
||||
import { useDialogueSpeedMetrics } from "@/roundtable-planning/hooks/useDialogueSpeedMetrics";
|
||||
import { useStep3Summary, type UseStep3SummaryReturn } from "@/roundtable-planning/hooks/useStep3Summary";
|
||||
import type { ReportIntent } from "@/roundtable-planning/hooks/useStep3Report";
|
||||
import type { TaskArtifactSubmissionController } from "@/roundtable-planning/lib/task-artifact-submission";
|
||||
|
||||
interface SeatDelivery {
|
||||
sender: string;
|
||||
@@ -69,6 +63,8 @@ interface SeatDelivery {
|
||||
}
|
||||
|
||||
interface Step3SummaryModeProps {
|
||||
useStep1Chrome?: boolean;
|
||||
headerTitle?: string;
|
||||
threadIds: ThreadIdMap | null;
|
||||
coordinatorName: string | null;
|
||||
consensusText: string;
|
||||
@@ -78,7 +74,6 @@ interface Step3SummaryModeProps {
|
||||
intentReady: ReportIntent | null;
|
||||
selectedModel: string;
|
||||
availableModels: ReadonlyArray<ModelOption>;
|
||||
modelsLoading: boolean;
|
||||
setSelectedModel: (model: string) => void;
|
||||
/** 业务链写给总控的编排提示 —— 注入总结智能体作为最高优先级口径。 */
|
||||
coordinatorPrompt?: string | null;
|
||||
@@ -86,13 +81,14 @@ interface Step3SummaryModeProps {
|
||||
savedSummary?: DraftStep3SummarySnapshot | null;
|
||||
/** 页面层常驻的总结生成流(2026-06-13 提升:切走不断流,进入本视图续看)。 */
|
||||
summary: UseStep3SummaryReturn;
|
||||
/** 切到「最终方案展示」静态页(次要入口)。 */
|
||||
onViewStatic: () => void;
|
||||
taskArtifactSubmission?: TaskArtifactSubmissionController;
|
||||
}
|
||||
|
||||
type SourceModal = "consensus" | "seats" | "files" | null;
|
||||
|
||||
export function Step3SummaryMode({
|
||||
useStep1Chrome = false,
|
||||
headerTitle,
|
||||
threadIds,
|
||||
coordinatorName,
|
||||
consensusText,
|
||||
@@ -102,12 +98,11 @@ export function Step3SummaryMode({
|
||||
intentReady,
|
||||
selectedModel,
|
||||
availableModels,
|
||||
modelsLoading,
|
||||
setSelectedModel,
|
||||
coordinatorPrompt,
|
||||
savedSummary,
|
||||
summary,
|
||||
onViewStatic,
|
||||
taskArtifactSubmission,
|
||||
}: Step3SummaryModeProps) {
|
||||
void coordinatorPrompt; // 选项已随 hook 提升到页面层,这里仅保留 prop 兼容
|
||||
|
||||
@@ -140,42 +135,7 @@ export function Step3SummaryMode({
|
||||
|
||||
const { open: artifactsOpen } = useArtifacts();
|
||||
|
||||
// ── 结构化流程图(Phase 1:后端「抽取+校验」)────────────────────────────
|
||||
// 数据来源优先级:
|
||||
// · flowPhase==="done" → 用后端校验后的结构化图 summary.flowGraph 绘制;
|
||||
// · 抽取/校验进行中 → 不画(用户看对话气泡里实时滚动的 JSON + 状态条),等校验完成再绘制;
|
||||
// · idle/error → 回退到对话气泡里解析 flow-json(手动 flow 续问路径 / 旧逻辑兜底)。
|
||||
const flowGraph = useMemo(() => {
|
||||
if (summary.flowPhase === "done" && summary.flowGraph) {
|
||||
return { graph: summary.flowGraph, streaming: false };
|
||||
}
|
||||
if (summary.flowPhase === "extracting" || summary.flowPhase === "validating") {
|
||||
return null;
|
||||
}
|
||||
for (let i = dialogues.length - 1; i >= 0; i--) {
|
||||
const d = dialogues[i];
|
||||
if (d.avatarType === "human") continue;
|
||||
const content = d.content ?? "";
|
||||
if (!content.includes(FLOW_FENCE_OPEN)) continue;
|
||||
const graph = extractFlowGraph(content);
|
||||
if (graph) return { graph, streaming: d.streaming === true };
|
||||
}
|
||||
return null;
|
||||
}, [dialogues, summary.flowPhase, summary.flowGraph]);
|
||||
|
||||
const [flowView, setFlowView] = useState(false);
|
||||
const flowAutoOpenedRef = useRef(false);
|
||||
useEffect(() => {
|
||||
if (!flowGraph || flowGraph.graph.nodes.length === 0) return;
|
||||
if (flowAutoOpenedRef.current) return;
|
||||
flowAutoOpenedRef.current = true;
|
||||
// taskId/深链模式:结构化输出是本模式的主交付 → 流程图一出现就自动聚焦画布
|
||||
// (即便此前 md 沙箱已自动打开,也切到流程图)。
|
||||
// 普通模式:没开沙箱才自动打开;沙箱开着不抢占,只露出切换按钮。
|
||||
if (summary.autoFlow || !artifactsOpen) setFlowView(true);
|
||||
}, [flowGraph, artifactsOpen, summary.autoFlow]);
|
||||
|
||||
// 沙箱里已写出的 md 报告(流程图画布上提供「MD 报告」切回按钮的锚点)。
|
||||
// 沙箱里已写出的 Markdown 总结报告。
|
||||
const mdArtifact = useMemo(() => {
|
||||
for (const [threadId, msgs] of Object.entries(seatStubMessages)) {
|
||||
const msg = msgs?.[0];
|
||||
@@ -196,25 +156,16 @@ export function Step3SummaryMode({
|
||||
return null;
|
||||
}, [seatStubMessages]);
|
||||
|
||||
// 用户在输入框里明确要求结构化输出/流程图 → 立即切到流程图画布(旧图先顶着,
|
||||
// 新 flow-json 流出来就增量重绘;首次还没有图时画布在数据到达后自动渲染)。
|
||||
const handleAsk = (message: string, files?: File[]) => {
|
||||
if (detectFlowIntent(message)) {
|
||||
flowAutoOpenedRef.current = true;
|
||||
setFlowView(true);
|
||||
}
|
||||
ask(message, files);
|
||||
};
|
||||
const handleAsk = (message: string, files?: File[]) => ask(message, files);
|
||||
|
||||
// 流程图抽取/校验的过程(思考 `<think>` + 文字说明 + flow-json 代码块)全部原样交给
|
||||
// Step2Message 渲染:它用 splitInlineReasoning 把思考折叠成思考块、其余按 markdown 渲染
|
||||
// (flow-json 显示为代码块)。用户要求显示完整过程、不只显示代码块,故不再 strip。
|
||||
// 报告生成过程(思考、文字说明、文件写入步骤)交由 Step2Message 原样渲染,
|
||||
// 保持与第二步一致的流式过程可见性。
|
||||
const displayDialogues = dialogues;
|
||||
const [leftCollapsed, setLeftCollapsed] = useState(false);
|
||||
// 右侧面板(沙箱预览或流程图画布)露出时自动收起左栏,关闭时复原——边沿触发,手动切换不回弹。
|
||||
// 右侧沙箱露出时自动收起左栏,关闭时复原——边沿触发,手动切换不回弹。
|
||||
// 初值固定为 false:这样即使「进入/续看时沙箱已是打开态」(rightPanelVisible 一上来就为 true),
|
||||
// 首个 effect 也能识别 false→true 的边沿并收起左栏(修此前已打开时左栏不收起的问题)。
|
||||
const rightPanelVisible = artifactsOpen || (!!flowGraph && flowView);
|
||||
const rightPanelVisible = artifactsOpen;
|
||||
const prevRightPanelVisibleRef = useRef(false);
|
||||
useEffect(() => {
|
||||
if (rightPanelVisible !== prevRightPanelVisibleRef.current) {
|
||||
@@ -257,54 +208,53 @@ export function Step3SummaryMode({
|
||||
? "正在初始化总结线程…"
|
||||
: phase === "streaming"
|
||||
? "方案总结报告智能体撰写中…"
|
||||
: phase === "done"
|
||||
? "总结完成"
|
||||
: phase === "error"
|
||||
? "总结失败"
|
||||
: "待总结";
|
||||
: phase === "paused"
|
||||
? "已暂停"
|
||||
: phase === "done"
|
||||
? "总结完成"
|
||||
: phase === "error"
|
||||
? "总结失败"
|
||||
: "待总结";
|
||||
|
||||
return (
|
||||
<div className="flex h-full min-h-0 flex-col text-slate-800">
|
||||
{/* 顶栏 */}
|
||||
<div className="shrink-0 flex items-center justify-between gap-3 border-b border-slate-100 bg-gradient-to-r from-slate-50 to-white px-6 py-3.5 flex-wrap">
|
||||
<div className="flex items-center gap-2.5">
|
||||
<Sparkles className="w-5 h-5 text-primary" />
|
||||
<h3 className="text-sm font-black text-slate-900 tracking-tight">方案总结 · 报告</h3>
|
||||
<span className="inline-flex items-center gap-1.5 text-[10px] font-bold text-primary bg-[var(--brand-200)]/60 border border-red-200/50 px-2 py-0.5 rounded-full">
|
||||
{(phase === "creating" || phase === "streaming") && (
|
||||
<Loader2 className="w-3 h-3 animate-spin" />
|
||||
)}
|
||||
{phase === "done" && <CheckCircle className="w-3 h-3 text-emerald-600" />}
|
||||
{statusLabel}
|
||||
</span>
|
||||
{/* 顶栏。8BF 改走对话区内的第一步同款顶栏,这里不再套一层。 */}
|
||||
{!useStep1Chrome && (
|
||||
<div className="shrink-0 flex items-center justify-between gap-3 border-b border-slate-100 bg-gradient-to-r from-slate-50 to-white px-6 py-3.5 flex-wrap">
|
||||
<div className="flex items-center gap-2.5">
|
||||
<Sparkles className="w-5 h-5 text-primary" />
|
||||
<h3 className="text-sm font-black text-slate-900 tracking-tight">方案总结 · 报告</h3>
|
||||
<span className="inline-flex items-center gap-1.5 text-[10px] font-bold text-primary bg-[var(--brand-200)]/60 border border-red-200/50 px-2 py-0.5 rounded-full">
|
||||
{(phase === "creating" || phase === "streaming") && (
|
||||
<Loader2 className="w-3 h-3 animate-spin" />
|
||||
)}
|
||||
{phase === "paused" && <Pause className="w-3 h-3 text-amber-600" />}
|
||||
{phase === "done" && <CheckCircle className="w-3 h-3 text-emerald-600" />}
|
||||
{statusLabel}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => redraw()}
|
||||
disabled={phase === "creating" || phase === "streaming"}
|
||||
className="bg-white border border-slate-200 text-slate-700 hover:bg-slate-50 disabled:opacity-50 disabled:cursor-not-allowed text-[10.5px] font-bold px-3 py-1.5 rounded-xl flex items-center gap-1 transition"
|
||||
>
|
||||
<RefreshCw className="w-3.5 h-3.5 text-slate-500" />
|
||||
重新生成
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => redraw()}
|
||||
disabled={phase === "creating" || phase === "streaming"}
|
||||
className="bg-white border border-slate-200 text-slate-700 hover:bg-slate-50 disabled:opacity-50 disabled:cursor-not-allowed text-[10.5px] font-bold px-3 py-1.5 rounded-xl flex items-center gap-1 transition"
|
||||
>
|
||||
<RefreshCw className="w-3.5 h-3.5 text-slate-500" />
|
||||
重新生成
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onViewStatic}
|
||||
className="bg-white border border-slate-200 text-slate-700 hover:bg-slate-50 text-[10.5px] font-bold px-3 py-1.5 rounded-xl flex items-center gap-1 transition"
|
||||
>
|
||||
最终方案展示
|
||||
<ArrowRight className="w-3.5 h-3.5 text-slate-500" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 主体:左源卡 + 右沙箱 */}
|
||||
<div className="flex-1 min-h-0 flex gap-3 p-3">
|
||||
{/* 主体:左源卡 + 右沙箱。8BF 左栏改用第一步任务/意图区,这里只留对话面板。 */}
|
||||
<div className={cn("flex-1 min-h-0 flex", !useStep1Chrome && "gap-3 p-3")}>
|
||||
{!useStep1Chrome && (
|
||||
<aside
|
||||
data-step3-source-panel
|
||||
className={cn(
|
||||
"shrink-0 flex flex-col gap-3 overflow-y-auto pr-0.5 transition-[width] duration-200 ease-out",
|
||||
leftCollapsed ? "w-[52px]" : "w-[280px]",
|
||||
"eightbf-roundtable__step3-source-panel shrink-0 flex flex-col gap-3 overflow-y-auto pr-0.5 transition-[width] duration-200 ease-out",
|
||||
leftCollapsed ? "w-[80px]" : "w-[280px]",
|
||||
)}
|
||||
>
|
||||
{leftCollapsed ? (
|
||||
@@ -314,7 +264,7 @@ export function Step3SummaryMode({
|
||||
onClick={() => setLeftCollapsed(false)}
|
||||
title="展开研讨原料"
|
||||
aria-expanded={false}
|
||||
className="w-full shrink-0 flex h-10 items-center justify-center rounded-2xl border border-slate-200/50 bg-white text-slate-500 hover:text-primary hover:border-primary/30 transition-colors shadow-[0_2px_8px_rgba(0,0,0,0.01)]"
|
||||
className="w-full shrink-0 flex h-10 items-center justify-center rounded-[4px] border border-slate-200/50 bg-white text-slate-500 hover:text-primary hover:border-primary/30 transition-colors shadow-[0_2px_8px_rgba(0,0,0,0.01)]"
|
||||
>
|
||||
<PanelLeftOpen className="h-4 w-4" />
|
||||
</button>
|
||||
@@ -347,7 +297,7 @@ export function Step3SummaryMode({
|
||||
onClick={() => setLeftCollapsed(true)}
|
||||
title="收起研讨原料"
|
||||
aria-expanded
|
||||
className="shrink-0 flex h-7 w-7 items-center justify-center rounded-lg border border-slate-200/50 bg-white text-slate-500 hover:text-primary hover:border-primary/30 transition-colors"
|
||||
className="shrink-0 flex h-7 w-7 items-center justify-center rounded-[4px] border border-slate-200/50 bg-white text-slate-500 hover:text-primary hover:border-primary/30 transition-colors"
|
||||
>
|
||||
<PanelLeftClose className="h-3.5 w-3.5" />
|
||||
</button>
|
||||
@@ -375,57 +325,37 @@ export function Step3SummaryMode({
|
||||
onClick={() => setModal("files")}
|
||||
/>
|
||||
|
||||
<div className="mt-1 rounded-2xl border border-dashed border-slate-200 bg-slate-50/60 p-3 text-[11px] leading-relaxed text-slate-400">
|
||||
<div className="mt-1 rounded-[4px] border border-dashed border-slate-200 bg-slate-50/60 p-3 text-[11px] leading-relaxed text-slate-400">
|
||||
右侧由「方案总结报告智能体」据这些原料撰写 Markdown 总结报告,可在下方输入框继续提修改意见或提问。
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</aside>
|
||||
)}
|
||||
|
||||
{/* 右栏:智能体进度 + 沙箱(复用第 2 步)。流程图画布放在右侧沙箱位
|
||||
(sidePanel 插槽),消息列表保持可见,可与 md 沙箱预览互相切换。 */}
|
||||
<section className="relative flex-1 min-w-0 rounded-2xl border border-slate-200/60 bg-white overflow-hidden">
|
||||
{/* 右栏:智能体进度 + Markdown 沙箱(复用第 2 步)。 */}
|
||||
<section
|
||||
data-step3-report-panel
|
||||
className={cn(
|
||||
"relative flex-1 min-w-0 overflow-hidden",
|
||||
!useStep1Chrome &&
|
||||
"eightbf-roundtable__step3-report-panel rounded-2xl border border-slate-200/60 bg-white",
|
||||
)}
|
||||
>
|
||||
<Step2SandboxLayout
|
||||
activeThreadId={activeArtifactThreadId ?? summaryThreadId}
|
||||
isStreaming={isStreaming}
|
||||
seatMessages={activeSeatMessages}
|
||||
sidePanel={
|
||||
flowGraph && flowView ? (
|
||||
<FlowGraphPanel
|
||||
data={flowGraph.graph}
|
||||
streaming={flowGraph.streaming}
|
||||
onClose={() => setFlowView(false)}
|
||||
onSwitchToReport={
|
||||
mdArtifact
|
||||
? () => {
|
||||
setFlowView(false);
|
||||
openArtifactPreview(mdArtifact.threadId, mdArtifact.path);
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
onChange={summary.setFlowGraph}
|
||||
/>
|
||||
) : undefined
|
||||
}
|
||||
taskArtifactSubmission={taskArtifactSubmission}
|
||||
>
|
||||
<AgentProgressPanel
|
||||
useStep1Chrome={useStep1Chrome}
|
||||
headerTitle={headerTitle}
|
||||
phase={phase}
|
||||
dialogues={displayDialogues}
|
||||
error={error}
|
||||
busy={busy}
|
||||
mdAvailable={!!mdArtifact}
|
||||
flowPhase={summary.flowPhase}
|
||||
onRegenerateFlow={summary.regenerateFlow}
|
||||
pendingClarification={summary.pendingFlowClarification}
|
||||
onResolveClarification={summary.resolveFlowClarification}
|
||||
ingestAvailable={summary.ingestAvailable}
|
||||
ingestStatus={summary.ingestStatus}
|
||||
pendingIngestClarification={summary.pendingIngestClarification}
|
||||
onResolveIngestChoice={summary.resolveIngestChoice}
|
||||
onResolveIngestClarification={summary.resolveIngestClarification}
|
||||
pendingFlowForIngest={summary.pendingFlowForIngest}
|
||||
onResolveFlowForIngest={summary.resolveFlowForIngest}
|
||||
onManualIngest={summary.runIngest}
|
||||
onRetry={redraw}
|
||||
onAsk={handleAsk}
|
||||
onPause={pause}
|
||||
@@ -433,31 +363,11 @@ export function Step3SummaryMode({
|
||||
onArtifactPreview={openArtifactPreview}
|
||||
selectedModel={selectedModel}
|
||||
availableModels={availableModels}
|
||||
modelsLoading={modelsLoading}
|
||||
setSelectedModel={setSelectedModel}
|
||||
taskArtifactSubmission={taskArtifactSubmission}
|
||||
/>
|
||||
</Step2SandboxLayout>
|
||||
|
||||
{/* 流程图入口按钮(有结构化数据且画布未开时显示;沙箱开着时即「切换」按钮) */}
|
||||
{flowGraph && !flowView && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setFlowView(true)}
|
||||
title={artifactsOpen ? "切换到流程图画布" : "打开流程图画布"}
|
||||
className="absolute bottom-4 right-4 z-20 inline-flex items-center gap-1.5 rounded-full border border-primary/30 bg-white px-3.5 py-2 text-[11px] font-bold text-primary shadow-lg transition hover:bg-primary/5"
|
||||
>
|
||||
{flowGraph.streaming ? (
|
||||
<Loader2 className="h-3.5 w-3.5 animate-spin" />
|
||||
) : (
|
||||
<Workflow className="h-3.5 w-3.5" />
|
||||
)}
|
||||
流程图
|
||||
<span className="rounded-full bg-primary/10 px-1.5 font-mono text-[10px]">
|
||||
{flowGraph.graph.nodes.length}
|
||||
</span>
|
||||
</button>
|
||||
)}
|
||||
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@@ -491,6 +401,7 @@ export function Step3SummaryMode({
|
||||
threadIds={threadIds}
|
||||
coordinatorName={coordinatorName}
|
||||
seatNameMap={seatNameMap}
|
||||
taskArtifactSubmission={taskArtifactSubmission}
|
||||
onClose={() => setModal(null)}
|
||||
/>
|
||||
)}
|
||||
@@ -520,7 +431,7 @@ function SourceCard({
|
||||
type="button"
|
||||
onClick={onClick}
|
||||
disabled={disabled}
|
||||
className="text-left bg-white border border-slate-200/60 rounded-2xl p-4 shadow-[0_2px_8px_rgba(0,0,0,0.01)] transition hover:border-primary/40 hover:shadow-[0_4px_14px_rgba(0,0,0,0.04)] disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:border-slate-200/60"
|
||||
className="text-left bg-white border border-slate-200/60 rounded-[4px] p-4 shadow-[0_2px_8px_rgba(0,0,0,0.01)] transition hover:border-primary/40 hover:shadow-[0_4px_14px_rgba(0,0,0,0.04)] disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:border-slate-200/60"
|
||||
>
|
||||
<div className="flex items-center gap-2 mb-1.5">
|
||||
{icon}
|
||||
@@ -553,7 +464,7 @@ function CollapsedSourceCard({
|
||||
title={title}
|
||||
disabled={disabled}
|
||||
onClick={onClick}
|
||||
className="w-full shrink-0 flex items-center justify-center rounded-2xl border border-slate-200/50 bg-white p-2.5 text-slate-500 shadow-[0_2px_8px_rgba(0,0,0,0.01)] transition hover:text-primary hover:border-primary/30 disabled:opacity-40 disabled:cursor-not-allowed"
|
||||
className="w-full shrink-0 flex items-center justify-center rounded-[4px] border border-slate-200/50 bg-white p-2.5 text-slate-500 shadow-[0_2px_8px_rgba(0,0,0,0.01)] transition hover:text-primary hover:border-primary/30 disabled:opacity-40 disabled:cursor-not-allowed"
|
||||
>
|
||||
{icon}
|
||||
</button>
|
||||
@@ -563,23 +474,13 @@ function CollapsedSourceCard({
|
||||
// ── 右栏:智能体进度面板(沙箱的 60% 区域)+ 底部对话输入框 ──────────────────
|
||||
|
||||
function AgentProgressPanel({
|
||||
useStep1Chrome = false,
|
||||
headerTitle,
|
||||
phase,
|
||||
dialogues,
|
||||
error,
|
||||
busy,
|
||||
mdAvailable,
|
||||
flowPhase,
|
||||
onRegenerateFlow,
|
||||
pendingClarification,
|
||||
onResolveClarification,
|
||||
ingestAvailable,
|
||||
ingestStatus,
|
||||
pendingIngestClarification,
|
||||
onResolveIngestChoice,
|
||||
onResolveIngestClarification,
|
||||
pendingFlowForIngest,
|
||||
onResolveFlowForIngest,
|
||||
onManualIngest,
|
||||
onRetry,
|
||||
onAsk,
|
||||
onPause,
|
||||
@@ -587,32 +488,17 @@ function AgentProgressPanel({
|
||||
onArtifactPreview,
|
||||
selectedModel,
|
||||
availableModels,
|
||||
modelsLoading,
|
||||
setSelectedModel,
|
||||
taskArtifactSubmission,
|
||||
}: {
|
||||
useStep1Chrome?: boolean;
|
||||
headerTitle?: string;
|
||||
phase: UseStep3SummaryReturn["phase"];
|
||||
dialogues: UseStep3SummaryReturn["dialogues"];
|
||||
error: string | null;
|
||||
busy: boolean;
|
||||
/** 沙箱里是否已有 md 报告 —— 决定提示语(纯流程图轮没有 .md 可预览/下载)。 */
|
||||
/** 沙箱里是否已有 Markdown 总结报告。 */
|
||||
mdAvailable: boolean;
|
||||
/** 后端流程图抽取阶段(Phase 1)。 */
|
||||
flowPhase: UseStep3SummaryReturn["flowPhase"];
|
||||
/** 仅重新生成流程图(模型挂了切模型后重试)。 */
|
||||
onRegenerateFlow: () => void;
|
||||
/** 意图模糊待澄清的原始消息(非空 → 展示选项让用户定)。 */
|
||||
pendingClarification: string | null;
|
||||
onResolveClarification: UseStep3SummaryReturn["resolveFlowClarification"];
|
||||
/** 入库技能是否可用(决定入库询问卡 + 手动入库按钮是否出现)。 */
|
||||
ingestAvailable: boolean;
|
||||
ingestStatus: UseStep3SummaryReturn["ingestStatus"];
|
||||
pendingIngestClarification: string | null;
|
||||
onResolveIngestChoice: UseStep3SummaryReturn["resolveIngestChoice"];
|
||||
onResolveIngestClarification: UseStep3SummaryReturn["resolveIngestClarification"];
|
||||
/** 入库时尚无流程图 → 展示「是否先生成流程图」协助。 */
|
||||
pendingFlowForIngest: boolean;
|
||||
onResolveFlowForIngest: UseStep3SummaryReturn["resolveFlowForIngest"];
|
||||
onManualIngest: UseStep3SummaryReturn["runIngest"];
|
||||
onRetry: () => void;
|
||||
onAsk: (message: string, files?: File[]) => void;
|
||||
onPause: () => void;
|
||||
@@ -620,13 +506,13 @@ function AgentProgressPanel({
|
||||
onArtifactPreview: UseStep3SummaryReturn["openArtifactPreview"];
|
||||
selectedModel: string;
|
||||
availableModels: ReadonlyArray<ModelOption>;
|
||||
modelsLoading: boolean;
|
||||
setSelectedModel: (model: string) => void;
|
||||
taskArtifactSubmission?: TaskArtifactSubmissionController;
|
||||
}) {
|
||||
const scrollRef = useRef<HTMLDivElement>(null);
|
||||
const { atBottom, scrollToBottom } = useAutoScroll(scrollRef, [dialogues]);
|
||||
// 新一轮气泡出现(如:md 报告完成后自动续跑的结构化输出轮、用户发问)→ 强制滚到底,
|
||||
// 让用户看到新阶段(修「调用结构化输出时不自动下滑」)。仅在气泡**条数**增加时触发,
|
||||
// 新一轮气泡出现(报告生成或用户续问)→ 强制滚到底,
|
||||
// 让用户看到新阶段。仅在气泡**条数**增加时触发,
|
||||
// 流式增量内容仍由 useAutoScroll 的「在底部才跟随」逻辑处理,不抢用户向上翻阅。
|
||||
const prevDialogueCountRef = useRef(dialogues.length);
|
||||
useEffect(() => {
|
||||
@@ -644,20 +530,21 @@ function AgentProgressPanel({
|
||||
const [askFiles, setAskFiles] = useState<File[]>([]);
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
const pickFiles = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const picked = Array.from(e.target.files ?? []);
|
||||
const addAskFiles = (picked: File[]) => {
|
||||
if (picked.length > 0) {
|
||||
setAskFiles((prev) => {
|
||||
const seen = new Set(prev.map((f) => `${f.name}:${f.size}`));
|
||||
return [...prev, ...picked.filter((f) => !seen.has(`${f.name}:${f.size}`))];
|
||||
});
|
||||
}
|
||||
};
|
||||
const pickFiles = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
addAskFiles(Array.from(e.target.files ?? []));
|
||||
e.target.value = "";
|
||||
};
|
||||
const removeFile = (idx: number) => setAskFiles((prev) => prev.filter((_, i) => i !== idx));
|
||||
|
||||
const handleAskSubmit = (e: FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
const submitAsk = () => {
|
||||
const text = askText.trim();
|
||||
const hasFiles = askFiles.length > 0;
|
||||
if (!text && !hasFiles) return; // 允许「随时」发送(含生成中);空内容不发
|
||||
@@ -665,51 +552,97 @@ function AgentProgressPanel({
|
||||
setAskFiles([]);
|
||||
onAsk(text, hasFiles ? askFiles : undefined);
|
||||
};
|
||||
const handleAskSubmit = (e: FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
submitAsk();
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex h-full min-h-0 flex-col bg-slate-50/20">
|
||||
<div className="shrink-0 flex items-center justify-between gap-2 border-b border-slate-100 bg-white px-4 py-2.5">
|
||||
<div className="flex items-center gap-2 min-w-0">
|
||||
<div className="w-6 h-6 shrink-0 rounded-lg bg-gradient-to-tr from-primary to-[var(--brand-200)] flex items-center justify-center text-white text-xs shadow-sm">
|
||||
报
|
||||
<div
|
||||
className={cn(
|
||||
"flex h-full min-h-0 flex-col",
|
||||
useStep1Chrome
|
||||
? "position-roundtable-intent-panel eightbf-roundtable-intent-panel eightbf-roundtable-step3-chat"
|
||||
: "bg-slate-50/20",
|
||||
)}
|
||||
>
|
||||
{useStep1Chrome ? (
|
||||
<div className="shrink-0 flex items-center justify-between gap-3">
|
||||
<div className="position-roundtable-intent-header-title">
|
||||
<span aria-hidden="true" />
|
||||
<h2>{headerTitle || "方案总结"}</h2>
|
||||
</div>
|
||||
<div className="leading-tight min-w-0">
|
||||
<div className="text-xs font-bold text-slate-800 truncate">方案总结报告智能体</div>
|
||||
<div className="text-[10px] text-slate-400 truncate">据各席位成果撰写 Markdown 总结报告</div>
|
||||
<div className="position-roundtable-intent-header-actions">
|
||||
<button
|
||||
type="button"
|
||||
onClick={onRetry}
|
||||
disabled={phase === "creating" || phase === "streaming"}
|
||||
>
|
||||
重新生成
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<select
|
||||
id="step3-summary-model-select"
|
||||
value={selectedModel}
|
||||
onChange={(e) => setSelectedModel(e.target.value)}
|
||||
disabled={busy || modelsLoading || availableModels.length === 0}
|
||||
title={
|
||||
modelsLoading
|
||||
? "正在加载模型列表…"
|
||||
: availableModels.length === 0
|
||||
? "未在 config.yaml 中配置任何模型"
|
||||
: busy
|
||||
? "撰写中不可切换;完成后或重新生成时生效"
|
||||
: "切换撰写使用的推理模型(下次生成生效)"
|
||||
}
|
||||
className="shrink-0 max-w-[180px] bg-slate-50/50 border border-slate-200 rounded-xl px-2.5 py-1.5 text-[11px] font-bold text-slate-700 cursor-pointer focus:outline-none focus:border-primary focus:ring-1 focus:ring-[var(--brand-200)]/50 disabled:opacity-50 disabled:cursor-not-allowed dark:bg-secondary dark:text-foreground dark:border-border"
|
||||
>
|
||||
{availableModels.length === 0 && (
|
||||
<option value="">{modelsLoading ? "加载中…" : "未配置模型"}</option>
|
||||
)}
|
||||
{availableModels.map((m) => (
|
||||
<option key={m.name} value={m.name}>
|
||||
{m.display_name && m.display_name !== m.name
|
||||
? `${m.display_name} (${m.name})`
|
||||
: m.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
) : (
|
||||
<div className="shrink-0 flex items-center justify-between gap-2 border-b border-slate-100 bg-white px-4 py-2.5">
|
||||
<div className="flex items-center gap-2 min-w-0">
|
||||
<div className="w-6 h-6 shrink-0 rounded-lg bg-gradient-to-tr from-primary to-[var(--brand-200)] flex items-center justify-center text-white text-xs shadow-sm">
|
||||
报
|
||||
</div>
|
||||
<div className="leading-tight min-w-0">
|
||||
<div className="text-xs font-bold text-slate-800 truncate">方案总结报告智能体</div>
|
||||
<div className="text-[10px] text-slate-400 truncate">据各席位成果撰写 Markdown 总结报告</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 shrink-0">
|
||||
<select
|
||||
id="step3-summary-model-select"
|
||||
value={selectedModel}
|
||||
onChange={(e) => setSelectedModel(e.target.value)}
|
||||
disabled={busy || availableModels.length === 0}
|
||||
title={
|
||||
availableModels.length === 0
|
||||
? "未在 config.yaml 中配置任何模型"
|
||||
: busy
|
||||
? "撰写中不可切换;完成后或重新生成时生效"
|
||||
: "切换撰写使用的推理模型(下次生成生效)"
|
||||
}
|
||||
className="shrink-0 max-w-[180px] bg-slate-50/50 border border-slate-200 rounded-xl px-2.5 py-1.5 text-[11px] font-bold text-slate-700 cursor-pointer focus:outline-none focus:border-primary focus:ring-1 focus:ring-[var(--brand-200)]/50 disabled:opacity-50 disabled:cursor-not-allowed dark:bg-secondary dark:text-foreground dark:border-border"
|
||||
>
|
||||
{availableModels.length === 0 && (
|
||||
<option value="">未配置模型</option>
|
||||
)}
|
||||
{availableModels.map((m) => (
|
||||
<option key={m.name} value={m.name}>
|
||||
{m.display_name && m.display_name !== m.name
|
||||
? `${m.display_name} (${m.name})`
|
||||
: m.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{busy && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onPause}
|
||||
title="暂停当前生成(沙箱保留已生成内容,之后可继续修改或重新生成)"
|
||||
className="bg-white border border-amber-200 text-amber-700 hover:bg-amber-50 text-[10.5px] font-bold px-2.5 py-1.5 rounded-xl flex items-center gap-1 transition"
|
||||
>
|
||||
<Pause className="w-3.5 h-3.5" />
|
||||
暂停
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 消息列表 —— 与第 2 步同款气泡(流式正文 + 工具步骤卡 + 文件卡)。 */}
|
||||
<div className="relative flex-1 min-h-0 flex flex-col">
|
||||
<div ref={scrollRef} className="flex-1 min-h-0 overflow-y-auto overflow-x-hidden p-4 space-y-4 bg-white">
|
||||
<div className="relative flex-1 min-h-0">
|
||||
<div
|
||||
ref={scrollRef}
|
||||
className={cn(
|
||||
"size-full overflow-y-auto overflow-x-hidden p-4 space-y-4",
|
||||
useStep1Chrome ? "eightbf-roundtable-step3-log" : "bg-white",
|
||||
)}
|
||||
>
|
||||
{phase === "creating" && dialogues.length === 0 && (
|
||||
<div className="flex items-center gap-2 text-xs text-slate-500">
|
||||
<Loader2 className="w-3.5 h-3.5 animate-spin text-primary" />
|
||||
@@ -726,15 +659,14 @@ function AgentProgressPanel({
|
||||
onFileCardClick={(path) => {
|
||||
if (msg.agentThreadId) onArtifactPreview(msg.agentThreadId, path);
|
||||
}}
|
||||
taskArtifactSubmission={taskArtifactSubmission}
|
||||
/>
|
||||
))}
|
||||
|
||||
{busy && (
|
||||
<div className="inline-flex items-center gap-2 rounded-full border bg-white px-2.5 py-1 text-[11px] text-slate-500">
|
||||
<span className="bg-primary size-1.5 animate-pulse rounded-full" />
|
||||
{mdAvailable
|
||||
? "报告正文实时输出,右侧沙箱同步预览 Markdown"
|
||||
: "报告正文实时输出;输出结构化数据时流程图画布同步绘制"}
|
||||
{mdAvailable ? "报告正文实时输出,右侧沙箱同步预览 Markdown" : "正在撰写 Markdown 总结报告"}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -753,25 +685,10 @@ function AgentProgressPanel({
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 后端流程图「抽取+校验」状态条(Phase 1)。 */}
|
||||
{(flowPhase === "extracting" || flowPhase === "validating") && (
|
||||
<div className="inline-flex items-center gap-2 rounded-full border border-blue-200 bg-blue-50 px-2.5 py-1 text-[11px] font-bold text-blue-600">
|
||||
<Loader2 className="w-3 h-3 animate-spin" />
|
||||
{flowPhase === "extracting" ? "结构化流程图抽取中(JSON 实时输出)…" : "流程图校验 / 修复中…"}
|
||||
</div>
|
||||
)}
|
||||
{flowPhase === "error" && (
|
||||
<div className="rounded-xl border border-amber-200 bg-amber-50 p-3 text-xs text-amber-800">
|
||||
<div className="font-bold mb-1">流程图生成失败</div>
|
||||
<div className="leading-relaxed">模型可能不稳定。可在上方切换模型后重试。</div>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onRegenerateFlow}
|
||||
className="mt-2 inline-flex items-center gap-1 text-[11px] font-bold text-amber-800 underline hover:text-amber-900"
|
||||
>
|
||||
<RefreshCw className="w-3 h-3" />
|
||||
重新生成流程图
|
||||
</button>
|
||||
{phase === "paused" && (
|
||||
<div className="flex items-center gap-2 text-xs font-bold text-amber-600">
|
||||
<Pause className="w-4 h-4" />
|
||||
已暂停。可在下方输入修改要求继续,或点右上角「重新生成」。
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -779,123 +696,54 @@ function AgentProgressPanel({
|
||||
<div className="flex items-center gap-2 text-xs font-bold text-emerald-600">
|
||||
<CheckCircle className="w-4 h-4" />
|
||||
{mdAvailable
|
||||
? "已生成方案总结报告,右侧可预览 / 下载 .md;可在下方继续修改报告 / 流程图或提问。"
|
||||
: "已生成方案总结,流程图可在画布查看;可在下方继续修改总结 / 流程图或提问。"}
|
||||
? "已生成方案总结报告,右侧可预览 / 下载 .md;可在下方继续修改报告或提问。"
|
||||
: "已生成方案总结,可在下方继续修改报告或提问。"}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{!atBottom && <ScrollToBottomButton onClick={scrollToBottom} />}
|
||||
|
||||
{/* 意图模糊 → 让用户自己定(不自作主张) */}
|
||||
{pendingClarification && (
|
||||
<div className="shrink-0 border-t border-amber-100 bg-amber-50/60 px-3 py-2.5">
|
||||
<div className="mb-1.5 text-[11px] font-bold text-amber-800">
|
||||
没太理解你的意思,你是想——
|
||||
</div>
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{(
|
||||
[
|
||||
{ k: "regenerate_report", t: "重新生成报告" },
|
||||
{ k: "modify_flow", t: "修改流程图" },
|
||||
{ k: "regenerate_flow", t: "重新生成流程图" },
|
||||
{ k: "qa", t: "只是提问" },
|
||||
] as const
|
||||
).map((o) => (
|
||||
<button
|
||||
key={o.k}
|
||||
type="button"
|
||||
onClick={() => onResolveClarification(o.k)}
|
||||
className="rounded-lg border border-amber-300 bg-white px-2.5 py-1.5 text-[11px] font-bold text-amber-800 transition hover:bg-amber-100"
|
||||
>
|
||||
{o.t}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 流程图已生成 → 询问是否入库(入库技能可用时)。 */}
|
||||
{ingestAvailable && ingestStatus === "asking" && (
|
||||
<div className="shrink-0 border-t border-emerald-100 bg-emerald-50/60 px-3 py-2.5">
|
||||
<div className="mb-1.5 text-[11px] font-bold text-emerald-800">
|
||||
流程图已生成,是否进行数据入库?
|
||||
</div>
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{(
|
||||
[
|
||||
{ k: "now", t: "现在入库" },
|
||||
{ k: "later", t: "稍后入库" },
|
||||
{ k: "never", t: "不入库" },
|
||||
] as const
|
||||
).map((o) => (
|
||||
<button
|
||||
key={o.k}
|
||||
type="button"
|
||||
onClick={() => onResolveIngestChoice(o.k)}
|
||||
className="rounded-lg border border-emerald-300 bg-white px-2.5 py-1.5 text-[11px] font-bold text-emerald-800 transition hover:bg-emerald-100"
|
||||
>
|
||||
{o.t}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 入库时尚无流程图 → 协助:数据入库以流程图为核心内容,先问是否生成流程图。 */}
|
||||
{ingestAvailable && pendingFlowForIngest && (
|
||||
<div className="shrink-0 border-t border-amber-100 bg-amber-50/70 px-3 py-2.5">
|
||||
<div className="mb-1.5 text-[11px] font-bold text-amber-800">
|
||||
当前还没有生成流程图,数据入库需要流程图。是否先生成流程图?
|
||||
</div>
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{(
|
||||
[
|
||||
{ k: "generate", t: "生成流程图" },
|
||||
{ k: "cancel", t: "暂不入库" },
|
||||
] as const
|
||||
).map((o) => (
|
||||
<button
|
||||
key={o.k}
|
||||
type="button"
|
||||
onClick={() => onResolveFlowForIngest(o.k)}
|
||||
className="rounded-lg border border-amber-300 bg-white px-2.5 py-1.5 text-[11px] font-bold text-amber-800 transition hover:bg-amber-100"
|
||||
>
|
||||
{o.t}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 「稍后入库」自由文字意图模糊 → 让用户在入库语境下自己定。 */}
|
||||
{ingestAvailable && pendingIngestClarification && (
|
||||
<div className="shrink-0 border-t border-emerald-100 bg-emerald-50/60 px-3 py-2.5">
|
||||
<div className="mb-1.5 text-[11px] font-bold text-emerald-800">
|
||||
没太理解你的入库意思,你是想——
|
||||
</div>
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{(
|
||||
[
|
||||
{ k: "start_ingest", t: "开始入库" },
|
||||
{ k: "add_data", t: "补充内容后再入库" },
|
||||
{ k: "other", t: "只是提问 / 改报告" },
|
||||
] as const
|
||||
).map((o) => (
|
||||
<button
|
||||
key={o.k}
|
||||
type="button"
|
||||
onClick={() => onResolveIngestClarification(o.k)}
|
||||
className="rounded-lg border border-emerald-300 bg-white px-2.5 py-1.5 text-[11px] font-bold text-emerald-800 transition hover:bg-emerald-100"
|
||||
>
|
||||
{o.t}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
{!atBottom && (
|
||||
<ScrollToBottomButton
|
||||
onClick={scrollToBottom}
|
||||
className="!bottom-1/2 translate-y-1/2"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{useStep1Chrome ? (
|
||||
<div className="position-roundtable-intent-page eightbf-roundtable-step3-input shrink-0">
|
||||
<PositionIntentInput
|
||||
value={askText}
|
||||
onValueChange={setAskText}
|
||||
attachedFiles={askFiles}
|
||||
onAddFiles={addAskFiles}
|
||||
onRemoveFile={removeFile}
|
||||
charactersLeft={Math.max(0, 500 - askText.length)}
|
||||
isSending={busy}
|
||||
canSend={askText.trim().length > 0 || askFiles.length > 0}
|
||||
pendingClarification={false}
|
||||
onSend={submitAsk}
|
||||
onStop={onPause}
|
||||
onFollowUp={() => undefined}
|
||||
onSkip={() => undefined}
|
||||
hideUtilityActions
|
||||
onEnterRoundtable={() => undefined}
|
||||
enterButtonLabel=""
|
||||
intentReady={null}
|
||||
hideEnterRoundtable
|
||||
onManualSave={() => undefined}
|
||||
onTriggerToast={() => undefined}
|
||||
modelOptions={availableModels.map((model) => ({
|
||||
label: model.display_name && model.display_name !== model.name
|
||||
? `${model.display_name} (${model.name})`
|
||||
: model.name,
|
||||
value: model.name,
|
||||
}))}
|
||||
selectedModel={selectedModel}
|
||||
onSelectedModelChange={setSelectedModel}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<form onSubmit={handleAskSubmit} className="shrink-0 border-t border-slate-100 bg-white px-3 py-3">
|
||||
{/* 已选附件预览(发送时随指令上传到总结线程,供智能体读取) */}
|
||||
{askFiles.length > 0 && (
|
||||
<div className="mb-2 flex flex-wrap gap-1.5">
|
||||
{askFiles.map((file, idx) => (
|
||||
@@ -935,28 +783,10 @@ function AgentProgressPanel({
|
||||
placeholder={
|
||||
busy
|
||||
? "生成中也可随时插话干预:发送将打断当前轮并据此继续…"
|
||||
: "继续对话:改报告(如「执行路线写细些」)/ 改流程图(如「总结成结构化输出」「流程图加上验收环节」)/ 提问"
|
||||
: "继续对话:改报告(如「执行路线写细些」)或提问"
|
||||
}
|
||||
className="min-h-8 max-h-56 flex-1 resize-none bg-transparent py-1.5 text-xs leading-relaxed text-slate-800 placeholder:text-slate-400 focus:outline-none"
|
||||
/>
|
||||
|
||||
{/* 手动入库(入库技能可用、且已过流程图询问阶段时显示):直接在总结线程跑入库技能。 */}
|
||||
{ingestAvailable &&
|
||||
ingestStatus !== "asking" &&
|
||||
ingestStatus !== "running" &&
|
||||
ingestStatus !== "idle" && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => onManualIngest()}
|
||||
title="进行数据入库(由结构化输出智能体调用入库技能,过程见消息列表步骤条)"
|
||||
className="mb-0.5 flex h-8 shrink-0 items-center gap-1 rounded-xl border border-emerald-200 bg-emerald-50 px-2.5 text-[11px] font-bold text-emerald-700 transition hover:bg-emerald-100 active:scale-95"
|
||||
>
|
||||
<Database className="h-3.5 w-3.5" />
|
||||
数据入库
|
||||
</button>
|
||||
)}
|
||||
|
||||
{/* 上传文件(参考第一/二步:本地选取,发送时上传到总结线程) */}
|
||||
<input ref={fileInputRef} type="file" multiple className="hidden" onChange={pickFiles} />
|
||||
<button
|
||||
type="button"
|
||||
@@ -966,8 +796,6 @@ function AgentProgressPanel({
|
||||
>
|
||||
<Paperclip className="h-4 w-4" />
|
||||
</button>
|
||||
|
||||
{/* 暂停(仅生成中显示) */}
|
||||
{busy && (
|
||||
<button
|
||||
type="button"
|
||||
@@ -978,8 +806,6 @@ function AgentProgressPanel({
|
||||
<Pause className="h-4 w-4" />
|
||||
</button>
|
||||
)}
|
||||
|
||||
{/* 发送(随时可发:生成中发送=打断并续问) */}
|
||||
<button
|
||||
type="submit"
|
||||
disabled={askText.trim().length === 0 && askFiles.length === 0}
|
||||
@@ -990,7 +816,7 @@ function AgentProgressPanel({
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1106,11 +932,13 @@ function SeatFilesModal({
|
||||
threadIds,
|
||||
coordinatorName,
|
||||
seatNameMap,
|
||||
taskArtifactSubmission,
|
||||
onClose,
|
||||
}: {
|
||||
threadIds: ThreadIdMap | null;
|
||||
coordinatorName: string | null;
|
||||
seatNameMap: Record<string, string>;
|
||||
taskArtifactSubmission?: TaskArtifactSubmissionController;
|
||||
onClose: () => void;
|
||||
}) {
|
||||
const seatEntries = useMemo(() => {
|
||||
@@ -1216,6 +1044,25 @@ function SeatFilesModal({
|
||||
</div>
|
||||
<div className="flex items-center gap-2 shrink-0">
|
||||
<span className="text-[10px] font-mono text-slate-400">{formatBytes(f.sizeBytes)}</span>
|
||||
<TaskArtifactSubmitButton
|
||||
compact
|
||||
controller={taskArtifactSubmission}
|
||||
target={taskArtifactSubmission?.targetFor({
|
||||
threadId: seat.threadId,
|
||||
path: f.path,
|
||||
name: f.name,
|
||||
mimeType: f.mimeType,
|
||||
agentId: seat.agentName,
|
||||
agentName: seat.displayName,
|
||||
}) ?? {
|
||||
threadId: seat.threadId,
|
||||
path: f.path,
|
||||
name: f.name,
|
||||
mimeType: f.mimeType,
|
||||
agentId: seat.agentName,
|
||||
agentName: seat.displayName,
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => handlePreview(seat.threadId, f)}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
import { Check, Loader2, UploadCloud } from "lucide-react";
|
||||
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { TaskArtifactSubmissionController, TaskArtifactTarget } from "@/roundtable-planning/lib/task-artifact-submission";
|
||||
|
||||
export function TaskArtifactSubmitButton({
|
||||
controller,
|
||||
target,
|
||||
compact = false,
|
||||
className,
|
||||
}: {
|
||||
controller?: TaskArtifactSubmissionController;
|
||||
target: TaskArtifactTarget;
|
||||
compact?: boolean;
|
||||
className?: string;
|
||||
}) {
|
||||
if (!controller?.enabled || !controller.isMarkdown(target)) return null;
|
||||
const state = controller.stateFor(target);
|
||||
const error = controller.errorFor(target);
|
||||
const isSubmitted = state === "submitted";
|
||||
const isSubmitting = state === "submitting";
|
||||
const label = isSubmitted ? "已提交" : isSubmitting ? "提交中…" : "提交";
|
||||
const title = error || (isSubmitted ? "该 Markdown 产物已提交到任务过程" : "提交 Markdown 过程产物");
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
disabled={isSubmitting || isSubmitted}
|
||||
aria-label={`${target.name || target.path}:${label}`}
|
||||
title={title}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
void controller.submit(target).catch(() => undefined);
|
||||
}}
|
||||
className={cn(
|
||||
"inline-flex shrink-0 items-center justify-center gap-1 rounded-md border px-2 py-1 text-[10px] font-semibold transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60 disabled:cursor-not-allowed",
|
||||
isSubmitted
|
||||
? "border-emerald-300 bg-emerald-50 text-emerald-700 dark:border-emerald-500/40 dark:bg-emerald-500/10 dark:text-emerald-300"
|
||||
: error
|
||||
? "border-rose-300 bg-rose-50 text-rose-700 hover:bg-rose-100 dark:border-rose-500/40 dark:bg-rose-500/10 dark:text-rose-300"
|
||||
: "border-primary/35 bg-primary/10 text-primary hover:bg-primary/15",
|
||||
// 沙箱头部的其他分段切换器外框为 40px 高,提交入口与之对齐。
|
||||
compact && "h-10 px-3 text-xs",
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{isSubmitting ? <Loader2 className="size-3 animate-spin" /> : isSubmitted ? <Check className="size-3" /> : <UploadCloud className="size-3" />}
|
||||
<span>{label}</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
type IntentSummary,
|
||||
} from "@/roundtable-planning/api/intent";
|
||||
import { uploadFiles } from "@/core/uploads/api";
|
||||
import { createClientId } from "@/lib/client-id";
|
||||
import {
|
||||
clarificationKey,
|
||||
formatIntentClarificationAnswer,
|
||||
@@ -449,9 +450,7 @@ export function useStep1Intent(options: UseStep1IntentOptions): UseStep1IntentRe
|
||||
|
||||
// Phase 4 单飞幂等键:每个回合一个稳定 id。后端据此对 (threadId, clientTurnId)
|
||||
// 跨 worker 单飞——重复 / 双击命中既有回合即幂等返回,杜绝并发下双发意图。
|
||||
const clientTurnId =
|
||||
(typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID()) ||
|
||||
`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
||||
const clientTurnId = createClientId();
|
||||
|
||||
// ask_clarification 是本轮的严格暂停点。某些模型在工具调用已经产出
|
||||
// 选项卡后还会继续吐一段“请做选择”等正文;从第一张卡出现起忽略后续
|
||||
|
||||
@@ -507,6 +507,14 @@ export function useStep2Orchestration(
|
||||
Record<string, StubAiMessage[]>
|
||||
>({});
|
||||
const seatStubMessagesRef = useRef<Record<string, StubAiMessage[]>>({});
|
||||
// write_file 的 tool args 会在一个 SSE response 里高频增长。ref 始终保留最新全文,
|
||||
// 供自动打开 / 最终收口等同步逻辑立即读取;但不要逐帧把整份 stub 写进 React state。
|
||||
// 后者会重建沙箱 ThreadContext 并让 ArtifactFileDetail 的预览 effect 连锁执行,
|
||||
// 在「继续会商 + 正在写文件」的高密度帧下曾触发 Maximum update depth exceeded。
|
||||
const pendingSeatStubMessagesRef = useRef<
|
||||
Record<string, StubAiMessage[]> | null
|
||||
>(null);
|
||||
const seatStubFlushTimerRef = useRef<number | null>(null);
|
||||
const [selectedAgents, setSelectedAgents] = useState<SelectedAgent[]>(
|
||||
DEFAULT_SELECTED_AGENTS,
|
||||
);
|
||||
@@ -552,6 +560,11 @@ export function useStep2Orchestration(
|
||||
new Map(),
|
||||
);
|
||||
const parallelFlushTimerRef = useRef<number | null>(null);
|
||||
// 非并行的 leader / 单席位流同样不能逐 token 直接 setState。SSE reader 可能在一次
|
||||
// 浏览器任务里吐出大量已缓冲帧;逐帧 setState 会与消息区的 effect 连锁,最终触发
|
||||
// React 的 Maximum update depth 保护。先累积到 ref,再以固定节流频率提交到界面。
|
||||
const directStreamDeltaRef = useRef<Map<number, string>>(new Map());
|
||||
const directStreamFlushTimerRef = useRef<number | null>(null);
|
||||
// flush 时要读「当前选中席位」与「批次 bubbleId↔agentId 映射」—— 打到 ref 避免
|
||||
// 把 flush 函数绑进会频繁变化的 state 依赖。
|
||||
const selectedParallelSeatsRef = useRef<string[]>([]);
|
||||
@@ -684,6 +697,57 @@ export function useStep2Orchestration(
|
||||
return ids[agentName] ?? ids[agentName.toLowerCase()];
|
||||
}, []);
|
||||
|
||||
/**
|
||||
* 把写文件预览的 stub 以约 12fps 合并交给 React。
|
||||
*
|
||||
* `seatStubMessagesRef` 已在调用处同步更新,故这里的延迟只影响右侧 Markdown
|
||||
* 重绘频率,不影响随后读取最新 path/content、也不影响自动打开沙箱。
|
||||
*/
|
||||
const flushSeatStubMessages = useCallback(() => {
|
||||
seatStubFlushTimerRef.current = null;
|
||||
const pending = pendingSeatStubMessagesRef.current;
|
||||
if (!pending) return;
|
||||
pendingSeatStubMessagesRef.current = null;
|
||||
setSeatStubMessages((previous) => (previous === pending ? previous : pending));
|
||||
}, []);
|
||||
|
||||
const scheduleSeatStubMessagesFlush = useCallback(() => {
|
||||
if (seatStubFlushTimerRef.current !== null) return;
|
||||
seatStubFlushTimerRef.current = window.setTimeout(
|
||||
flushSeatStubMessages,
|
||||
80,
|
||||
);
|
||||
}, [flushSeatStubMessages]);
|
||||
|
||||
/** 清掉未提交的流式预览,并立即发布一个确定的快照(草稿恢复 / 重置时使用)。 */
|
||||
const replaceSeatStubMessages = useCallback(
|
||||
(next: Record<string, StubAiMessage[]>) => {
|
||||
pendingSeatStubMessagesRef.current = null;
|
||||
if (seatStubFlushTimerRef.current !== null) {
|
||||
window.clearTimeout(seatStubFlushTimerRef.current);
|
||||
seatStubFlushTimerRef.current = null;
|
||||
}
|
||||
seatStubMessagesRef.current = next;
|
||||
setSeatStubMessages((previous) => (previous === next ? previous : next));
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
const resetSeatStubMessages = useCallback(() => {
|
||||
replaceSeatStubMessages({});
|
||||
}, [replaceSeatStubMessages]);
|
||||
|
||||
// 卸载时清理挂起的预览 flush,避免已离开的页面仍收到一次 setState。
|
||||
useEffect(
|
||||
() => () => {
|
||||
if (seatStubFlushTimerRef.current !== null) {
|
||||
window.clearTimeout(seatStubFlushTimerRef.current);
|
||||
seatStubFlushTimerRef.current = null;
|
||||
}
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
/**
|
||||
* 把工具调用幂等地写进 seat 的 stub ai message —— **同 (toolName, path)** 视为同一次
|
||||
* 调用,后续帧只更新 args(LangGraph 流式期间会多次发送完整 tool_calls 覆盖 args)。
|
||||
@@ -734,10 +798,11 @@ export function useStep2Orchestration(
|
||||
[seatThreadId]: [nextAiMsg],
|
||||
};
|
||||
seatStubMessagesRef.current = nextMap;
|
||||
setSeatStubMessages(nextMap);
|
||||
pendingSeatStubMessagesRef.current = nextMap;
|
||||
scheduleSeatStubMessagesFlush();
|
||||
return { messageId: nextAiMsg.id, toolCallId };
|
||||
},
|
||||
[],
|
||||
[scheduleSeatStubMessagesFlush],
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1026,12 +1091,6 @@ export function useStep2Orchestration(
|
||||
args,
|
||||
);
|
||||
const virtualUrl = buildWriteFileVirtualUrl(path, messageId, toolCallId);
|
||||
if (typeof window !== "undefined") {
|
||||
console.debug(
|
||||
"[roundtable-sandbox] auto-open from phase",
|
||||
{ toolName, path, seatThreadId, virtualUrl },
|
||||
);
|
||||
}
|
||||
openSeatVirtualArtifact(seatThreadId, virtualUrl, true);
|
||||
},
|
||||
[
|
||||
@@ -1272,9 +1331,15 @@ export function useStep2Orchestration(
|
||||
|
||||
const setDialogueConfidence = useCallback(
|
||||
(id: number, confidence: string) => {
|
||||
setStep2RoundtableDialogues((prev) =>
|
||||
prev.map((d) => (d.id === id ? { ...d, confidence } : d)),
|
||||
);
|
||||
setStep2RoundtableDialogues((prev) => {
|
||||
const index = prev.findIndex((dialogue) => dialogue.id === id);
|
||||
// onPhaseChange 可在一个 SSE read 内收到多帧相同的 phase。状态文字没有变化
|
||||
// 时必须返回原数组;否则 React 会把无意义的新数组当成一次嵌套更新。
|
||||
if (index < 0 || prev[index].confidence === confidence) return prev;
|
||||
const next = [...prev];
|
||||
next[index] = { ...prev[index], confidence };
|
||||
return next;
|
||||
});
|
||||
},
|
||||
[],
|
||||
);
|
||||
@@ -1286,30 +1351,39 @@ export function useStep2Orchestration(
|
||||
key: string,
|
||||
args?: Record<string, unknown>,
|
||||
) => {
|
||||
setStep2RoundtableDialogues((prev) =>
|
||||
prev.map((d) => {
|
||||
if (d.id !== bubbleId) return d;
|
||||
const steps: Step2Dialogue["steps"] = d.steps ?? [];
|
||||
const last = steps[steps.length - 1];
|
||||
if (last && last.key === key) {
|
||||
// 同 phase:tool 重复回调 —— 流式累积期 args 会持续长大(present_files
|
||||
// 多文件分批、write_file 内容增长),拿最新 args 覆盖,不要早早定死。
|
||||
if (args && args !== last.args) {
|
||||
const next = [...steps];
|
||||
next[next.length - 1] = { ...last, args };
|
||||
return { ...d, steps: next };
|
||||
}
|
||||
return d;
|
||||
}
|
||||
return {
|
||||
...d,
|
||||
setStep2RoundtableDialogues((prev) => {
|
||||
const dialogueIndex = prev.findIndex((dialogue) => dialogue.id === bubbleId);
|
||||
if (dialogueIndex < 0) return prev;
|
||||
|
||||
const dialogue = prev[dialogueIndex];
|
||||
const steps: Step2Dialogue["steps"] = dialogue.steps ?? [];
|
||||
const last = steps[steps.length - 1];
|
||||
let nextDialogue: Step2Dialogue;
|
||||
|
||||
if (last && last.key === key) {
|
||||
// 同一个工具调用在流式期间会反复带来增量入参。步骤卡只需在「首次拿到
|
||||
// 可见参数」时补一次;文件正文由 upstream frame 同步给沙箱,不能随每个
|
||||
// content chunk 更新对话 state。
|
||||
const hasVisibleArgs = (value?: Record<string, unknown>) =>
|
||||
!!value && Object.keys(value).some((argKey) => argKey !== "content");
|
||||
if (hasVisibleArgs(last.args) || !hasVisibleArgs(args)) return prev;
|
||||
const nextSteps = [...steps];
|
||||
nextSteps[nextSteps.length - 1] = { ...last, args };
|
||||
nextDialogue = { ...dialogue, steps: nextSteps };
|
||||
} else {
|
||||
nextDialogue = {
|
||||
...dialogue,
|
||||
steps: [
|
||||
...steps,
|
||||
{ id: `${bubbleId}-${steps.length}`, key, label, ts: nowTime(), args },
|
||||
],
|
||||
};
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
const next = [...prev];
|
||||
next[dialogueIndex] = nextDialogue;
|
||||
return next;
|
||||
});
|
||||
},
|
||||
[],
|
||||
);
|
||||
@@ -1342,20 +1416,45 @@ export function useStep2Orchestration(
|
||||
[],
|
||||
);
|
||||
|
||||
/** 将非并行流的已积累增量一次性写入 React state(约 20fps)。 */
|
||||
const flushDirectStreamDeltas = useCallback(() => {
|
||||
directStreamFlushTimerRef.current = null;
|
||||
const pending = directStreamDeltaRef.current;
|
||||
if (pending.size === 0) return;
|
||||
directStreamDeltaRef.current = new Map();
|
||||
setStep2RoundtableDialogues((prev) => {
|
||||
let changed = false;
|
||||
const next = prev.map((dialogue) => {
|
||||
const delta = pending.get(dialogue.id);
|
||||
if (!delta) return dialogue;
|
||||
changed = true;
|
||||
return { ...dialogue, content: (dialogue.content ?? "") + delta };
|
||||
});
|
||||
return changed ? next : prev;
|
||||
});
|
||||
}, []);
|
||||
|
||||
const scheduleDirectStreamFlush = useCallback(() => {
|
||||
if (directStreamFlushTimerRef.current !== null) return;
|
||||
directStreamFlushTimerRef.current = window.setTimeout(flushDirectStreamDeltas, 50);
|
||||
}, [flushDirectStreamDeltas]);
|
||||
|
||||
const appendToDialogue = useCallback((id: number, deltaText: string) => {
|
||||
if (!deltaText) return;
|
||||
setStep2RoundtableDialogues((prev) =>
|
||||
prev.map((d) =>
|
||||
d.id === id ? { ...d, content: (d.content ?? "") + deltaText } : d,
|
||||
),
|
||||
);
|
||||
}, []);
|
||||
const pending = directStreamDeltaRef.current;
|
||||
pending.set(id, (pending.get(id) ?? "") + deltaText);
|
||||
scheduleDirectStreamFlush();
|
||||
}, [scheduleDirectStreamFlush]);
|
||||
|
||||
/** 整段替换某气泡正文(§6 flush:把 ref 里累积的全文一次性挂上去)。 */
|
||||
const setDialogueContent = useCallback((id: number, fullText: string) => {
|
||||
setStep2RoundtableDialogues((prev) =>
|
||||
prev.map((d) => (d.id === id ? { ...d, content: fullText } : d)),
|
||||
);
|
||||
setStep2RoundtableDialogues((prev) => {
|
||||
const index = prev.findIndex((dialogue) => dialogue.id === id);
|
||||
if (index < 0 || prev[index].content === fullText) return prev;
|
||||
const next = [...prev];
|
||||
next[index] = { ...prev[index], content: fullText };
|
||||
return next;
|
||||
});
|
||||
}, []);
|
||||
|
||||
/**
|
||||
@@ -1372,6 +1471,7 @@ export function useStep2Orchestration(
|
||||
const who = info.agentName || "智能体";
|
||||
triggerToast(`「${info.failedModel}」模型${info.reason},已自动切换「${info.nextModel}」继续`);
|
||||
if (isParallel) parallelStreamRef.current.delete(bubbleId);
|
||||
directStreamDeltaRef.current.delete(bubbleId);
|
||||
const systemBubble: Step2Dialogue = {
|
||||
id: Date.now() + Math.random(),
|
||||
sender: "系统提示",
|
||||
@@ -1440,8 +1540,17 @@ export function useStep2Orchestration(
|
||||
}
|
||||
}, []);
|
||||
|
||||
const resetDirectStreamDeltas = useCallback(() => {
|
||||
directStreamDeltaRef.current = new Map();
|
||||
if (directStreamFlushTimerRef.current !== null) {
|
||||
window.clearTimeout(directStreamFlushTimerRef.current);
|
||||
directStreamFlushTimerRef.current = null;
|
||||
}
|
||||
}, []);
|
||||
|
||||
// 卸载兜底:清掉可能挂起的 flush 定时器。
|
||||
useEffect(() => resetParallelStreams, [resetParallelStreams]);
|
||||
useEffect(() => resetDirectStreamDeltas, [resetDirectStreamDeltas]);
|
||||
|
||||
// 选中变化 → 立刻把 ref 里已累积的全文挂给**新选中**的席位(切头像即显全部输出,
|
||||
// 证明流没丢、只是之前没渲染,§6.5)。
|
||||
@@ -1508,21 +1617,40 @@ export function useStep2Orchestration(
|
||||
|
||||
const finalizeDialogue = useCallback(
|
||||
(id: number, finalContent: string, confidence?: string) => {
|
||||
setStep2RoundtableDialogues((prev) =>
|
||||
prev.map((d) => {
|
||||
// 最终结果已经是完整文本,丢弃尚未 flush 的 token 缓冲,避免收尾后旧增量反写。
|
||||
directStreamDeltaRef.current.delete(id);
|
||||
if (
|
||||
directStreamDeltaRef.current.size === 0 &&
|
||||
directStreamFlushTimerRef.current !== null
|
||||
) {
|
||||
window.clearTimeout(directStreamFlushTimerRef.current);
|
||||
directStreamFlushTimerRef.current = null;
|
||||
}
|
||||
setStep2RoundtableDialogues((prev) => {
|
||||
let changed = false;
|
||||
const next = prev.map((d) => {
|
||||
if (d.id !== id) return d;
|
||||
const next =
|
||||
finalContent && finalContent.trim().length > 0
|
||||
? finalContent
|
||||
: d.content || "(无文本输出)";
|
||||
if (
|
||||
d.content === next &&
|
||||
d.confidence === (confidence ?? d.confidence) &&
|
||||
d.streaming === false
|
||||
) {
|
||||
return d;
|
||||
}
|
||||
changed = true;
|
||||
return {
|
||||
...d,
|
||||
content: next,
|
||||
confidence: confidence ?? d.confidence,
|
||||
streaming: false,
|
||||
};
|
||||
}),
|
||||
);
|
||||
});
|
||||
return changed ? next : prev;
|
||||
});
|
||||
},
|
||||
[],
|
||||
);
|
||||
@@ -2552,7 +2680,7 @@ export function useStep2Orchestration(
|
||||
seatSkillDirective: seatSkillDirectivesRef.current[agentId] ?? false,
|
||||
signal: subAborter.signal,
|
||||
// §6:并行席位走 ref 全量累积 + 节流 flush(只渲染选中的);单节点
|
||||
// stage 实际串行,1 路流直接 setState 不卡,沿用 appendToDialogue。
|
||||
// stage 也经 appendToDialogue 的节流缓冲,避免高频 SSE 帧嵌套更新。
|
||||
onModelSwitch: makeModelSwitchHandler(bubbleId, isParallel),
|
||||
onTextDelta: (text) =>
|
||||
isParallel ? ingestParallelDelta(bubbleId, text) : appendToDialogue(bubbleId, text),
|
||||
@@ -3182,6 +3310,7 @@ export function useStep2Orchestration(
|
||||
// 需要 ref 立刻可读到作业的真实线程,否则读到旧值导致接管失败。
|
||||
threadIdsRef.current = snapshot.threadIds;
|
||||
coordinatorNameRef.current = snapshot.coordinatorName;
|
||||
resetDirectStreamDeltas();
|
||||
// 历史快照是**静止记录**:任何残留「流式/加载中」的气泡(用户中途点了「停止」,
|
||||
// 或草稿在流式期间被自动保存)都强制收尾为静止态。否则用户点聊天记录回看时,这些
|
||||
// 气泡仍显示「调度中 / 等待响应 / 正在输出…」+ 加载光标,让人误以为还在进行(其实早已结束)。
|
||||
@@ -3203,15 +3332,14 @@ export function useStep2Orchestration(
|
||||
setConsensusPercentage(snapshot.consensusPercentage);
|
||||
setBudgetLimit(snapshot.budgetLimit);
|
||||
const restoredStubs = snapshot.seatStubMessages ?? {};
|
||||
seatStubMessagesRef.current = restoredStubs;
|
||||
setSeatStubMessages(restoredStubs);
|
||||
replaceSeatStubMessages(restoredStubs);
|
||||
// 草稿里历史 write_file 的虚拟 URL 与当前会话无关 —— 清空守卫,允许新 run 触发自动打开。
|
||||
hasAutoOpenedRef.current = new Set();
|
||||
// 调用方根据 furthestStep 决定是否置 init 闸门为已 init;这里默认置上,
|
||||
// 调用方需要的话再 resetInitGate()。
|
||||
step2InitRef.current = true;
|
||||
},
|
||||
[],
|
||||
[replaceSeatStubMessages, resetDirectStreamDeltas],
|
||||
);
|
||||
|
||||
// 「查看=恢复流程」:后台作业 SSE 帧 → 第二步实时画面(只更新展示数据,不动
|
||||
@@ -3225,13 +3353,12 @@ export function useStep2Orchestration(
|
||||
lastLeaderContent: string;
|
||||
}) => {
|
||||
setStep2RoundtableDialogues(frame.dialogues);
|
||||
seatStubMessagesRef.current = frame.seatStubMessages;
|
||||
setSeatStubMessages(frame.seatStubMessages);
|
||||
replaceSeatStubMessages(frame.seatStubMessages);
|
||||
setConsensusPercentage(frame.consensusPercentage);
|
||||
setHasConsensus(frame.hasConsensus);
|
||||
if (frame.lastLeaderContent) setLastLeaderContent(frame.lastLeaderContent);
|
||||
},
|
||||
[],
|
||||
[replaceSeatStubMessages],
|
||||
);
|
||||
|
||||
// 「后台挂起接管」:取消后端作业 + hydrateFromDraft(恢复作业真实线程/协调名/对话)后,
|
||||
@@ -3279,11 +3406,11 @@ export function useStep2Orchestration(
|
||||
setSelectedParallelSeats([]);
|
||||
setDagNodeStates({});
|
||||
resetParallelStreams();
|
||||
resetDirectStreamDeltas();
|
||||
setActiveArtifactThreadId(null);
|
||||
artifactPathsRef.current = [];
|
||||
setArtifacts([]);
|
||||
seatStubMessagesRef.current = {};
|
||||
setSeatStubMessages({});
|
||||
resetSeatStubMessages();
|
||||
hasAutoOpenedRef.current = new Set();
|
||||
pendingInjectPromptRef.current = null;
|
||||
dagPlanExecutedRef.current = false;
|
||||
@@ -3292,7 +3419,14 @@ export function useStep2Orchestration(
|
||||
gatheredDeliveriesRef.current = [];
|
||||
deselectArtifact();
|
||||
step2InitRef.current = false;
|
||||
}, [abortAllInFlight, deselectArtifact, setArtifacts, resetParallelStreams]);
|
||||
}, [
|
||||
abortAllInFlight,
|
||||
deselectArtifact,
|
||||
setArtifacts,
|
||||
resetParallelStreams,
|
||||
resetDirectStreamDeltas,
|
||||
resetSeatStubMessages,
|
||||
]);
|
||||
|
||||
return {
|
||||
selectedAgents,
|
||||
|
||||
@@ -16,16 +16,13 @@
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
|
||||
import { useArtifacts } from "@/components/workspace/artifacts";
|
||||
import { apiFetch } from "@/core/api";
|
||||
import { uploadFiles } from "@/core/uploads/api";
|
||||
import type {
|
||||
DraftStep3SummarySnapshot,
|
||||
} from "@/roundtable-planning/api/drafts";
|
||||
import {
|
||||
buildArtifactDownloadUrl,
|
||||
initStructureThread,
|
||||
initSummaryThread,
|
||||
listSessionArtifacts,
|
||||
streamMultiAgent,
|
||||
type StreamMultiAgentRequest,
|
||||
type StreamPhase,
|
||||
@@ -58,7 +55,7 @@ const SUMMARY_AGENT_NAME = "roundtable-summary";
|
||||
/** 结构化抽取智能体 id —— 入库轮由它(走 ingest run policy)真正调用入库技能。 */
|
||||
const STRUCTURE_AGENT_NAME = "roundtable-structure";
|
||||
|
||||
export type SummaryPhase = "idle" | "creating" | "streaming" | "done" | "error";
|
||||
export type SummaryPhase = "idle" | "creating" | "streaming" | "paused" | "done" | "error";
|
||||
|
||||
interface UseStep3SummaryOptions {
|
||||
intentReady: ReportIntent | null;
|
||||
@@ -78,6 +75,8 @@ interface UseStep3SummaryOptions {
|
||||
* 普通手动会商为 false —— 结构化输出仍按需(用户输入框打「流程图」才出)。
|
||||
*/
|
||||
autoFlow?: boolean;
|
||||
/** 第三步是否允许流程图分支。当前报告工作台只交付 Markdown,默认关闭。 */
|
||||
flowEnabled?: boolean;
|
||||
/** 草稿里已存的上次总结结果 —— 有则进入时恢复展示,不重新生成。 */
|
||||
savedSummary?: DraftStep3SummarySnapshot | null;
|
||||
/** 一次总结成功完成时回调(传出 md/thread/model/时间/收尾语),供上层存草稿。 */
|
||||
@@ -485,6 +484,7 @@ export function useStep3Summary(
|
||||
coordinatorPrompt,
|
||||
chainLevels,
|
||||
autoFlow,
|
||||
flowEnabled = false,
|
||||
savedSummary,
|
||||
onSummarySaved,
|
||||
ingestAvailable,
|
||||
@@ -573,6 +573,10 @@ export function useStep3Summary(
|
||||
>(null);
|
||||
|
||||
const stubRef = useRef<Record<string, StubAiMessage[]>>({});
|
||||
// write_file 会在流式过程中多次带回完整 tool_calls。stub 保持同步更新供预览读取,
|
||||
// React 状态则节流发布,避免每一个工具帧都触发沙箱和消息列表的同步重渲染。
|
||||
const pendingStubMessagesRef = useRef<Record<string, StubAiMessage[]> | null>(null);
|
||||
const stubFlushTimerRef = useRef<number | null>(null);
|
||||
const runningRef = useRef(false);
|
||||
const aborterRef = useRef<AbortController | null>(null);
|
||||
// 真线程(init 后或恢复时已知的后端 thread id)—— ask() 续问时复用它,保留报告上下文。
|
||||
@@ -589,6 +593,47 @@ export function useStep3Summary(
|
||||
// run() 的「自动出图」与用户「跳过报告直接生成流程图」的手动出图竞态,各自建卡片 → 双「调度中」。
|
||||
const flowAborterRef = useRef<AbortController | null>(null);
|
||||
const activeFlowBubbleRef = useRef<number | null>(null);
|
||||
const autoArtifactTimerRef = useRef<number | null>(null);
|
||||
|
||||
/** 将写文件预览以约 12fps 合并发布给 React,读取 stub 的流逻辑始终使用最新 ref。 */
|
||||
const flushStubMessages = useCallback(() => {
|
||||
stubFlushTimerRef.current = null;
|
||||
const pending = pendingStubMessagesRef.current;
|
||||
if (!pending) return;
|
||||
pendingStubMessagesRef.current = null;
|
||||
setSeatStubMessages((previous) => (previous === pending ? previous : pending));
|
||||
}, []);
|
||||
|
||||
const scheduleStubMessagesFlush = useCallback(() => {
|
||||
if (stubFlushTimerRef.current !== null) return;
|
||||
stubFlushTimerRef.current = window.setTimeout(flushStubMessages, 80);
|
||||
}, [flushStubMessages]);
|
||||
|
||||
/** 重置/恢复草稿时立即发布确定快照,同时取消未提交的流式预览。 */
|
||||
const replaceStubMessages = useCallback(
|
||||
(next: Record<string, StubAiMessage[]>) => {
|
||||
pendingStubMessagesRef.current = null;
|
||||
if (stubFlushTimerRef.current !== null) {
|
||||
window.clearTimeout(stubFlushTimerRef.current);
|
||||
stubFlushTimerRef.current = null;
|
||||
}
|
||||
stubRef.current = next;
|
||||
setSeatStubMessages((previous) => (previous === next ? previous : next));
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
useEffect(
|
||||
() => () => {
|
||||
if (stubFlushTimerRef.current !== null) {
|
||||
window.clearTimeout(stubFlushTimerRef.current);
|
||||
}
|
||||
if (autoArtifactTimerRef.current !== null) {
|
||||
window.clearTimeout(autoArtifactTimerRef.current);
|
||||
}
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
// ── 对话气泡三段式(append → delta → finalize)+ 工具步骤(与第 2 步同款)──
|
||||
const appendStreamingDialogue = useCallback(
|
||||
@@ -683,12 +728,15 @@ export function useStep3Summary(
|
||||
const steps: Step2Dialogue["steps"] = d.steps ?? [];
|
||||
const last = steps[steps.length - 1];
|
||||
if (last && last.key === key) {
|
||||
if (args && args !== last.args) {
|
||||
const next = [...steps];
|
||||
next[next.length - 1] = { ...last, args };
|
||||
return { ...d, steps: next };
|
||||
}
|
||||
return d;
|
||||
// write_file 的流式工具帧会反复带着新的 content 对象。步骤卡只需要
|
||||
// 首次拿到可见参数(如 path)时补充一次,正文已经由 stub 节流同步给沙箱。
|
||||
// 不能为每个 content chunk 更新对话 state,否则会造成嵌套更新风暴。
|
||||
const hasVisibleArgs = (value?: Record<string, unknown>) =>
|
||||
!!value && Object.keys(value).some((argKey) => argKey !== "content");
|
||||
if (hasVisibleArgs(last.args) || !hasVisibleArgs(args)) return d;
|
||||
const next = [...steps];
|
||||
next[next.length - 1] = { ...last, args };
|
||||
return { ...d, steps: next };
|
||||
}
|
||||
return {
|
||||
...d,
|
||||
@@ -762,14 +810,15 @@ export function useStep3Summary(
|
||||
const nextMsg: StubAiMessage = { ...base, tool_calls: nextToolCalls };
|
||||
const nextMap = { ...stubRef.current, [threadId]: [nextMsg] };
|
||||
stubRef.current = nextMap;
|
||||
setSeatStubMessages(nextMap);
|
||||
pendingStubMessagesRef.current = nextMap;
|
||||
scheduleStubMessagesFlush();
|
||||
// 记住当前报告全文(用于续问写底 / 存草稿)。
|
||||
if (typeof storeArgs.content === "string" && storeArgs.content.trim()) {
|
||||
currentMdRef.current = storeArgs.content;
|
||||
}
|
||||
return { messageId: nextMsg.id, toolCallId };
|
||||
},
|
||||
[],
|
||||
[scheduleStubMessagesFlush],
|
||||
);
|
||||
|
||||
const buildWriteFileVirtualUrl = useCallback(
|
||||
@@ -816,14 +865,36 @@ export function useStep3Summary(
|
||||
|
||||
const autoOpenArtifact = useCallback(
|
||||
(threadId: string, virtualUrl: string) => {
|
||||
lastAutoThreadRef.current = threadId;
|
||||
if (!previewEnabledRef.current) {
|
||||
// 视图不在前台:只记录,不抢沙箱(回到视图时 setPreviewEnabled 再接管)。
|
||||
lastAutoOpenedUrlRef.current = virtualUrl;
|
||||
lastAutoThreadRef.current = threadId;
|
||||
return;
|
||||
}
|
||||
if (lastAutoOpenedUrlRef.current === virtualUrl) return;
|
||||
openArtifact(threadId, virtualUrl);
|
||||
if (
|
||||
lastAutoOpenedUrlRef.current === virtualUrl &&
|
||||
lastAutoThreadRef.current === threadId
|
||||
) {
|
||||
return;
|
||||
}
|
||||
// onPhaseChange 在 SSE 回调栈中触发。延后一帧再打开沙箱,避免工具帧与
|
||||
// ArtifactProvider/Markdown 预览的状态更新嵌套在同一次 React 更新里。
|
||||
lastAutoOpenedUrlRef.current = virtualUrl;
|
||||
lastAutoThreadRef.current = threadId;
|
||||
if (autoArtifactTimerRef.current !== null) {
|
||||
window.clearTimeout(autoArtifactTimerRef.current);
|
||||
}
|
||||
autoArtifactTimerRef.current = window.setTimeout(() => {
|
||||
autoArtifactTimerRef.current = null;
|
||||
if (
|
||||
!previewEnabledRef.current ||
|
||||
lastAutoOpenedUrlRef.current !== virtualUrl ||
|
||||
lastAutoThreadRef.current !== threadId
|
||||
) {
|
||||
return;
|
||||
}
|
||||
openArtifact(threadId, virtualUrl);
|
||||
}, 80);
|
||||
},
|
||||
[openArtifact],
|
||||
);
|
||||
@@ -953,61 +1024,24 @@ export function useStep3Summary(
|
||||
[upsertStub, buildWriteFileVirtualUrl, openArtifact, openArtifactPreview],
|
||||
);
|
||||
|
||||
const openRealArtifactFallback = useCallback(
|
||||
async (threadId: string) => {
|
||||
if (!previewEnabledRef.current) return; // 不在前台不抢沙箱
|
||||
try {
|
||||
const res = await listSessionArtifacts(threadId);
|
||||
const file = res.files.find((f) => /\.md$/i.test(f.name)) ?? res.files[0];
|
||||
if (!file) return;
|
||||
setActiveArtifactThreadId(threadId);
|
||||
setArtifacts([file.path]);
|
||||
selectArtifact(file.path, false);
|
||||
setArtifactsOpen(true);
|
||||
} catch {
|
||||
/* 列文件失败就保持当前状态 */
|
||||
}
|
||||
},
|
||||
[setArtifacts, selectArtifact, setArtifactsOpen],
|
||||
);
|
||||
|
||||
// 收尾对账:以沙箱真实 md 文件为准回灌 stub,拿到完整 Markdown。
|
||||
// `force` 用于 ask():增量改后文件可能等长/更短,长度守卫会挡掉改动,故强制以真实文件为准。
|
||||
// 收尾时直接使用流式 write_file 捕获的 Markdown。当前任务沙箱的文件列表与下载
|
||||
// 端点不是同一套存储:列表返回的 /mnt/... 路径会被预览器拿去请求 /artifacts/mnt/...
|
||||
// 并稳定返回 404。此处若再尝试“真实文件对账”,既拿不到更完整的内容,还会触发
|
||||
// 预览器的失败重试和状态更新循环。write_file 的 stub 在每个上游帧同步更新,因此它
|
||||
// 是本步骤报告的唯一预览/保存来源。
|
||||
const reconcileStubFromRealFile = useCallback(
|
||||
async (
|
||||
threadId: string,
|
||||
opts?: { signal?: AbortSignal; force?: boolean },
|
||||
_opts?: { signal?: AbortSignal; force?: boolean },
|
||||
): Promise<string> => {
|
||||
const writeTc = stubRef.current[threadId]?.[0]?.tool_calls.find(
|
||||
(tc) => tc.name === "write_file",
|
||||
);
|
||||
const stubPath =
|
||||
typeof (writeTc?.args as { path?: unknown })?.path === "string"
|
||||
? ((writeTc!.args as { path?: string }).path as string)
|
||||
: SUMMARY_OUTPUT_PATH;
|
||||
const stubContent =
|
||||
typeof (writeTc?.args as { content?: unknown })?.content === "string"
|
||||
? ((writeTc!.args as { content?: string }).content as string)
|
||||
: "";
|
||||
try {
|
||||
const list = await listSessionArtifacts(threadId, { signal: opts?.signal });
|
||||
const mdFile = list.files.find((f) => /\.md$/i.test(f.name)) ?? null;
|
||||
if (!mdFile) return stubContent;
|
||||
const res = await apiFetch(buildArtifactDownloadUrl(threadId, mdFile.path), {
|
||||
signal: opts?.signal,
|
||||
});
|
||||
if (!res.ok) return stubContent;
|
||||
const real = await res.text();
|
||||
if (real.trim() && (opts?.force || real.length > stubContent.length)) {
|
||||
upsertStub(threadId, "write_file", { path: stubPath, content: real });
|
||||
return real;
|
||||
}
|
||||
} catch {
|
||||
/* 拉取失败退回 stub 内容 */
|
||||
}
|
||||
return stubContent;
|
||||
return typeof (writeTc?.args as { content?: unknown })?.content === "string"
|
||||
? ((writeTc!.args as { content?: string }).content as string)
|
||||
: "";
|
||||
},
|
||||
[upsertStub],
|
||||
[],
|
||||
);
|
||||
|
||||
const abort = useCallback(() => {
|
||||
@@ -1112,11 +1146,8 @@ export function useStep3Summary(
|
||||
});
|
||||
if (aborter.signal.aborted) return;
|
||||
|
||||
const hasStubFile = (stubRef.current[threadId]?.[0]?.tool_calls.length ?? 0) > 0;
|
||||
// 流程图轮本就不产文件,不要去沙箱兜底翻文件(也避免把别的文件弹出来)。
|
||||
if (!hasStubFile && !seedThreadId && !flowRound) await openRealArtifactFallback(threadId);
|
||||
|
||||
// 以真实 md 回灌 stub,拿到完整报告(ask 强制对账,防增量改后被长度守卫挡掉)。
|
||||
// 以流式 write_file stub 收尾。不要把沙箱文件列表返回的真实路径塞给全局预览:
|
||||
// 该路径在 artifacts 下载端点不存在,会导致 404 与预览循环。
|
||||
const md = await reconcileStubFromRealFile(threadId, {
|
||||
signal: aborter.signal,
|
||||
force: forceReconcile,
|
||||
@@ -1155,7 +1186,6 @@ export function useStep3Summary(
|
||||
appendStepIfNew,
|
||||
handleArtifactToolPhase,
|
||||
handleUpstreamFrame,
|
||||
openRealArtifactFallback,
|
||||
reconcileStubFromRealFile,
|
||||
finalizeDialogue,
|
||||
seedStubWithCurrentMd,
|
||||
@@ -1301,6 +1331,9 @@ export function useStep3Summary(
|
||||
|
||||
/** 仅重新生成流程图(不重跑 md 报告):模型挂了切模型后重试 / 手动重画。 */
|
||||
const regenerateFlow = useCallback(() => {
|
||||
// 第三步报告工作台已关闭流程图交付。历史草稿/旧按钮即使仍持有这个回调,
|
||||
// 也不能在总结收尾后意外启动结构化抽取。
|
||||
if (!flowEnabled) return;
|
||||
if (!currentMdRef.current.trim() && seatDeliveries.length === 0) return;
|
||||
aborterRef.current?.abort();
|
||||
// 重画流程图 = 重新分析 → 先复位入库状态(隐藏旧图的入库询问/按钮),新图生成完会重新询问。
|
||||
@@ -1308,7 +1341,7 @@ export function useStep3Summary(
|
||||
const aborter = new AbortController();
|
||||
aborterRef.current = aborter;
|
||||
void runFlowExtract(aborter);
|
||||
}, [runFlowExtract, seatDeliveries, resetIngestState]);
|
||||
}, [flowEnabled, runFlowExtract, seatDeliveries, resetIngestState]);
|
||||
|
||||
/** Phase 3:画布手动改/删节点后回写图 + 持久化(序列化进草稿快照)。 */
|
||||
const updateFlowGraph = useCallback(
|
||||
@@ -1335,10 +1368,10 @@ export function useStep3Summary(
|
||||
setPhase("creating");
|
||||
setDialogues([]);
|
||||
lastAutoOpenedUrlRef.current = null;
|
||||
stubRef.current = {};
|
||||
lastAutoThreadRef.current = null;
|
||||
replaceStubMessages({});
|
||||
currentMdRef.current = "";
|
||||
liveThreadRef.current = null;
|
||||
setSeatStubMessages({});
|
||||
setFlowGraphState(null);
|
||||
setFlowPhase("idle");
|
||||
// 清空对话同时复位流程图串行化句柄(旧气泡已随 setDialogues([]) 移除,不能再被复用)。
|
||||
@@ -1359,7 +1392,7 @@ export function useStep3Summary(
|
||||
try {
|
||||
// 编排提示里明确要求了结构化输出/流程图 → 首轮就走流程图模式(不写 md,直出 flow-json)。
|
||||
// 但 autoFlow(taskId/深链)模式要「先 md 再结构化输出」,故首轮强制走 md(忽略 detectFlowIntent)。
|
||||
const flowMode = !autoFlow && detectFlowIntent(coordinatorPrompt);
|
||||
const flowMode = flowEnabled && !autoFlow && detectFlowIntent(coordinatorPrompt);
|
||||
flowActiveRef.current = flowMode; // 流式结束后会按真实产物校正
|
||||
const prompt = buildSummaryPrompt({
|
||||
intentReady,
|
||||
@@ -1381,6 +1414,7 @@ export function useStep3Summary(
|
||||
// ask() 会先 abort() 本轮(aborterRef 被置空/换成新 aborter)→ 这里不再自动出图,
|
||||
// 由 ask 的手动出图独占,避免 auto + manual 双卡片。
|
||||
if (
|
||||
flowEnabled &&
|
||||
autoFlow &&
|
||||
!aborter.signal.aborted &&
|
||||
aborterRef.current === aborter &&
|
||||
@@ -1404,11 +1438,13 @@ export function useStep3Summary(
|
||||
consensusText,
|
||||
coordinatorPrompt,
|
||||
autoFlow,
|
||||
flowEnabled,
|
||||
appendStreamingDialogue,
|
||||
finalizeDialogue,
|
||||
streamOnce,
|
||||
runFlowExtract,
|
||||
resetIngestState,
|
||||
replaceStubMessages,
|
||||
]);
|
||||
|
||||
/**
|
||||
@@ -1566,6 +1602,12 @@ export function useStep3Summary(
|
||||
(choice: "generate" | "cancel") => {
|
||||
setPendingFlowForIngest(false);
|
||||
if (choice === "generate") {
|
||||
if (!flowEnabled) {
|
||||
// 老草稿可能遗留「先生成流程图再入库」的协助卡;报告模式不再提供这条链路。
|
||||
setIngestStatus("later");
|
||||
persistSummary();
|
||||
return;
|
||||
}
|
||||
// 重置为 idle —— 流程图生成完成后 runFlowExtract 在 idle 时会自动询问入库。
|
||||
setIngestStatus("idle");
|
||||
regenerateFlow();
|
||||
@@ -1660,6 +1702,11 @@ export function useStep3Summary(
|
||||
await runIngest();
|
||||
return;
|
||||
}
|
||||
// 当前第三步只维护 Markdown 报告。即使意图分类命中旧的流程图关键词,
|
||||
// 也按“重写报告”处理,绝不启动流程图抽取请求。
|
||||
if (!flowEnabled && (intent === "regenerate_flow" || intent === "modify_flow")) {
|
||||
intent = "regenerate_report";
|
||||
}
|
||||
if (intent === "regenerate_flow" || intent === "modify_flow") {
|
||||
// 重新/修改流程图 = 重新分析 → 先复位入库状态(隐藏旧图入库询问/按钮),
|
||||
// runFlowExtract 出新图后会在 idle 时重新询问是否入库。
|
||||
@@ -1809,6 +1856,7 @@ export function useStep3Summary(
|
||||
runFlowExtract,
|
||||
runIngest,
|
||||
resetIngestState,
|
||||
flowEnabled,
|
||||
],
|
||||
);
|
||||
|
||||
@@ -1835,12 +1883,15 @@ export function useStep3Summary(
|
||||
[pendingFlowClarification, ask],
|
||||
);
|
||||
|
||||
/** 暂停当前生成:中断在途请求 + 把流式气泡收尾为「已暂停」+ 状态回 done。 */
|
||||
/** 暂停当前生成:中断在途请求 + 把流式气泡收尾为「已暂停」。 */
|
||||
const pause = useCallback(() => {
|
||||
if (!runningRef.current) return;
|
||||
abort();
|
||||
flowAborterRef.current?.abort();
|
||||
flowAborterRef.current = null;
|
||||
ingestRunRef.current += 1;
|
||||
freezeStreaming("已暂停");
|
||||
setPhase((p) => (p === "creating" || p === "streaming" ? "done" : p));
|
||||
setPhase("paused");
|
||||
setFlowPhase((p) => (p === "extracting" || p === "validating" ? "idle" : p));
|
||||
}, [abort, freezeStreaming]);
|
||||
|
||||
const start = useCallback(() => {
|
||||
@@ -1902,7 +1953,7 @@ export function useStep3Summary(
|
||||
// 合并:合成 stub 保住「恢复后预览」锚点,历史 stub 保住各气泡步骤卡的真线程预览。
|
||||
const effectiveStub =
|
||||
savedStubs && Object.keys(savedStubs).length ? { ...stub, ...savedStubs } : stub;
|
||||
stubRef.current = effectiveStub;
|
||||
replaceStubMessages(effectiveStub);
|
||||
currentMdRef.current = snap.md;
|
||||
liveThreadRef.current = realThreadId;
|
||||
// 快照收尾语带 flow-json → 上次主产物是流程图,恢复后续问沿用流程图语境。
|
||||
@@ -1919,7 +1970,6 @@ export function useStep3Summary(
|
||||
lastAutoOpenedUrlRef.current = null;
|
||||
lastAutoThreadRef.current = null;
|
||||
}
|
||||
setSeatStubMessages(effectiveStub);
|
||||
setSummaryThreadId(synthThreadId);
|
||||
setActiveArtifactThreadId(synthThreadId);
|
||||
|
||||
@@ -1962,7 +2012,7 @@ export function useStep3Summary(
|
||||
// 写文件(live write_file 流式)时才自动打开;恢复历史时用户点气泡里的
|
||||
// 「点击预览」步骤卡随时可开(stub 已种好)。
|
||||
},
|
||||
[abort, buildWriteFileVirtualUrl],
|
||||
[abort, buildWriteFileVirtualUrl, replaceStubMessages],
|
||||
);
|
||||
|
||||
const busy = phase === "creating" || phase === "streaming";
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
|
||||
import { apiFetch } from "@/core/api/fetch-client";
|
||||
import {
|
||||
listRoundtableArtifactSubmissions,
|
||||
saveRoundtableArtifactSubmission,
|
||||
type RoundtableArtifactReference,
|
||||
type RoundtableArtifactSubmissionRecord,
|
||||
} from "@/roundtable-planning/api/artifact-submissions";
|
||||
import { buildArtifactDownloadUrl, type ThreadIdMap } from "@/roundtable-planning/api/multi-agent";
|
||||
import type {
|
||||
TaskArtifactSubmissionConfig,
|
||||
TaskArtifactSubmissionController,
|
||||
TaskArtifactSubmissionState,
|
||||
TaskArtifactTarget,
|
||||
TaskProcessReportPayload,
|
||||
} from "@/roundtable-planning/lib/task-artifact-submission";
|
||||
|
||||
type StatusEntry = {
|
||||
state: TaskArtifactSubmissionState;
|
||||
error: string | null;
|
||||
record?: RoundtableArtifactSubmissionRecord;
|
||||
};
|
||||
|
||||
function normalizedPath(path: string): string {
|
||||
const trimmed = path.trim();
|
||||
if (!trimmed.startsWith("write-file:")) return trimmed;
|
||||
try {
|
||||
return decodeURIComponent(new URL(trimmed).pathname).trim();
|
||||
} catch {
|
||||
return trimmed;
|
||||
}
|
||||
}
|
||||
|
||||
function fileName(path: string): string {
|
||||
const normalized = normalizedPath(path);
|
||||
return normalized.split("/").filter(Boolean).pop() || normalized || "产物.md";
|
||||
}
|
||||
|
||||
function isMarkdownTarget(target: TaskArtifactTarget): boolean {
|
||||
return /\.(md|markdown)$/i.test(normalizedPath(target.path))
|
||||
|| target.mimeType?.toLowerCase().includes("markdown") === true;
|
||||
}
|
||||
|
||||
function recordKey(target: TaskArtifactTarget): string {
|
||||
const source = target.agentId?.trim() || `thread:${target.threadId}`;
|
||||
return `${source}\u001f${normalizedPath(target.path)}\u001f0`;
|
||||
}
|
||||
|
||||
function payloadFrom(
|
||||
config: TaskArtifactSubmissionConfig,
|
||||
target: TaskArtifactTarget,
|
||||
content: string,
|
||||
submitStatus: 0 | 1,
|
||||
): TaskProcessReportPayload {
|
||||
const name = target.name?.trim() || fileName(target.path);
|
||||
const agentId = target.agentId?.trim() || target.threadId;
|
||||
return {
|
||||
taskId: config.taskId,
|
||||
agentId,
|
||||
agentName: target.agentName?.trim() || agentId,
|
||||
content,
|
||||
position: config.position,
|
||||
reportName: name,
|
||||
submitStatus,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Bridges the task system's process-report API and DeerFlow's task-scoped
|
||||
* submission ledger. The ledger is read on mount, so "已提交" survives reloads
|
||||
* and is shared by all users opening the same task.
|
||||
*/
|
||||
export function useTaskArtifactSubmission(
|
||||
config: TaskArtifactSubmissionConfig | undefined,
|
||||
threadIds: ThreadIdMap | null,
|
||||
agentNameToRole: Record<string, { displayName: string }> | undefined,
|
||||
): TaskArtifactSubmissionController | undefined {
|
||||
const [entries, setEntries] = useState<Record<string, StatusEntry>>({});
|
||||
const entriesRef = useRef(entries);
|
||||
entriesRef.current = entries;
|
||||
const pendingRef = useRef(new Map<string, Promise<RoundtableArtifactSubmissionRecord | null>>());
|
||||
|
||||
const resolveTarget = useCallback((target: TaskArtifactTarget): TaskArtifactTarget => {
|
||||
const normalized = normalizedPath(target.path);
|
||||
const matchedAgentId = target.agentId || Object.entries(threadIds ?? {})
|
||||
.find(([, threadId]) => threadId === target.threadId)?.[0];
|
||||
const role = matchedAgentId ? agentNameToRole?.[matchedAgentId.toLowerCase()] : undefined;
|
||||
return {
|
||||
...target,
|
||||
path: normalized,
|
||||
name: target.name || fileName(normalized),
|
||||
mimeType: target.mimeType || (isMarkdownTarget({ ...target, path: normalized }) ? "text/markdown" : null),
|
||||
agentId: matchedAgentId || target.threadId,
|
||||
agentName: target.agentName || role?.displayName || matchedAgentId || target.threadId,
|
||||
};
|
||||
}, [agentNameToRole, threadIds]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!config?.taskId) {
|
||||
setEntries({});
|
||||
return;
|
||||
}
|
||||
let cancelled = false;
|
||||
void Promise.all([
|
||||
listRoundtableArtifactSubmissions(config.taskId, true),
|
||||
listRoundtableArtifactSubmissions(config.taskId, false),
|
||||
]).then(([submitted, registered]) => {
|
||||
if (cancelled) return;
|
||||
const next: Record<string, StatusEntry> = {};
|
||||
for (const record of [...submitted, ...registered]) {
|
||||
const key = `${record.artifact.sourceKey}\u001f${normalizedPath(record.artifact.path)}\u001f${record.artifact.revision}`;
|
||||
next[key] = {
|
||||
state: record.submitted ? "submitted" : "idle",
|
||||
error: null,
|
||||
record,
|
||||
};
|
||||
}
|
||||
setEntries(next);
|
||||
}).catch((error) => {
|
||||
// State recovery is additive. A transient read failure must not prevent a
|
||||
// user from submitting a Markdown artifact from the current session.
|
||||
console.warn("[roundtable] 读取任务产物提交状态失败", error);
|
||||
});
|
||||
return () => { cancelled = true; };
|
||||
}, [config?.taskId]);
|
||||
|
||||
const submit = useCallback(async (rawTarget: TaskArtifactTarget) => {
|
||||
if (!config || !isMarkdownTarget(rawTarget)) return null;
|
||||
const target = resolveTarget(rawTarget);
|
||||
const key = recordKey(target);
|
||||
const existingPending = pendingRef.current.get(key);
|
||||
if (existingPending) return existingPending;
|
||||
const existing = entriesRef.current[key];
|
||||
if (existing?.state === "submitted" && existing.record) return existing.record;
|
||||
|
||||
const operation = (async () => {
|
||||
setEntries((current) => ({ ...current, [key]: { ...current[key], state: "submitting", error: null } }));
|
||||
try {
|
||||
let content = target.content;
|
||||
if (content == null) {
|
||||
const response = await apiFetch(buildArtifactDownloadUrl(target.threadId, target.path), { method: "GET" });
|
||||
if (!response.ok) throw new Error(`读取 Markdown 产物失败(${response.status})`);
|
||||
content = await response.text();
|
||||
}
|
||||
|
||||
let record = entriesRef.current[key]?.record;
|
||||
let reportId = record?.taskDeliveryId || undefined;
|
||||
if (!reportId) {
|
||||
const receipt = await config.createProcessReport(payloadFrom(config, target, content, 0));
|
||||
reportId = receipt.id;
|
||||
const artifact: RoundtableArtifactReference = {
|
||||
threadId: target.threadId,
|
||||
sourceKey: target.agentId || `thread:${target.threadId}`,
|
||||
path: target.path,
|
||||
name: target.name || fileName(target.path),
|
||||
mimeType: target.mimeType || "text/markdown",
|
||||
revision: 0,
|
||||
};
|
||||
record = await saveRoundtableArtifactSubmission(config.taskId, {
|
||||
submitted: false,
|
||||
registerOnly: true,
|
||||
taskDeliveryId: reportId,
|
||||
artifact,
|
||||
});
|
||||
}
|
||||
|
||||
await config.updateProcessReport(reportId, payloadFrom(config, target, content, 1));
|
||||
const submitted = await saveRoundtableArtifactSubmission(config.taskId, {
|
||||
submitted: true,
|
||||
taskDeliveryId: reportId,
|
||||
expectedVersion: record?.version,
|
||||
artifact: {
|
||||
threadId: target.threadId,
|
||||
sourceKey: target.agentId || `thread:${target.threadId}`,
|
||||
path: target.path,
|
||||
name: target.name || fileName(target.path),
|
||||
mimeType: target.mimeType || "text/markdown",
|
||||
revision: 0,
|
||||
},
|
||||
});
|
||||
setEntries((current) => ({ ...current, [key]: { state: "submitted", error: null, record: submitted } }));
|
||||
return submitted;
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : "提交产物失败,请重试";
|
||||
setEntries((current) => ({ ...current, [key]: { ...current[key], state: "error", error: message } }));
|
||||
throw error;
|
||||
} finally {
|
||||
pendingRef.current.delete(key);
|
||||
}
|
||||
})();
|
||||
pendingRef.current.set(key, operation);
|
||||
return operation;
|
||||
}, [config, resolveTarget]);
|
||||
|
||||
const submittedRecords = useMemo(
|
||||
() => Object.values(entries)
|
||||
.filter((entry) => entry.state === "submitted" && entry.record?.submitted)
|
||||
.map((entry) => entry.record as RoundtableArtifactSubmissionRecord),
|
||||
[entries],
|
||||
);
|
||||
|
||||
return useMemo(() => {
|
||||
if (!config) return undefined;
|
||||
return {
|
||||
enabled: true,
|
||||
isMarkdown: isMarkdownTarget,
|
||||
targetFor: resolveTarget,
|
||||
stateFor: (target) => entries[recordKey(resolveTarget(target))]?.state || "idle",
|
||||
errorFor: (target) => entries[recordKey(resolveTarget(target))]?.error || null,
|
||||
submit,
|
||||
submittedRecords,
|
||||
} satisfies TaskArtifactSubmissionController;
|
||||
}, [config, entries, resolveTarget, submit, submittedRecords]);
|
||||
}
|
||||
@@ -55,6 +55,11 @@ export interface ChainSeat {
|
||||
* 使同一条业务链既能继续用于原会商,也能在岗位协同中按岗位筛选可问答的智能体。
|
||||
*/
|
||||
position_id?: string | null;
|
||||
/**
|
||||
* 该席位在业务链中配置的岗位职责。会商「智能体配置」面板只读展示;
|
||||
* 随 `seats` JSON 落库(无需 DB 列)。空 / 缺省 = 未填写。
|
||||
*/
|
||||
job_responsibilities?: string | null;
|
||||
}
|
||||
|
||||
/** 一条可复用的业务链条(与后端 `/api/roundtable-chains` 记录对应)。 */
|
||||
@@ -95,6 +100,11 @@ export interface BusinessChain {
|
||||
gatherFirst?: boolean;
|
||||
/** 是否已发布为公共(所有账号可在「公共」筛选查看 / 选入研讨)。 */
|
||||
isPublic?: boolean;
|
||||
/**
|
||||
* 启停状态。缺省 / undefined = 启用(存量链条无该字段时按启用处理)。
|
||||
* 停用后管理弹窗仍可见,选链弹窗 / 公共入口不再选用。
|
||||
*/
|
||||
enabled?: boolean;
|
||||
/** 是否当前用户所有(仅本人可编辑 / 删除 / 发布;公共筛选里别人的链条为 false)。 */
|
||||
isMine?: boolean;
|
||||
/** 配置者(owner)的可读用户名(后端解析的 email);解析失败时为空。 */
|
||||
@@ -151,6 +161,11 @@ export interface SeatSelectionResult {
|
||||
export const CHAIN_MIN_SEATS = 2;
|
||||
export const CHAIN_MAX_SEATS = 20;
|
||||
|
||||
/** 启停状态:缺省 / undefined 视为启用(存量链条无该字段)。 */
|
||||
export function isChainEnabled(chain: Pick<BusinessChain, "enabled">): boolean {
|
||||
return chain.enabled !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 由一条业务链条 + 当前候选智能体,构造 `SeatSelectionResult`。
|
||||
*
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
import type { RoundtableArtifactSubmissionRecord } from "@/roundtable-planning/api/artifact-submissions";
|
||||
import type { ThreadIdMap } from "@/roundtable-planning/api/multi-agent";
|
||||
import type { ChainSeat } from "@/roundtable-planning/lib/business-chain";
|
||||
import { getDisplayNameFor, type SelectedAgent } from "@/roundtable-planning/lib/roundtable-constants";
|
||||
|
||||
function norm(value: string | null | undefined): string {
|
||||
return (value ?? "").trim().toLowerCase();
|
||||
}
|
||||
|
||||
function sourceKeyOf(record: RoundtableArtifactSubmissionRecord): string {
|
||||
const raw = (record.artifact.sourceKey ?? "").trim();
|
||||
if (!raw || raw.toLowerCase().startsWith("thread:")) return "";
|
||||
return raw;
|
||||
}
|
||||
|
||||
/**
|
||||
* Match a chain seat to a submitted Markdown artifact.
|
||||
*
|
||||
* Submissions are keyed by the graph agent name (`threadIds` key) or UUID;
|
||||
* chain seats expose both `agent_id` and display `name`.
|
||||
*/
|
||||
export function findSeatSubmission(
|
||||
seat: ChainSeat,
|
||||
records: RoundtableArtifactSubmissionRecord[],
|
||||
selectedAgents: SelectedAgent[],
|
||||
threadIds: ThreadIdMap | null,
|
||||
): RoundtableArtifactSubmissionRecord | null {
|
||||
const selected = selectedAgents.find((agent) => agent.agent_id === seat.agent_id);
|
||||
const aliases = new Set(
|
||||
[
|
||||
seat.agent_id,
|
||||
seat.name,
|
||||
selected?.agent_id,
|
||||
selected?.name,
|
||||
selected ? getDisplayNameFor(selected) : "",
|
||||
]
|
||||
.map(norm)
|
||||
.filter(Boolean),
|
||||
);
|
||||
|
||||
const hits = records.filter((record) => {
|
||||
if (!record.submitted) return false;
|
||||
const sourceKey = norm(sourceKeyOf(record));
|
||||
if (sourceKey && aliases.has(sourceKey)) return true;
|
||||
if (!threadIds) return false;
|
||||
const owner = Object.entries(threadIds).find(([, id]) => id === record.artifact.threadId)?.[0];
|
||||
if (owner && aliases.has(norm(owner))) return true;
|
||||
for (const alias of aliases) {
|
||||
const mapped = threadIds[alias];
|
||||
if (mapped && mapped === record.artifact.threadId) return true;
|
||||
}
|
||||
const byName = threadIds[seat.name] ?? (selected ? threadIds[selected.name] : undefined);
|
||||
return Boolean(byName && byName === record.artifact.threadId);
|
||||
});
|
||||
|
||||
if (hits.length === 0) return null;
|
||||
return hits
|
||||
.slice()
|
||||
.sort((a, b) => (b.submittedAt ?? "").localeCompare(a.submittedAt ?? ""))[0] ?? null;
|
||||
}
|
||||
|
||||
/** Identity keys the flowchart can match against `seat.agent_id` / `seat.name`. */
|
||||
export function submittedSeatKeysFor(
|
||||
seats: ChainSeat[],
|
||||
records: RoundtableArtifactSubmissionRecord[],
|
||||
selectedAgents: SelectedAgent[],
|
||||
threadIds: ThreadIdMap | null,
|
||||
): string[] {
|
||||
const keys = new Set<string>();
|
||||
for (const record of records) {
|
||||
if (!record.submitted) continue;
|
||||
const sourceKey = sourceKeyOf(record);
|
||||
if (sourceKey) keys.add(norm(sourceKey));
|
||||
if (threadIds) {
|
||||
const owner = Object.entries(threadIds).find(([, id]) => id === record.artifact.threadId)?.[0];
|
||||
if (owner) keys.add(norm(owner));
|
||||
}
|
||||
}
|
||||
for (const seat of seats) {
|
||||
if (!findSeatSubmission(seat, records, selectedAgents, threadIds)) continue;
|
||||
keys.add(norm(seat.agent_id));
|
||||
if (seat.name) keys.add(norm(seat.name));
|
||||
}
|
||||
for (const agent of selectedAgents) {
|
||||
const seat = { agent_id: agent.agent_id, name: agent.name };
|
||||
if (!findSeatSubmission(seat, records, selectedAgents, threadIds)) continue;
|
||||
keys.add(norm(agent.agent_id));
|
||||
keys.add(norm(agent.name));
|
||||
keys.add(norm(getDisplayNameFor(agent)));
|
||||
}
|
||||
return [...keys];
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import type { RoundtableArtifactSubmissionRecord } from "@/roundtable-planning/api/artifact-submissions";
|
||||
|
||||
export interface TaskProcessReportPayload {
|
||||
taskId: string;
|
||||
agentId: string;
|
||||
agentName: string;
|
||||
content: string;
|
||||
position: number;
|
||||
reportName: string;
|
||||
submitStatus: 0 | 1;
|
||||
}
|
||||
|
||||
export interface TaskArtifactSubmissionConfig {
|
||||
/** External task-system id, not the local roundtable draft storage key. */
|
||||
taskId: string;
|
||||
position: number;
|
||||
createProcessReport: (payload: TaskProcessReportPayload) => Promise<{ id: string }>;
|
||||
updateProcessReport: (reportId: string, payload: TaskProcessReportPayload) => Promise<void>;
|
||||
}
|
||||
|
||||
export interface TaskArtifactTarget {
|
||||
threadId: string;
|
||||
path: string;
|
||||
name?: string;
|
||||
mimeType?: string | null;
|
||||
agentId?: string;
|
||||
agentName?: string;
|
||||
content?: string;
|
||||
}
|
||||
|
||||
export type TaskArtifactSubmissionState = "idle" | "submitting" | "submitted" | "error";
|
||||
|
||||
export interface TaskArtifactSubmissionController {
|
||||
enabled: boolean;
|
||||
isMarkdown: (target: TaskArtifactTarget) => boolean;
|
||||
targetFor: (target: TaskArtifactTarget) => TaskArtifactTarget;
|
||||
stateFor: (target: TaskArtifactTarget) => TaskArtifactSubmissionState;
|
||||
errorFor: (target: TaskArtifactTarget) => string | null;
|
||||
submit: (target: TaskArtifactTarget) => Promise<RoundtableArtifactSubmissionRecord | null>;
|
||||
/** Task-scoped ledger rows that have been formally submitted. */
|
||||
submittedRecords: RoundtableArtifactSubmissionRecord[];
|
||||
}
|
||||
@@ -476,6 +476,19 @@ export default function BusinessChainEditorPage() {
|
||||
);
|
||||
}, []);
|
||||
|
||||
const setSeatJobResponsibilitiesCb = useCallback((agentId: string, jobResponsibilities: string) => {
|
||||
setStageGroups((prev) =>
|
||||
prev.map((group) => ({
|
||||
...group,
|
||||
seats: group.seats.map((seat) =>
|
||||
seat.agent_id === agentId
|
||||
? { ...seat, job_responsibilities: jobResponsibilities }
|
||||
: seat,
|
||||
),
|
||||
})),
|
||||
);
|
||||
}, []);
|
||||
|
||||
// ── 提示词 AI 优化(总控提示词 / 各 Stage 阶段目标)────────────────────────
|
||||
const [optimizingCoordinator, setOptimizingCoordinator] = useState(false);
|
||||
const [goalOptimizingIdx, setGoalOptimizingIdx] = useState<number | null>(null);
|
||||
@@ -681,6 +694,8 @@ export default function BusinessChainEditorPage() {
|
||||
seat_mode: s.seat_mode ?? null,
|
||||
// 岗位协同专用岗位归属:普通圆桌忽略,但保存时必须原样保留。
|
||||
position_id: s.position_id ?? null,
|
||||
// 业务链席位岗位职责:会商智能体配置面板只读展示。
|
||||
job_responsibilities: s.job_responsibilities?.trim() || null,
|
||||
};
|
||||
});
|
||||
// 总控编排提示:trim 后空串落 null(清空),与后端「空=不注入」一致。
|
||||
@@ -1284,6 +1299,7 @@ export default function BusinessChainEditorPage() {
|
||||
positionConfigMode={positionConfigMode}
|
||||
positionOptions={positionOptions}
|
||||
onSeatPositionChange={setSeatPositionCb}
|
||||
onSeatJobResponsibilitiesChange={setSeatJobResponsibilitiesCb}
|
||||
onStageGoalChange={setGoal}
|
||||
goalOptimizingIdx={goalOptimizingIdx}
|
||||
onOptimizeGoal={handleOptimizeStageGoal}
|
||||
@@ -1468,6 +1484,7 @@ function StagesColumn({
|
||||
positionConfigMode,
|
||||
positionOptions,
|
||||
onSeatPositionChange,
|
||||
onSeatJobResponsibilitiesChange,
|
||||
onStageGoalChange,
|
||||
goalOptimizingIdx,
|
||||
onOptimizeGoal,
|
||||
@@ -1492,6 +1509,7 @@ function StagesColumn({
|
||||
/** Live directory from the administrator's position-role configuration. */
|
||||
positionOptions: readonly PositionOption[];
|
||||
onSeatPositionChange: (agentId: string, positionId: PositionId | null) => void;
|
||||
onSeatJobResponsibilitiesChange: (agentId: string, jobResponsibilities: string) => void;
|
||||
onStageGoalChange: (stageIdx: number, goal: string) => void;
|
||||
/** 正在 AI 优化阶段目标的 stage 下标(null = 没有进行中的优化)。 */
|
||||
goalOptimizingIdx: number | null;
|
||||
@@ -1601,6 +1619,7 @@ function StagesColumn({
|
||||
positionConfigMode={positionConfigMode}
|
||||
positionOptions={positionOptions}
|
||||
onSeatPositionChange={onSeatPositionChange}
|
||||
onSeatJobResponsibilitiesChange={onSeatJobResponsibilitiesChange}
|
||||
onGoalChange={(goal) => onStageGoalChange(stageIdx, goal)}
|
||||
goalOptimizing={goalOptimizingIdx === stageIdx}
|
||||
anyGoalOptimizing={goalOptimizingIdx !== null}
|
||||
@@ -1636,6 +1655,7 @@ function StageSection({
|
||||
positionConfigMode,
|
||||
positionOptions,
|
||||
onSeatPositionChange,
|
||||
onSeatJobResponsibilitiesChange,
|
||||
onGoalChange,
|
||||
goalOptimizing,
|
||||
anyGoalOptimizing,
|
||||
@@ -1660,6 +1680,7 @@ function StageSection({
|
||||
positionConfigMode: boolean;
|
||||
positionOptions: readonly PositionOption[];
|
||||
onSeatPositionChange: (agentId: string, positionId: PositionId | null) => void;
|
||||
onSeatJobResponsibilitiesChange: (agentId: string, jobResponsibilities: string) => void;
|
||||
onGoalChange: (goal: string) => void;
|
||||
/** 本 Stage 的阶段目标正在 AI 优化中。 */
|
||||
goalOptimizing: boolean;
|
||||
@@ -1827,6 +1848,9 @@ function StageSection({
|
||||
showPositionConfig={positionConfigMode}
|
||||
positionOptions={positionOptions}
|
||||
onPositionChange={(positionId) => onSeatPositionChange(seat.agent_id, positionId)}
|
||||
onJobResponsibilitiesChange={(value) =>
|
||||
onSeatJobResponsibilitiesChange(seat.agent_id, value)
|
||||
}
|
||||
onDetail={() => onSeatDetail(seat.agent_id, seat.name)}
|
||||
/>
|
||||
))}
|
||||
@@ -1856,6 +1880,7 @@ function SeatStrip({
|
||||
showPositionConfig,
|
||||
positionOptions,
|
||||
onPositionChange,
|
||||
onJobResponsibilitiesChange,
|
||||
onDetail,
|
||||
}: {
|
||||
seat: ChainSeat;
|
||||
@@ -1880,6 +1905,7 @@ function SeatStrip({
|
||||
/** Current position directory, injected by the business-chain editor. */
|
||||
positionOptions: readonly PositionOption[];
|
||||
onPositionChange: (positionId: PositionId | null) => void;
|
||||
onJobResponsibilitiesChange: (jobResponsibilities: string) => void;
|
||||
onDetail: () => void;
|
||||
}) {
|
||||
const { attributes, listeners, setNodeRef, transform, transition, isDragging } =
|
||||
@@ -1955,6 +1981,17 @@ function SeatStrip({
|
||||
{seat.description}
|
||||
</div>
|
||||
)}
|
||||
<label className="mt-1.5 flex flex-col gap-0.5">
|
||||
<span className="text-[10px] font-medium text-muted-foreground">岗位职责</span>
|
||||
<textarea
|
||||
value={seat.job_responsibilities ?? ""}
|
||||
onChange={(event) => onJobResponsibilitiesChange(event.currentTarget.value)}
|
||||
onPointerDown={(event) => event.stopPropagation()}
|
||||
placeholder="填写该席位在本业务链中的岗位职责"
|
||||
rows={2}
|
||||
className="w-full resize-none rounded border border-border bg-background px-2 py-1 text-[11px] leading-4 text-foreground outline-none placeholder:text-muted-foreground/60 focus:border-primary/50"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{/* 岗位协同从专用入口进来时才展示。使用 TDesign Select,未分配不会阻塞普通圆桌使用。 */}
|
||||
|
||||
@@ -94,7 +94,7 @@ import { flowNodeMeta, type FlowNodeType } from "@/roundtable-planning/lib/flow-
|
||||
import { RecommendAgentsDialog } from "@/roundtable-planning/components/RecommendAgentsDialog";
|
||||
import { BusinessChainListDialog } from "@/roundtable-planning/components/BusinessChainListDialog";
|
||||
import { DispatchChainJobModal } from "@/roundtable-planning/components/DispatchChainJobModal";
|
||||
import { Step1Panel } from "@/roundtable-planning/components/Step1Panel";
|
||||
import { Step1Panel, type Step1PanelProps } from "@/roundtable-planning/components/Step1Panel";
|
||||
import { readActionDetail, readCopTaskDetail } from "@/core/auth/task-deeplink";
|
||||
import { Step2Panel } from "@/roundtable-planning/components/Step2Panel";
|
||||
import { Step3Panel } from "@/roundtable-planning/components/Step3Panel";
|
||||
@@ -102,7 +102,9 @@ import type {
|
||||
DraftStep2RunSnapshot,
|
||||
DraftStep2Snapshot,
|
||||
DraftStep3Snapshot,
|
||||
DraftStep3SummarySnapshot,
|
||||
} from "@/roundtable-planning/api/drafts";
|
||||
import type { ThreadIdMap } from "@/roundtable-planning/api/multi-agent";
|
||||
import {
|
||||
useStep1Intent,
|
||||
type InteractiveMessage,
|
||||
@@ -132,7 +134,9 @@ import {
|
||||
} from "@/roundtable-planning/lib/seat-filter";
|
||||
import {
|
||||
buildChainSeatSelection,
|
||||
isChainEnabled,
|
||||
type BusinessChain,
|
||||
type ChainSeat,
|
||||
type SeatSelectionResult,
|
||||
} from "@/roundtable-planning/lib/business-chain";
|
||||
import { DEFAULT_SEAT_MODE, type SeatMode } from "@/roundtable-planning/lib/seat-mode";
|
||||
@@ -152,6 +156,16 @@ import { listAgents } from "@/core/agents";
|
||||
import { listBusinessMappings } from "@/strategy-components/api/business-mapping";
|
||||
import { emitWujieEvent, isWujieEnv, onWujieEvent, readWujieProps } from "@/core/embed/wujie";
|
||||
import { collectRoundtableDeliverables } from "@/roundtable-planning/lib/roundtable-deliverables";
|
||||
import { useTaskArtifactSubmission } from "@/roundtable-planning/hooks/useTaskArtifactSubmission";
|
||||
import type { TaskArtifactSubmissionConfig } from "@/roundtable-planning/lib/task-artifact-submission";
|
||||
import {
|
||||
findSeatSubmission,
|
||||
submittedSeatKeysFor,
|
||||
} from "@/roundtable-planning/lib/match-seat-submission";
|
||||
import {
|
||||
AnalysisResultDetailDialog,
|
||||
type AnalysisResultCardItem,
|
||||
} from "@/components/analysis-results";
|
||||
|
||||
/**
|
||||
* 业务码 → 任务工作区业务码(``TaskBusiness``),用于深链 taskId 模式底部「快捷跳转」栏
|
||||
@@ -288,6 +302,8 @@ function readEmbedHashQueryPrefill(): RoundtablePrefill | null {
|
||||
|
||||
export default function RoundtablePlanningPage({
|
||||
compactChrome = false,
|
||||
/** 仅供独立业务页临时锁定深色视觉;不修改全局主题状态。 */
|
||||
forceDarkAppearance = false,
|
||||
/** 独立业务页锁定的公共业务链;不影响原多智能体会商入口。 */
|
||||
lockedChainId = null,
|
||||
/** 即使尚未配置业务链,也禁止用户改为推荐/手选链路。 */
|
||||
@@ -298,23 +314,95 @@ export default function RoundtablePlanningPage({
|
||||
toolbarSlot,
|
||||
/** 独立业务页在第一步左上角替换默认业务链选择区的内容。 */
|
||||
entryRailBusinessChainSlot,
|
||||
/** 独立业务页在第一步左上角提供自己的任务卡片;不触发原深链任务接口。 */
|
||||
entryRailTaskCardSlot,
|
||||
/** 独立业务页传给意图智能体的隐藏任务上下文。 */
|
||||
taskContext,
|
||||
/** 独立业务页的任务作用域,仅用于左栏记录筛选,不改变原深链逻辑。 */
|
||||
entryRailTaskId,
|
||||
/** 独立业务页的根节点样式类,避免修改原会商样式。 */
|
||||
rootClassName,
|
||||
/** 独立业务页替换第一步消息工作区的纯展示组件;状态和行为仍由本页统一拥有。 */
|
||||
renderStep1,
|
||||
/** 独立业务页替换第一步左侧入口栏。 */
|
||||
renderStep1LeftSidebar,
|
||||
/** 独立业务页在第二步左栏顶部复用自己的任务/意图展示。 */
|
||||
renderStep2LeftSidebarHeader,
|
||||
/** 第一阶段使用内嵌右栏时,隐藏通用的模型/摘要/澄清记录栏。 */
|
||||
hideDefaultStep1RightSidebar = false,
|
||||
step2HeaderTitle,
|
||||
step2HeaderRightSlot,
|
||||
step3HeaderTitle,
|
||||
/** 独立业务页的工作区品牌区,取代通用步骤导航。 */
|
||||
headerLeftSlot,
|
||||
/** 放在历史记录后面的独立业务操作或状态。 */
|
||||
headerActionAfterHistory,
|
||||
/** 独立业务页可隐藏通用的“保存草稿”按钮。 */
|
||||
hideHeaderSaveDraft = false,
|
||||
/** 独立业务页可调整新建动作的展示文案,行为不变。 */
|
||||
newTaskLabel,
|
||||
/** 独立业务页可隐藏通用的设置入口。 */
|
||||
hideHeaderSettings = false,
|
||||
/** 可选的外部任务过程产物提交适配器(8BF 使用,通用圆桌保持不显示)。 */
|
||||
taskArtifactSubmissionConfig,
|
||||
}: {
|
||||
compactChrome?: boolean;
|
||||
forceDarkAppearance?: boolean;
|
||||
lockedChainId?: string | null;
|
||||
lockBusinessChain?: boolean;
|
||||
storageTaskId?: string | null;
|
||||
toolbarSlot?: ReactNode;
|
||||
entryRailBusinessChainSlot?: ReactNode;
|
||||
entryRailTaskCardSlot?: ReactNode;
|
||||
taskContext?: Record<string, unknown> | null;
|
||||
entryRailTaskId?: string | null;
|
||||
rootClassName?: string;
|
||||
renderStep1?: (props: Step1PanelProps & {
|
||||
selectedModel: string;
|
||||
modelOptions: Array<{ label: string; value: string }>;
|
||||
onSelectedModelChange: (model: string) => void;
|
||||
step2Dialogues: unknown[];
|
||||
step2ThreadIds: ThreadIdMap | null;
|
||||
step2CoordinatorName: string | null;
|
||||
step2SeatStubMessages: Record<string, unknown[]>;
|
||||
step3Summary: DraftStep3SummarySnapshot | null;
|
||||
}) => ReactNode;
|
||||
renderStep1LeftSidebar?: (context: {
|
||||
intentReady: object | null;
|
||||
onCollapse?: () => void;
|
||||
submittedSeatKeys?: string[];
|
||||
onSeatClick?: (seat: ChainSeat) => void;
|
||||
}) => ReactNode;
|
||||
renderStep2LeftSidebarHeader?: (context: {
|
||||
intentReady: object | null;
|
||||
onCollapse: () => void;
|
||||
}) => ReactNode;
|
||||
hideDefaultStep1RightSidebar?: boolean;
|
||||
/** 8BF 第二步对话区标题,与第一步顶栏同一套样式。 */
|
||||
step2HeaderTitle?: string;
|
||||
/** 8BF 第二步顶栏右侧附加操作(如返回)。 */
|
||||
step2HeaderRightSlot?: ReactNode;
|
||||
/** 8BF 第三步对话区标题,与第一、二步顶栏同一套样式。 */
|
||||
step3HeaderTitle?: string;
|
||||
headerLeftSlot?: ReactNode;
|
||||
headerActionAfterHistory?: ReactNode;
|
||||
hideHeaderSaveDraft?: boolean;
|
||||
newTaskLabel?: string;
|
||||
hideHeaderSettings?: boolean;
|
||||
taskArtifactSubmissionConfig?: TaskArtifactSubmissionConfig;
|
||||
}) {
|
||||
const { theme } = useTheme();
|
||||
// 全工作区跨页的后台作业完成通知器(Provider 挂在 PageLayout 常驻层)。
|
||||
const { watchJob } = useRoundtableJobNotifier();
|
||||
const isDark = theme === "dark";
|
||||
// 保留 ThemeContext 的主题切换能力;独立业务页可只覆盖自身的视觉模式,
|
||||
// 不触碰全局 html 主题,后续移除该 prop 即可恢复随系统主题切换。
|
||||
const isDark = forceDarkAppearance || theme === "dark";
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const taskContextRef = useRef<Record<string, unknown> | null>(taskContext ?? null);
|
||||
useEffect(() => {
|
||||
taskContextRef.current = taskContext ?? null;
|
||||
}, [taskContext]);
|
||||
/** 无界(wujie)嵌入抽屉:隐藏业务链条入口,设置按钮改作手动回传交付。 */
|
||||
const inWujieEmbed = isWujieEnv();
|
||||
|
||||
@@ -331,6 +419,13 @@ export default function RoundtablePlanningPage({
|
||||
const draftStorageTaskId = storageTaskId ?? recordTaskIdOf(prefillRef.current);
|
||||
// 由 prefill.businessCode 解析出的「自动选用业务链」结果;有值时「进入研讨」跳过选链弹窗直接进 Step 2。
|
||||
const [autoChainResult, setAutoChainResult] = useState<SeatSelectionResult | null>(null);
|
||||
// 固定业务链(8BF 等独立页面)的解析状态。不能只以 autoChainResult 是否为空判断:
|
||||
// 它为空既可能是「还在拉取」,也可能是「业务链已配置但可用席位不足」。
|
||||
// 若混为一谈,用户刚保存配置后立刻点击进入研讨时会被错误提示为「未配置业务链」。
|
||||
const [lockedChainResolution, setLockedChainResolution] = useState<
|
||||
"idle" | "loading" | "ready" | "unavailable"
|
||||
>("idle");
|
||||
const [lockedChainUnavailableReason, setLockedChainUnavailableReason] = useState<string | null>(null);
|
||||
/** 无界直传 chainId 时,链条解析完成前禁止弹选链窗(避免 modal 布局抖动)。 */
|
||||
const [autoChainLoading, setAutoChainLoading] = useState(
|
||||
() =>
|
||||
@@ -342,21 +437,57 @@ export default function RoundtablePlanningPage({
|
||||
useEffect(() => {
|
||||
if (!lockedChainId) {
|
||||
setAutoChainResult(null);
|
||||
setLockedChainResolution("idle");
|
||||
setLockedChainUnavailableReason(null);
|
||||
return;
|
||||
}
|
||||
let cancelled = false;
|
||||
// 映射切换时先清掉旧链结果,避免异步请求尚未返回时误用上一条业务链进入研讨。
|
||||
setAutoChainResult(null);
|
||||
setLockedChainResolution("loading");
|
||||
setLockedChainUnavailableReason(null);
|
||||
setAutoChainLoading(true);
|
||||
void Promise.all([getChain(lockedChainId), listAgents().catch(() => [])])
|
||||
void Promise.all([getChain(lockedChainId), listAgents()])
|
||||
.then(([chain, agents]) => {
|
||||
if (cancelled || !chain) return;
|
||||
const result = buildChainSeatSelection(chain, filterRecommendCandidates(agents));
|
||||
if (!cancelled) setAutoChainResult(result);
|
||||
if (cancelled) return;
|
||||
if (!chain) {
|
||||
setAutoChainResult(null);
|
||||
setLockedChainResolution("unavailable");
|
||||
setLockedChainUnavailableReason("已配置的业务链不存在或未发布,请重新选择一条已发布的业务链");
|
||||
return;
|
||||
}
|
||||
const candidates = filterRecommendCandidates(agents);
|
||||
const result = buildChainSeatSelection(chain, candidates);
|
||||
if (!cancelled) {
|
||||
setAutoChainResult(result);
|
||||
setLockedChainResolution(result ? "ready" : "unavailable");
|
||||
if (!result) {
|
||||
const availableAgentIds = new Set(candidates.map((agent) => agent.agent_id));
|
||||
const unavailableSeats = chain.seats
|
||||
.filter((seat) => !availableAgentIds.has(seat.agent_id))
|
||||
.map((seat) => seat.name || seat.agent_id);
|
||||
setLockedChainUnavailableReason(
|
||||
unavailableSeats.length > 0
|
||||
? `业务链中的智能体「${unavailableSeats.join("、")}」尚未发布、已删除或当前账号无访问权限;请先将它们发布,并保证至少有 2 个可用智能体`
|
||||
: "业务链至少需要 2 个可用智能体,请检查业务链席位配置",
|
||||
);
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
if (!cancelled) setAutoChainResult(null);
|
||||
if (!cancelled) {
|
||||
setAutoChainResult(null);
|
||||
setLockedChainResolution("unavailable");
|
||||
setLockedChainUnavailableReason("读取已配置业务链或智能体失败,请刷新后重试");
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
if (!cancelled) setAutoChainLoading(false);
|
||||
if (!cancelled) {
|
||||
setAutoChainLoading(false);
|
||||
// getChain 返回 null 时不会进入 then 内的 result 分支,同样标记为不可用。
|
||||
setLockedChainResolution((current) => current === "loading" ? "unavailable" : current);
|
||||
setLockedChainUnavailableReason((current) => current ?? "已配置的业务链暂不可用,请重新选择后重试");
|
||||
}
|
||||
});
|
||||
return () => {
|
||||
cancelled = true;
|
||||
@@ -374,11 +505,11 @@ export default function RoundtablePlanningPage({
|
||||
consensusEmittedRef.current = true;
|
||||
}
|
||||
}, [inWujieEmbed]);
|
||||
// 带 taskId 时,先按任务回显最新草稿再决定是否 autoStart。用 state 而非 ref:
|
||||
// 带存储键 / 深链 taskId 时,先回显最新草稿再决定是否 autoStart。用 state 而非 ref:
|
||||
// 解析完成需触发重渲染让 C2 effect 重跑(否则 intentThreadId 先就绪会错过 autoStart)。
|
||||
// 无 taskId 时初始即「已解析」,autoStart 照常。
|
||||
// 无存储键时初始即「已解析」,autoStart 照常。8BF 走 storageTaskId,不依赖 prefill.taskId。
|
||||
const [taskRestoreResolved, setTaskRestoreResolved] = useState<boolean>(
|
||||
!prefillRef.current?.taskId,
|
||||
!draftStorageTaskId,
|
||||
);
|
||||
// 深链/预填自动会话:进入页面后要先建意图线程、(带 taskId 时)回显历史草稿,这段时间
|
||||
// 页面只有一句欢迎语、问答还没真正开始,线程创建慢时像卡住。下面这个标志用来在超时后
|
||||
@@ -542,6 +673,38 @@ export default function RoundtablePlanningPage({
|
||||
}>({ intentReady: null, interactiveMessages: [] });
|
||||
|
||||
const buildInitialIntent = useCallback((): string => {
|
||||
const task = taskContextRef.current?.task as Record<string, unknown> | null | undefined;
|
||||
const taskTags = taskContextRef.current?.task_tags as
|
||||
| Record<string, unknown>
|
||||
| undefined;
|
||||
const taskValue = (value: unknown) =>
|
||||
value === undefined || value === null ? "" : String(value).trim();
|
||||
const taskLines = task
|
||||
? [
|
||||
["任务 ID", taskValue(task.id ?? taskContextRef.current?.task_id)],
|
||||
["任务名称", taskValue(task.title)],
|
||||
["任务描述", taskValue(task.description)],
|
||||
["任务概览", taskValue(task.overview)],
|
||||
["任务方向", taskValue(task.direction ?? task.target_direction)],
|
||||
["优先级", taskValue(task.task_priority ?? task.priority)],
|
||||
["任务状态", taskValue(task.task_status)],
|
||||
["优先级标签", taskValue(taskTags?.priority)],
|
||||
["方向标签", taskValue(taskTags?.direction)],
|
||||
["状态标签", taskValue(taskTags?.status)],
|
||||
]
|
||||
.filter(([, value]) => value)
|
||||
.map(([label, value]) => `${label}: ${value}`)
|
||||
: [];
|
||||
const taskCardContext = taskLines.length
|
||||
? [
|
||||
"【8BF 任务卡片上下文】",
|
||||
...taskLines,
|
||||
"请把以上任务卡片信息作为本轮研讨的既有背景,不要让用户重复提供。",
|
||||
"",
|
||||
].join("\n")
|
||||
: "";
|
||||
const withTaskCardContext = (value: string) =>
|
||||
taskCardContext ? `${taskCardContext}${value}` : value;
|
||||
const { intentReady, interactiveMessages } = step1StateRef.current;
|
||||
if (intentReady) {
|
||||
const parts: string[] = [intentReady.objective];
|
||||
@@ -559,17 +722,17 @@ export default function RoundtablePlanningPage({
|
||||
parts.push(
|
||||
"用户已经过任务理解智能体澄清,以上信息可以直接作为研讨依据。请基于上述目标与约束,在圆桌内调度合适的子智能体完成研讨,不要再反问用户。",
|
||||
);
|
||||
return parts.join("\n");
|
||||
return withTaskCardContext(parts.join("\n"));
|
||||
}
|
||||
const userTurns = interactiveMessages
|
||||
.filter((m) => m.sender === "user")
|
||||
.map((m) => m.content?.trim())
|
||||
.filter((s): s is string => !!s);
|
||||
if (userTurns.length === 0) {
|
||||
return "用户尚未在第一步明确任务意图。请先调用 ask_clarification,简要询问目标、范围与硬性约束,再进入研讨。";
|
||||
return withTaskCardContext("用户尚未在第一步明确任务意图。请先调用 ask_clarification,简要询问目标、范围与硬性约束,再进入研讨。");
|
||||
}
|
||||
const conversation = userTurns.map((t, i) => `用户#${i + 1}: ${t}`).join("\n");
|
||||
return `${conversation}\n\n注意:用户尚未完成结构化的任务理解流程,以上是原始输入。若信息不足以开展研讨,请先调用 ask_clarification 询问关键约束,再开始派活。`;
|
||||
return withTaskCardContext(`${conversation}\n\n注意:用户尚未完成结构化的任务理解流程,以上是原始输入。若信息不足以开展研讨,请先调用 ask_clarification 询问关键约束,再开始派活。`);
|
||||
}, []);
|
||||
|
||||
const step2 = useStep2Orchestration({
|
||||
@@ -593,8 +756,67 @@ export default function RoundtablePlanningPage({
|
||||
currentStep,
|
||||
selectedModel,
|
||||
triggerToast,
|
||||
taskContext,
|
||||
});
|
||||
|
||||
const taskArtifactSubmission = useTaskArtifactSubmission(
|
||||
taskArtifactSubmissionConfig,
|
||||
step2.threadIds,
|
||||
step2.agentNameToRole,
|
||||
);
|
||||
|
||||
const [seatDeliverable, setSeatDeliverable] = useState<AnalysisResultCardItem | null>(null);
|
||||
const submittedRecords = taskArtifactSubmission?.submittedRecords;
|
||||
const submittedSeatKeys = useMemo(
|
||||
() => submittedSeatKeysFor(
|
||||
step2.selectedAgents.map((agent) => ({ agent_id: agent.agent_id, name: agent.name })),
|
||||
submittedRecords ?? [],
|
||||
step2.selectedAgents,
|
||||
step2.threadIds,
|
||||
),
|
||||
[submittedRecords, step2.selectedAgents, step2.threadIds],
|
||||
);
|
||||
const handleChainSeatClick = useCallback((seat: ChainSeat) => {
|
||||
const record = findSeatSubmission(
|
||||
seat,
|
||||
submittedRecords ?? [],
|
||||
step2.selectedAgents,
|
||||
step2.threadIds,
|
||||
);
|
||||
if (!record) {
|
||||
triggerToast("该节点暂无可预览产物");
|
||||
return;
|
||||
}
|
||||
setSeatDeliverable({
|
||||
id: record.id,
|
||||
agentName: seat.name || record.artifact.sourceKey,
|
||||
productName: record.artifact.name,
|
||||
positionName: seat.description?.trim() || autoChainResult?.chain?.title || "业务链席位",
|
||||
delivered: true,
|
||||
artifactPath: record.artifact.path,
|
||||
artifactMimeType: record.artifact.mimeType,
|
||||
artifactThreadId: record.artifact.threadId,
|
||||
updatedAt: record.submittedAt ?? undefined,
|
||||
});
|
||||
}, [
|
||||
autoChainResult?.chain?.title,
|
||||
step2.selectedAgents,
|
||||
step2.threadIds,
|
||||
submittedRecords,
|
||||
triggerToast,
|
||||
]);
|
||||
const renderStep1LeftSidebarWithDeliveries = useMemo(
|
||||
() => (renderStep1LeftSidebar
|
||||
? (context: { intentReady: object | null; onCollapse?: () => void }) =>
|
||||
renderStep1LeftSidebar({
|
||||
...context,
|
||||
submittedSeatKeys,
|
||||
onSeatClick: taskArtifactSubmission ? handleChainSeatClick : undefined,
|
||||
})
|
||||
: undefined),
|
||||
[handleChainSeatClick, renderStep1LeftSidebar, submittedSeatKeys, taskArtifactSubmission],
|
||||
);
|
||||
|
||||
// 同步 step1StateRef,让 buildInitialIntent / Persona / Step 3 都能读到最新值。
|
||||
useEffect(() => {
|
||||
step1StateRef.current = {
|
||||
@@ -1140,11 +1362,11 @@ export default function RoundtablePlanningPage({
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
// C1.5(无界回显):带 taskId 时,挂载即按任务取最新草稿回显。命中 → 抑制 autoStart
|
||||
// C1.5(无界 / 8BF 回显):带存储键时,挂载即取最新草稿回显。命中 → 抑制 autoStart
|
||||
// (避免重复发首条消息);未命中 → 放行 autoStart 走全新任务。只跑一次。
|
||||
useEffect(() => {
|
||||
// 回显聊天记录按存储键(xdfx-A=行动id),与 useDraftPersistence 的 taskId 保持一致。
|
||||
const tid = recordTaskIdOf(prefillRef.current);
|
||||
// 回显聊天记录按存储键:8BF 用独立 `storageTaskId`;xdfx-A 按行动id;其它深链按真实 taskId。
|
||||
const tid = draftStorageTaskId;
|
||||
if (!tid) return;
|
||||
let cancelled = false;
|
||||
void (async () => {
|
||||
@@ -1400,9 +1622,9 @@ export default function RoundtablePlanningPage({
|
||||
.filter((g) => g.length > 0),
|
||||
[orchestrationPlan],
|
||||
);
|
||||
// 第三步首次生成报告后即**自动**续跑结构化输出(流程图)——不再限 taskId 深链,
|
||||
// 任何会商进第三步首次出报告都自动出流程图(用户 2026-06-17 要求)。
|
||||
const autoSummaryFlow = true;
|
||||
// 第三步的交付统一为 Markdown 总结报告。流程图不再作为本页的后续自动产物,
|
||||
// 避免报告写完后额外触发一次结构化抽取请求。
|
||||
const autoSummaryFlow = false;
|
||||
|
||||
const summaryFlow = useStep3Summary({
|
||||
intentReady: step1.intentReady,
|
||||
@@ -1412,6 +1634,7 @@ export default function RoundtablePlanningPage({
|
||||
coordinatorPrompt: orchestrationPlan?.coordinatorPrompt ?? null,
|
||||
chainLevels,
|
||||
autoFlow: autoSummaryFlow,
|
||||
flowEnabled: false,
|
||||
savedSummary: step3Report?.summaryReport ?? null,
|
||||
onSummarySaved: handleSummarySaved,
|
||||
ingestAvailable,
|
||||
@@ -1917,9 +2140,66 @@ export default function RoundtablePlanningPage({
|
||||
triggerToast("追问生成就绪!");
|
||||
}, [step1, triggerToast]);
|
||||
|
||||
// 独立业务页可只替换 Step 1 的外观;这里将通用状态/动作收敛为一份受控 props,
|
||||
// 避免它们复制或分叉意图识别、附件上传、澄清和进入研讨的业务逻辑。
|
||||
const step1PanelProps: Step1PanelProps = {
|
||||
interactiveMessages: step1.interactiveMessages,
|
||||
intentThreadId: step1.intentThreadId,
|
||||
intentReady: step1.intentReady,
|
||||
isIntentSending: step1.isIntentSending,
|
||||
pendingIntentClarificationMsgId: step1.pendingIntentClarificationMsgId,
|
||||
intentClarificationSelections: step1.intentClarificationSelections,
|
||||
setIntentClarificationSelections: step1.setIntentClarificationSelections,
|
||||
onSendMessage: (text, files) => void step1.sendIntentMessage(text, files),
|
||||
onStopIntent: step1.stopIntentStream,
|
||||
onSkipQuestion: handleSkipQuestion,
|
||||
onFollowUp: handleAgentFollowUp,
|
||||
onEnterRoundtable: () => {
|
||||
if (!step1.intentReady) {
|
||||
triggerToast("请先与任务理解智能体完成澄清,生成任务摘要后再进入");
|
||||
return;
|
||||
}
|
||||
// 会商自动化串联(模块 C):若任务页带来的业务链已解析成功,跳过选链弹窗,
|
||||
// 直接据该业务链进入 Step 2 研讨(用户无需再手选)。
|
||||
if (autoChainResult) {
|
||||
const result = autoChainResult;
|
||||
void drafts.ensureDraft(1).finally(() => handleConfirmAgents(result));
|
||||
return;
|
||||
}
|
||||
if (lockBusinessChain) {
|
||||
triggerToast(
|
||||
autoChainLoading || lockedChainResolution === "loading"
|
||||
? "正在加载管理员配置的业务链,请稍候…"
|
||||
: lockedChainResolution === "unavailable"
|
||||
? lockedChainUnavailableReason ?? "已配置的业务链暂不可用,请确认至少保留 2 个可用智能体后重试"
|
||||
: "管理员尚未配置可用的业务链,请联系管理员处理",
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (
|
||||
inWujieEmbed &&
|
||||
autoChainLoading &&
|
||||
(prefillRef.current?.chainId || prefillRef.current?.businessCode)
|
||||
) {
|
||||
triggerToast("正在加载业务链条,请稍候…");
|
||||
return;
|
||||
}
|
||||
// 先把草稿落地拿到 draft_id,推荐历史才有归属;失败也照常打开弹窗
|
||||
// (弹窗在无 draftId 时退化为「直接推荐、不存历史」)。
|
||||
void drafts.ensureDraft(1).finally(() => setIsRecommendDialogOpen(true));
|
||||
},
|
||||
onManualSave: drafts.handleManualSave,
|
||||
onTriggerToast: triggerToast,
|
||||
submitIntentClarifications: step1.submitIntentClarifications,
|
||||
};
|
||||
// 定制 chrome 仅服务第一阶段;第二、三阶段继续保留原有步骤导航与操作,
|
||||
// 避免独立业务页为了复刻第一步视觉而收窄后续流程的可达性。
|
||||
const useCustomStep1Chrome = currentStep === 1 && Boolean(headerLeftSlot);
|
||||
|
||||
// ─── Render ──────────────────────────────────────────────
|
||||
return (
|
||||
<div
|
||||
data-roundtable-step={currentStep}
|
||||
className={cn(
|
||||
"roundtable-planning theme-transition relative flex h-full min-h-0 flex-col bg-[#fef6f6] font-sans text-slate-800 selection:bg-red-200",
|
||||
isDark && "roundtable-planning--dark",
|
||||
@@ -1930,16 +2210,24 @@ export default function RoundtablePlanningPage({
|
||||
期间全屏覆盖,避免线程创建慢时页面像卡住。问答一旦开始或超时即撤掉。 */}
|
||||
{showBootLoading && (
|
||||
<div
|
||||
className="absolute inset-0 z-50 flex items-center justify-center bg-white"
|
||||
className={cn(
|
||||
"absolute inset-0 z-50 flex items-center justify-center",
|
||||
isDark ? "bg-[#061b3b]" : "bg-white",
|
||||
)}
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
>
|
||||
<div className="flex flex-col items-center gap-7 px-8">
|
||||
<div className="flex flex-col items-center gap-2 text-center">
|
||||
<p className="text-lg font-semibold tracking-wide text-slate-800">
|
||||
<p className={cn(
|
||||
"text-lg font-semibold tracking-wide",
|
||||
isDark ? "text-[#e7f0ff]" : "text-slate-800",
|
||||
)}>
|
||||
正在准备多智能体会商
|
||||
</p>
|
||||
<p className="text-sm text-slate-400">正在初始化任务理解智能体,请稍候…</p>
|
||||
<p className={cn("text-sm", isDark ? "text-[#8aa0c4]" : "text-slate-400")}>
|
||||
正在初始化任务理解智能体,请稍候…
|
||||
</p>
|
||||
</div>
|
||||
<span className="inline-flex items-center gap-1.5">
|
||||
<span className="h-2 w-2 animate-bounce rounded-full bg-red-400 [animation-delay:-0.3s]" />
|
||||
@@ -2013,6 +2301,15 @@ export default function RoundtablePlanningPage({
|
||||
}}
|
||||
/>
|
||||
|
||||
{taskArtifactSubmission && (
|
||||
<AnalysisResultDetailDialog
|
||||
item={seatDeliverable}
|
||||
onOpenChange={(open) => {
|
||||
if (!open) setSeatDeliverable(null);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
{showToast && (
|
||||
<div className="fixed top-4 left-1/2 transform -translate-x-1/2 z-50 bg-primary text-white text-xs px-4 py-2.5 rounded-xl shadow-lg border border-primary/40 font-medium flex items-center gap-2 animate-bounce">
|
||||
<Sparkles className="h-4 w-4 shrink-0" />
|
||||
@@ -2022,13 +2319,15 @@ export default function RoundtablePlanningPage({
|
||||
|
||||
{/* HEADER */}
|
||||
<header ref={headerDzRef} className="relative z-[40] flex shrink-0 items-center justify-between gap-4 border-b border-slate-100 bg-white px-6 py-3 shadow-[0_1px_3px_rgba(0,0,0,0.02)] dark:border-border dark:bg-card dark:shadow-none">
|
||||
<StepNavigation
|
||||
currentStep={currentStep}
|
||||
intentReady={step1.intentReady}
|
||||
hasConsensus={step2.hasConsensus}
|
||||
onStepClick={(s) => setCurrentStep(s)}
|
||||
triggerToast={triggerToast}
|
||||
/>
|
||||
{useCustomStep1Chrome ? headerLeftSlot : (
|
||||
<StepNavigation
|
||||
currentStep={currentStep}
|
||||
intentReady={step1.intentReady}
|
||||
hasConsensus={step2.hasConsensus}
|
||||
onStepClick={(s) => setCurrentStep(s)}
|
||||
triggerToast={triggerToast}
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
{toolbarSlot}
|
||||
@@ -2077,18 +2376,20 @@ export default function RoundtablePlanningPage({
|
||||
className="bg-emerald-600 text-white hover:bg-emerald-700 text-xs font-bold px-3 py-2 rounded-xl flex items-center gap-1.5 transition-all shadow-sm shadow-emerald-500/10 active:scale-95"
|
||||
>
|
||||
<Sparkles className="w-3.5 h-3.5" />
|
||||
新建任务
|
||||
{useCustomStep1Chrome ? (newTaskLabel ?? "新建任务") : "新建任务"}
|
||||
</button>
|
||||
)}
|
||||
|
||||
<button
|
||||
id="save-draft-header-btn"
|
||||
onClick={drafts.handleManualSave}
|
||||
className="bg-white hover:bg-slate-50 border border-[#e2e8f0] text-[#334155] text-xs font-bold px-3 py-2 rounded-xl flex items-center gap-1.5 transition dark:border-border dark:bg-secondary dark:text-foreground dark:hover:bg-accent"
|
||||
>
|
||||
<Save className="w-3.5 h-3.5 text-slate-500" />
|
||||
保存草稿
|
||||
</button>
|
||||
{(!hideHeaderSaveDraft || !useCustomStep1Chrome) && (
|
||||
<button
|
||||
id="save-draft-header-btn"
|
||||
onClick={drafts.handleManualSave}
|
||||
className="bg-white hover:bg-slate-50 border border-[#e2e8f0] text-[#334155] text-xs font-bold px-3 py-2 rounded-xl flex items-center gap-1.5 transition dark:border-border dark:bg-secondary dark:text-foreground dark:hover:bg-accent"
|
||||
>
|
||||
<Save className="w-3.5 h-3.5 text-slate-500" />
|
||||
保存草稿
|
||||
</button>
|
||||
)}
|
||||
|
||||
{/* 「导入会商」按钮先隐藏(保留代码 + 弹窗逻辑,便于以后恢复)。 */}
|
||||
{false && (
|
||||
@@ -2126,22 +2427,26 @@ export default function RoundtablePlanningPage({
|
||||
onCancelRename={drafts.handleCancelRename}
|
||||
/>
|
||||
|
||||
<div className="h-6 w-[1px] bg-slate-200 mx-1" />
|
||||
{useCustomStep1Chrome && headerActionAfterHistory}
|
||||
|
||||
<button
|
||||
id="settings-btn"
|
||||
onClick={handleSettingsClick}
|
||||
title={
|
||||
inWujieEmbed
|
||||
? "回传各智能体交付结果给宿主"
|
||||
: getStoredAuth()?.system_role === "admin"
|
||||
? "会商诊断日志"
|
||||
: "系统设置"
|
||||
}
|
||||
className="p-1.5 text-slate-400 hover:text-slate-600 rounded-lg hover:bg-slate-100 transition-colors dark:text-muted-foreground dark:hover:bg-accent dark:hover:text-foreground"
|
||||
>
|
||||
<Settings className="w-4 h-4" />
|
||||
</button>
|
||||
{(!hideHeaderSettings || !useCustomStep1Chrome) && <div className="h-6 w-[1px] bg-slate-200 mx-1" />}
|
||||
|
||||
{(!hideHeaderSettings || !useCustomStep1Chrome) && (
|
||||
<button
|
||||
id="settings-btn"
|
||||
onClick={handleSettingsClick}
|
||||
title={
|
||||
inWujieEmbed
|
||||
? "回传各智能体交付结果给宿主"
|
||||
: getStoredAuth()?.system_role === "admin"
|
||||
? "会商诊断日志"
|
||||
: "系统设置"
|
||||
}
|
||||
className="p-1.5 text-slate-400 hover:text-slate-600 rounded-lg hover:bg-slate-100 transition-colors dark:text-muted-foreground dark:hover:bg-accent dark:hover:text-foreground"
|
||||
>
|
||||
<Settings className="w-4 h-4" />
|
||||
</button>
|
||||
)}
|
||||
{compactChrome && (
|
||||
<>
|
||||
<ThemeSwitcher tone="content" />
|
||||
@@ -2157,7 +2462,12 @@ export default function RoundtablePlanningPage({
|
||||
sidebarExpanded={step2SidebarExpanded}
|
||||
setSidebarExpanded={setStep2SidebarExpanded}
|
||||
/>
|
||||
<main className="relative z-0 flex-1 overflow-hidden p-4 flex gap-4 min-h-0">
|
||||
<main
|
||||
data-step2-sidebar-expanded={
|
||||
currentStep === 2 || currentStep === 3 ? String(step2SidebarExpanded) : undefined
|
||||
}
|
||||
className="relative z-0 flex-1 overflow-hidden p-4 flex gap-4 min-h-0"
|
||||
>
|
||||
{/* LEFT SIDEBAR */}
|
||||
<LeftSidebar
|
||||
currentStep={currentStep}
|
||||
@@ -2176,12 +2486,15 @@ export default function RoundtablePlanningPage({
|
||||
onSelectChain={handleSelectChainFromSidebar}
|
||||
onOpenDraft={drafts.handleLoadDraft}
|
||||
activeDraftId={drafts.currentDraftId}
|
||||
entryRailTaskId={recordTaskIdOf(prefillRef.current)}
|
||||
entryRailTaskId={entryRailTaskId ?? recordTaskIdOf(prefillRef.current)}
|
||||
historyTaskId={draftStorageTaskId}
|
||||
entryRailBusinessCode={prefillRef.current?.businessCode ?? null}
|
||||
lockedChainId={lockedChainId}
|
||||
lockBusinessChain={lockBusinessChain}
|
||||
entryRailBusinessChainSlot={entryRailBusinessChainSlot}
|
||||
entryRailTaskCardSlot={entryRailTaskCardSlot}
|
||||
renderStep1LeftSidebar={renderStep1LeftSidebarWithDeliveries}
|
||||
renderStep2LeftSidebarHeader={renderStep2LeftSidebarHeader}
|
||||
/>
|
||||
|
||||
{/* MIDDLE VIEWPORT */}
|
||||
@@ -2190,7 +2503,18 @@ export default function RoundtablePlanningPage({
|
||||
className="flex-1 flex flex-col min-w-0 bg-white border border-slate-200/50 rounded-2xl shadow-[0_4px_16px_rgba(0,0,0,0.015)] overflow-hidden"
|
||||
>
|
||||
{currentStep === 1 && (
|
||||
<Step1Panel
|
||||
renderStep1 ? renderStep1({
|
||||
...step1PanelProps,
|
||||
selectedModel,
|
||||
modelOptions: availableModels.map((model) => ({ label: model.name, value: model.name })),
|
||||
onSelectedModelChange: setSelectedModel,
|
||||
step2Dialogues: step2.step2RoundtableDialogues,
|
||||
step2ThreadIds: step2.threadIds,
|
||||
step2CoordinatorName: step2.coordinatorName,
|
||||
step2SeatStubMessages: step2.seatStubMessages,
|
||||
step3Summary: step3Report?.summaryReport ?? null,
|
||||
}) : <Step1Panel
|
||||
{...step1PanelProps}
|
||||
headerLeftSlot={
|
||||
// 「原任务已有结果」(目的树预览)只在 rwfx-A(6BF)模式显示;xdfx/3qfx 不显示。
|
||||
prefillRef.current?.taskId &&
|
||||
@@ -2203,57 +2527,14 @@ export default function RoundtablePlanningPage({
|
||||
/>
|
||||
) : undefined
|
||||
}
|
||||
interactiveMessages={step1.interactiveMessages}
|
||||
intentThreadId={step1.intentThreadId}
|
||||
intentReady={step1.intentReady}
|
||||
isIntentSending={step1.isIntentSending}
|
||||
pendingIntentClarificationMsgId={step1.pendingIntentClarificationMsgId}
|
||||
intentClarificationSelections={step1.intentClarificationSelections}
|
||||
setIntentClarificationSelections={step1.setIntentClarificationSelections}
|
||||
onSendMessage={(text, files) => void step1.sendIntentMessage(text, files)}
|
||||
onStopIntent={step1.stopIntentStream}
|
||||
onSkipQuestion={handleSkipQuestion}
|
||||
onFollowUp={handleAgentFollowUp}
|
||||
onEnterRoundtable={() => {
|
||||
if (!step1.intentReady) {
|
||||
triggerToast("请先与任务理解智能体完成澄清,生成任务摘要后再进入");
|
||||
return;
|
||||
}
|
||||
// 会商自动化串联(模块 C):若任务页带来的业务链已解析成功,跳过选链弹窗,
|
||||
// 直接据该业务链进入 Step 2 研讨(用户无需再手选)。
|
||||
if (autoChainResult) {
|
||||
const result = autoChainResult;
|
||||
void drafts.ensureDraft(1).finally(() => handleConfirmAgents(result));
|
||||
return;
|
||||
}
|
||||
if (lockBusinessChain) {
|
||||
triggerToast(
|
||||
autoChainLoading
|
||||
? "正在加载管理员配置的业务链,请稍候…"
|
||||
: "管理员尚未配置可用的业务链,请联系管理员处理",
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (
|
||||
inWujieEmbed &&
|
||||
autoChainLoading &&
|
||||
(prefillRef.current?.chainId || prefillRef.current?.businessCode)
|
||||
) {
|
||||
triggerToast("正在加载业务链条,请稍候…");
|
||||
return;
|
||||
}
|
||||
// 先把草稿落地拿到 draft_id,推荐历史才有归属;失败也照常打开弹窗
|
||||
// (弹窗在无 draftId 时退化为「直接推荐、不存历史」)。
|
||||
void drafts.ensureDraft(1).finally(() => setIsRecommendDialogOpen(true));
|
||||
}}
|
||||
onManualSave={drafts.handleManualSave}
|
||||
onTriggerToast={triggerToast}
|
||||
submitIntentClarifications={step1.submitIntentClarifications}
|
||||
/>
|
||||
)}
|
||||
|
||||
{currentStep === 2 && (
|
||||
<Step2Panel
|
||||
useStep1InputAppearance={rootClassName?.includes("eightbf-roundtable") ?? false}
|
||||
headerTitle={step2HeaderTitle}
|
||||
headerRightSlot={step2HeaderRightSlot}
|
||||
step2RoundtableDialogues={step2.step2RoundtableDialogues}
|
||||
isInitializing={step2.isInitializing}
|
||||
isRoundTableRunning={step2.isRoundTableRunning}
|
||||
@@ -2305,11 +2586,14 @@ export default function RoundtablePlanningPage({
|
||||
onBackgroundSuspend={handleBackgroundSuspend}
|
||||
isViewingHistory={drafts.loadedFromDraftRef.current}
|
||||
onTriggerToast={triggerToast}
|
||||
taskArtifactSubmission={taskArtifactSubmission}
|
||||
/>
|
||||
)}
|
||||
|
||||
{currentStep === 3 && (
|
||||
<Step3Panel
|
||||
useStep1Chrome={rootClassName?.includes("eightbf-roundtable") ?? false}
|
||||
headerTitle={step3HeaderTitle}
|
||||
threadIds={step2.threadIds}
|
||||
coordinatorName={step2.coordinatorName}
|
||||
consensusText={step2.lastLeaderContent}
|
||||
@@ -2334,12 +2618,13 @@ export default function RoundtablePlanningPage({
|
||||
onReset={handleStartNewTask}
|
||||
openArtifactPreview={step2.openArtifactPreview}
|
||||
seatStubMessages={step2.seatStubMessages}
|
||||
taskArtifactSubmission={taskArtifactSubmission}
|
||||
/>
|
||||
)}
|
||||
</section>
|
||||
|
||||
{/* RIGHT SIDEBAR */}
|
||||
<RightSidebar
|
||||
{!hideDefaultStep1RightSidebar && <RightSidebar
|
||||
currentStep={currentStep}
|
||||
selectedModel={selectedModel}
|
||||
setSelectedModel={setSelectedModel}
|
||||
@@ -2349,7 +2634,7 @@ export default function RoundtablePlanningPage({
|
||||
timelineEntries={step1.timelineEntries}
|
||||
triggerToast={triggerToast}
|
||||
onSaveIntent={handleSaveIntent}
|
||||
/>
|
||||
/>}
|
||||
</main>
|
||||
|
||||
{/* 深链 taskId 模式:底部「快捷跳转」栏(与单智能体问答共用,按业务取按钮管理配置)。 */}
|
||||
@@ -2743,6 +3028,20 @@ interface LeftSidebarProps {
|
||||
lockedChainId?: string | null;
|
||||
/** 第一阶段替换默认业务链选择区的自定义内容。 */
|
||||
entryRailBusinessChainSlot?: ReactNode;
|
||||
/** 第一阶段由独立业务页提供的自定义任务卡片。 */
|
||||
entryRailTaskCardSlot?: ReactNode;
|
||||
/** 独立业务页替换第一步左侧工作区;仅提供已解析的意图状态。 */
|
||||
renderStep1LeftSidebar?: (context: {
|
||||
intentReady: object | null;
|
||||
onCollapse?: () => void;
|
||||
submittedSeatKeys?: string[];
|
||||
onSeatClick?: (seat: ChainSeat) => void;
|
||||
}) => ReactNode;
|
||||
/** 独立业务页在第二步左栏顶部复用任务与意图区。 */
|
||||
renderStep2LeftSidebarHeader?: (context: {
|
||||
intentReady: object | null;
|
||||
onCollapse: () => void;
|
||||
}) => ReactNode;
|
||||
}
|
||||
|
||||
function Step2SandboxSidebarSync({
|
||||
@@ -2756,13 +3055,21 @@ function Step2SandboxSidebarSync({
|
||||
}) {
|
||||
const { open } = useArtifacts();
|
||||
const prevOpenRef = useRef(open);
|
||||
const prevStepRef = useRef(currentStep);
|
||||
|
||||
useEffect(() => {
|
||||
if (currentStep !== 2) {
|
||||
const enteredCollapsibleStep =
|
||||
(currentStep === 2 || currentStep === 3) &&
|
||||
prevStepRef.current !== currentStep;
|
||||
prevStepRef.current = currentStep;
|
||||
|
||||
if (currentStep !== 2 && currentStep !== 3) {
|
||||
prevOpenRef.current = open;
|
||||
return;
|
||||
}
|
||||
if (open && !prevOpenRef.current && sidebarExpanded) {
|
||||
const openedNow = open && !prevOpenRef.current;
|
||||
const landedWithSandbox = enteredCollapsibleStep && open;
|
||||
if ((openedNow || landedWithSandbox) && sidebarExpanded) {
|
||||
setSidebarExpanded(false);
|
||||
}
|
||||
prevOpenRef.current = open;
|
||||
@@ -2794,6 +3101,9 @@ function LeftSidebar({
|
||||
lockBusinessChain,
|
||||
lockedChainId,
|
||||
entryRailBusinessChainSlot,
|
||||
entryRailTaskCardSlot,
|
||||
renderStep1LeftSidebar,
|
||||
renderStep2LeftSidebarHeader,
|
||||
}: LeftSidebarProps) {
|
||||
// 整片脱敏:左侧面板(任务概览/参与角色/人工参与等)的所有文本——标题、动态内容、
|
||||
// 嵌套子组件文本一并脱敏。消息列表与沙箱是另外的容器,不挂此 Hook,保持原文。
|
||||
@@ -2803,18 +3113,48 @@ function LeftSidebar({
|
||||
const toggleSeatFilter = (filter: SeatFilter) =>
|
||||
setSeatFilter((cur) => (cur === filter ? null : filter));
|
||||
|
||||
// Step 3 隐藏左侧栏(原「参与与结论贡献」列),让中间「最终方案展示」自适应
|
||||
// 撑满整行宽度(右侧栏在 Step !==1 时也已 return null)。
|
||||
if (currentStep === 3) return null;
|
||||
// Step 3:通用会商隐藏左栏以让方案展示撑满;8BF 复用第一步左栏,并和第二步一样可收起。
|
||||
if (currentStep === 3) {
|
||||
if (!renderStep1LeftSidebar) return null;
|
||||
return (
|
||||
<section
|
||||
ref={dzRef}
|
||||
id="left-sidebar"
|
||||
data-sidebar-expanded={String(sidebarExpanded)}
|
||||
className={cn(
|
||||
"min-h-0 shrink-0 flex flex-col gap-3 pr-1 transition-[width] duration-200 ease-out overflow-y-auto",
|
||||
sidebarExpanded ? "w-[280px]" : "w-[80px]",
|
||||
)}
|
||||
>
|
||||
{!sidebarExpanded ? (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setSidebarExpanded(true)}
|
||||
title="展开侧栏"
|
||||
aria-expanded={false}
|
||||
className="w-full shrink-0 flex h-10 items-center justify-center rounded-[4px] border border-slate-200/50 bg-white text-slate-500 hover:text-primary hover:border-primary/30 transition-colors shadow-[0_2px_8px_rgba(0,0,0,0.01)]"
|
||||
>
|
||||
<PanelLeftOpen className="h-4 w-4" />
|
||||
</button>
|
||||
) : (
|
||||
renderStep1LeftSidebar({
|
||||
intentReady,
|
||||
onCollapse: () => setSidebarExpanded(false),
|
||||
})
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<section
|
||||
ref={dzRef}
|
||||
id="left-sidebar"
|
||||
data-sidebar-expanded={isStep2 ? String(sidebarExpanded) : undefined}
|
||||
className={cn(
|
||||
"min-h-0 shrink-0 flex flex-col gap-3 pr-1 transition-[width] duration-200 ease-out",
|
||||
isStep2 ? "overflow-y-auto" : "overflow-hidden",
|
||||
isStep2 && !sidebarExpanded ? "w-[56px]" : "w-[280px]",
|
||||
isStep2 && !sidebarExpanded ? "w-[80px]" : "w-[280px]",
|
||||
)}
|
||||
>
|
||||
{isStep2 && !sidebarExpanded && (
|
||||
@@ -2823,7 +3163,7 @@ function LeftSidebar({
|
||||
onClick={() => setSidebarExpanded(true)}
|
||||
title="展开侧栏"
|
||||
aria-expanded={false}
|
||||
className="w-full shrink-0 flex h-10 items-center justify-center rounded-2xl border border-slate-200/50 bg-white text-slate-500 hover:text-primary hover:border-primary/30 transition-colors shadow-[0_2px_8px_rgba(0,0,0,0.01)]"
|
||||
className="w-full shrink-0 flex h-10 items-center justify-center rounded-[4px] border border-slate-200/50 bg-white text-slate-500 hover:text-primary hover:border-primary/30 transition-colors shadow-[0_2px_8px_rgba(0,0,0,0.01)]"
|
||||
>
|
||||
<PanelLeftOpen className="h-4 w-4" />
|
||||
</button>
|
||||
@@ -2832,15 +3172,20 @@ function LeftSidebar({
|
||||
{currentStep === 2 ? (
|
||||
sidebarExpanded ? (
|
||||
<>
|
||||
<IntentSummaryCard
|
||||
intentReady={intentReady}
|
||||
title="意图理解"
|
||||
collapsible
|
||||
sidebarToggle={{
|
||||
expanded: sidebarExpanded,
|
||||
onToggle: () => setSidebarExpanded((v) => !v),
|
||||
}}
|
||||
/>
|
||||
{renderStep2LeftSidebarHeader?.({
|
||||
intentReady,
|
||||
onCollapse: () => setSidebarExpanded(false),
|
||||
}) ?? (
|
||||
<IntentSummaryCard
|
||||
intentReady={intentReady}
|
||||
title="意图理解"
|
||||
collapsible
|
||||
sidebarToggle={{
|
||||
expanded: sidebarExpanded,
|
||||
onToggle: () => setSidebarExpanded((v) => !v),
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="bg-white border border-slate-200/50 rounded-2xl p-4 shadow-[0_2px_8px_rgba(0,0,0,0.01)] flex-1 flex flex-col min-h-[240px]">
|
||||
<div className="flex items-center gap-2 border-b border-slate-100 pb-2.5 mb-3">
|
||||
@@ -2926,18 +3271,21 @@ function LeftSidebar({
|
||||
)
|
||||
) : (
|
||||
// Step 1(落地,未开始研讨):左栏改为业务链 + 分析记录入口(需求 0616 #2)。
|
||||
<RoundtableEntryRail
|
||||
selectedChainId={selectedChainId}
|
||||
onSelectChain={onSelectChain}
|
||||
onOpenDraft={onOpenDraft}
|
||||
activeDraftId={activeDraftId}
|
||||
taskId={entryRailTaskId ?? null}
|
||||
historyTaskId={historyTaskId ?? null}
|
||||
businessCode={entryRailBusinessCode ?? null}
|
||||
lockBusinessChain={lockBusinessChain}
|
||||
lockedChainId={lockedChainId ?? null}
|
||||
businessChainSlot={entryRailBusinessChainSlot}
|
||||
/>
|
||||
renderStep1LeftSidebar?.({ intentReady }) ?? (
|
||||
<RoundtableEntryRail
|
||||
selectedChainId={selectedChainId}
|
||||
onSelectChain={onSelectChain}
|
||||
onOpenDraft={onOpenDraft}
|
||||
activeDraftId={activeDraftId}
|
||||
taskId={entryRailTaskId ?? null}
|
||||
historyTaskId={historyTaskId ?? null}
|
||||
businessCode={entryRailBusinessCode ?? null}
|
||||
lockBusinessChain={lockBusinessChain}
|
||||
lockedChainId={lockedChainId ?? null}
|
||||
businessChainSlot={entryRailBusinessChainSlot}
|
||||
taskCardSlot={entryRailTaskCardSlot}
|
||||
/>
|
||||
)
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
@@ -2992,6 +3340,7 @@ function RoundtableEntryRail({
|
||||
lockedChainId,
|
||||
lockBusinessChain = false,
|
||||
businessChainSlot,
|
||||
taskCardSlot,
|
||||
}: {
|
||||
selectedChainId: string | null;
|
||||
onSelectChain: (chain: BusinessChain) => void;
|
||||
@@ -3007,6 +3356,7 @@ function RoundtableEntryRail({
|
||||
lockedChainId?: string | null;
|
||||
lockBusinessChain?: boolean;
|
||||
businessChainSlot?: ReactNode;
|
||||
taskCardSlot?: ReactNode;
|
||||
}) {
|
||||
const [chains, setChains] = useState<BusinessChain[]>([]);
|
||||
const [chainSectionExpanded, setChainSectionExpanded] = useState(true);
|
||||
@@ -3061,7 +3411,8 @@ function RoundtableEntryRail({
|
||||
void listChains("public")
|
||||
.then((all) => {
|
||||
if (!cancelled) {
|
||||
setChains(lockBusinessChain ? all.filter((chain) => chain.id === lockedChainId) : all);
|
||||
const usable = all.filter(isChainEnabled);
|
||||
setChains(lockBusinessChain ? usable.filter((chain) => chain.id === lockedChainId) : usable);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
@@ -3093,7 +3444,12 @@ function RoundtableEntryRail({
|
||||
)}
|
||||
>
|
||||
{/* 深链接(taskId)模式:左上角展示「当前任务」(rwfx/3qfx)或「当前行动」(xdfx),替代业务链选择。 */}
|
||||
{deeplink ? (
|
||||
{taskCardSlot ? (
|
||||
<>
|
||||
{taskCardSlot}
|
||||
{lockBusinessChain && businessChainSlot}
|
||||
</>
|
||||
) : deeplink ? (
|
||||
isXdfx ? (
|
||||
<div className="bg-white border border-[#ECE7E4] rounded-2xl p-4 shadow-[0_4px_20px_rgba(0,0,0,0.02)]">
|
||||
<div className="flex items-center gap-2 mb-3">
|
||||
@@ -3535,7 +3891,7 @@ function Step2RunSwitcher({
|
||||
type="button"
|
||||
onClick={() => onSelect(run.id)}
|
||||
className={cn(
|
||||
"w-full rounded-xl border p-2.5 text-left transition-colors",
|
||||
"roundtable-step2-run-card w-full rounded-xl border p-2.5 text-left transition-colors",
|
||||
active
|
||||
? "border-primary/40 bg-primary/5 text-slate-900"
|
||||
: "border-slate-100 bg-slate-50/60 text-slate-600 hover:border-primary/20 hover:bg-white",
|
||||
@@ -3646,7 +4002,7 @@ function HumanParticipationCard({
|
||||
: undefined
|
||||
}
|
||||
className={cn(
|
||||
"flex min-h-[56px] items-center justify-between gap-3 rounded-xl border border-slate-100 bg-slate-50 p-3 transition",
|
||||
"roundtable-step2-human-row flex min-h-[56px] items-center justify-between gap-3 rounded-xl border border-slate-100 bg-slate-50 p-3 transition",
|
||||
clickable && "cursor-pointer hover:border-primary/30 hover:bg-primary/5",
|
||||
active && "ring-2 ring-primary ring-offset-1 ring-offset-white !border-primary/40",
|
||||
)}
|
||||
@@ -4033,7 +4389,7 @@ function CollapsedSidebarSection({
|
||||
<div
|
||||
title={title}
|
||||
className={cn(
|
||||
"w-full shrink-0 bg-white border border-slate-200/50 rounded-2xl p-2 shadow-[0_2px_8px_rgba(0,0,0,0.01)] flex flex-col items-center justify-center",
|
||||
"w-full shrink-0 bg-white border border-slate-200/50 rounded-[4px] p-2 shadow-[0_2px_8px_rgba(0,0,0,0.01)] flex flex-col items-center justify-center",
|
||||
className,
|
||||
)}
|
||||
>
|
||||
@@ -4170,7 +4526,7 @@ function RoleRow({
|
||||
: undefined
|
||||
}
|
||||
className={cn(
|
||||
"flex min-h-[60px] items-center justify-between gap-3 rounded-xl p-3 transition",
|
||||
"roundtable-step2-role-row flex min-h-[60px] items-center justify-between gap-3 rounded-xl p-3 transition",
|
||||
isActive
|
||||
? "bg-slate-50 border border-slate-100"
|
||||
: isBootingUp
|
||||
|
||||
Reference in new issue
Block a user