fix: adapt frontend for legacy Chrome and runtime config
This commit is contained in:
1 parent
db2f21191c
commit
388a9133fc
84 files changed
+1186
-528
No files matched your search
@@ -1340,13 +1340,13 @@ export function useStep2Orchestration(
|
||||
const makeModelSwitchHandler = useCallback(
|
||||
(bubbleId: number, isParallel: boolean) => (info: ModelSwitchInfo) => {
|
||||
const who = info.agentName || "智能体";
|
||||
triggerToast(`⚠️「${info.failedModel}」模型${info.reason},已自动切换「${info.nextModel}」继续`);
|
||||
triggerToast(`「${info.failedModel}」模型${info.reason},已自动切换「${info.nextModel}」继续`);
|
||||
if (isParallel) parallelStreamRef.current.delete(bubbleId);
|
||||
const systemBubble: Step2Dialogue = {
|
||||
id: Date.now() + Math.random(),
|
||||
sender: "系统提示",
|
||||
avatarType: "amber",
|
||||
content: `⚠️ 模型容错:「${who}」所用模型「${info.failedModel}」${info.reason},已自动切换到「${info.nextModel}」继续。`,
|
||||
content: `模型容错:「${who}」所用模型「${info.failedModel}」${info.reason},已自动切换到「${info.nextModel}」继续。`,
|
||||
time: nowTime(),
|
||||
confidence: "模型容错",
|
||||
};
|
||||
@@ -1824,7 +1824,7 @@ export function useStep2Orchestration(
|
||||
highlightSpeaker(null);
|
||||
setPendingClarification(leaderRes.clarification);
|
||||
setClarificationDraft("");
|
||||
triggerToast("❓ 总控需要补充信息,请回答下方问题后继续");
|
||||
triggerToast("总控需要补充信息,请回答下方问题后继续");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1843,7 +1843,7 @@ export function useStep2Orchestration(
|
||||
setConsensusPercentage(100);
|
||||
setHasConsensus(true);
|
||||
triggerToast(
|
||||
"🎉 圆桌研讨论证会圆满落幕!已取得 100% 专家组共识",
|
||||
"圆桌研讨论证会圆满落幕!已取得 100% 专家组共识",
|
||||
);
|
||||
break;
|
||||
}
|
||||
@@ -1962,7 +1962,7 @@ export function useStep2Orchestration(
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("orchestration error:", err);
|
||||
triggerToast(`❌ 研讨异常: ${(err as Error).message}`);
|
||||
triggerToast(`研讨异常: ${(err as Error).message}`);
|
||||
} finally {
|
||||
highlightSpeaker(null);
|
||||
clearAllStreamingSpeakers();
|
||||
@@ -2092,7 +2092,7 @@ export function useStep2Orchestration(
|
||||
highlightSpeaker(null);
|
||||
setPendingClarification(leaderRes.clarification);
|
||||
setClarificationDraft("");
|
||||
triggerToast("❓ 总控需要补充信息,请回答下方问题后继续");
|
||||
triggerToast("总控需要补充信息,请回答下方问题后继续");
|
||||
finishedAllSeats = false;
|
||||
break;
|
||||
}
|
||||
@@ -2220,7 +2220,7 @@ export function useStep2Orchestration(
|
||||
if (closeoutRes.content) setLastLeaderContent(closeoutRes.content);
|
||||
setConsensusPercentage(100);
|
||||
setHasConsensus(true);
|
||||
triggerToast("🎉 业务链条研讨完成!已生成全案结论");
|
||||
triggerToast("业务链条研讨完成!已生成全案结论");
|
||||
} catch (err) {
|
||||
if (closeoutAborter.signal.aborted || (err as Error).name === "AbortError") {
|
||||
finalizeDialogue(closeoutBubbleId, "(已停止)", "已停止");
|
||||
@@ -2234,7 +2234,7 @@ export function useStep2Orchestration(
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("chain orchestration error:", err);
|
||||
triggerToast(`❌ 链条研讨异常: ${(err as Error).message}`);
|
||||
triggerToast(`链条研讨异常: ${(err as Error).message}`);
|
||||
} finally {
|
||||
highlightSpeaker(null);
|
||||
clearAllStreamingSpeakers();
|
||||
@@ -2283,7 +2283,7 @@ export function useStep2Orchestration(
|
||||
async (seedMessage: string, ids: ThreadIdMap, coord: string) => {
|
||||
const plan = orchestrationPlanRef.current;
|
||||
if (!plan || plan.stages.length === 0) {
|
||||
triggerToast("⚠️ 没有可执行的 DAG 编排计划");
|
||||
triggerToast("没有可执行的 DAG 编排计划");
|
||||
return;
|
||||
}
|
||||
if (isOrchestratingRef.current) return;
|
||||
@@ -2398,7 +2398,7 @@ export function useStep2Orchestration(
|
||||
finalizeDialogue(leaderBubbleId, leaderRes.content, "等待用户澄清");
|
||||
setPendingClarification(leaderRes.clarification);
|
||||
setClarificationDraft("");
|
||||
triggerToast("❓ 总控需要补充信息,请回答下方问题后继续");
|
||||
triggerToast("总控需要补充信息,请回答下方问题后继续");
|
||||
finishedAllStages = false;
|
||||
break;
|
||||
}
|
||||
@@ -2579,11 +2579,11 @@ export function useStep2Orchestration(
|
||||
// 不收口(plan.finalSynthesis=false):全部 stage 跑完即视为完成,不再叫总控。
|
||||
setConsensusPercentage(100);
|
||||
setHasConsensus(true);
|
||||
triggerToast("✅ 依赖编排各阶段已全部完成");
|
||||
triggerToast("依赖编排各阶段已全部完成");
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("dag orchestration error:", err);
|
||||
triggerToast(`❌ 依赖编排研讨异常: ${(err as Error).message}`);
|
||||
triggerToast(`依赖编排研讨异常: ${(err as Error).message}`);
|
||||
} finally {
|
||||
highlightSpeaker(null);
|
||||
clearAllStreamingSpeakers();
|
||||
@@ -2807,10 +2807,10 @@ export function useStep2Orchestration(
|
||||
appendDialogue({
|
||||
sender: "系统",
|
||||
avatarType: "blue",
|
||||
content: `✅ 圆桌已就绪:协调智能体 ${initRes.main_agent_name} 已上线,${Object.keys(initRes.thread_ids).length - 1} 个席位已分配独立线程。`,
|
||||
content: `圆桌已就绪:协调智能体 ${initRes.main_agent_name} 已上线,${Object.keys(initRes.thread_ids).length - 1} 个席位已分配独立线程。`,
|
||||
confidence: "系统就绪",
|
||||
});
|
||||
triggerToast("✅ 多智能体圆桌初始化完成");
|
||||
triggerToast("多智能体圆桌初始化完成");
|
||||
await runActiveOrchestration(
|
||||
buildInitialIntent(),
|
||||
initRes.thread_ids,
|
||||
@@ -2820,7 +2820,7 @@ export function useStep2Orchestration(
|
||||
console.error("init multi-agent failed:", err);
|
||||
if (cancelled) return;
|
||||
setInitError((err as Error).message);
|
||||
triggerToast(`❌ 初始化失败: ${(err as Error).message}`);
|
||||
triggerToast(`初始化失败: ${(err as Error).message}`);
|
||||
} finally {
|
||||
if (!cancelled) setIsInitializing(false);
|
||||
}
|
||||
@@ -2887,7 +2887,7 @@ export function useStep2Orchestration(
|
||||
const userText = customAgentInput.trim();
|
||||
if (!userText) return;
|
||||
if (!threadIdsRef.current || !coordinatorNameRef.current) {
|
||||
triggerToast("⚠️ 圆桌尚未就绪,无法记录干预指令");
|
||||
triggerToast("圆桌尚未就绪,无法记录干预指令");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2895,7 +2895,7 @@ export function useStep2Orchestration(
|
||||
appendDialogue({
|
||||
sender: "用户 (插话干预)",
|
||||
avatarType: "human",
|
||||
content: `💡 (人工指令介入) ${userText}`,
|
||||
content: `(人工指令介入) ${userText}`,
|
||||
confidence: "最高指令",
|
||||
});
|
||||
pendingInjectPromptRef.current = `用户人工干预新指令:${userText}\n\n请优先按这条新指令,通过 agent_orchestration 把活派给相关的真实席位去获取交付;若用户点名了某个席位(如"前端实现"),必须派给清单里对应的那个 agent_name。**不要**自己代答,也**不要**在没有真正看到该席位「完成…交付内容为:…」的情况下臆造交付或直接收口。只有当用户明确要求收口、或相关席位都已真实交付时,才综合输出结论。`;
|
||||
@@ -2908,7 +2908,7 @@ export function useStep2Orchestration(
|
||||
const hasFiles = !!(files && files.length > 0);
|
||||
if (!userText && !hasFiles) return;
|
||||
if (!threadIdsRef.current || !coordinatorNameRef.current) {
|
||||
triggerToast("⚠️ 圆桌尚未就绪,无法记录干预指令");
|
||||
triggerToast("圆桌尚未就绪,无法记录干预指令");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2929,7 +2929,7 @@ export function useStep2Orchestration(
|
||||
status: "uploaded",
|
||||
}));
|
||||
} catch (err) {
|
||||
triggerToast(`❌ 文件上传失败: ${(err as Error).message}`);
|
||||
triggerToast(`文件上传失败: ${(err as Error).message}`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2947,7 +2947,7 @@ export function useStep2Orchestration(
|
||||
appendDialogue({
|
||||
sender: "用户 (插话干预)",
|
||||
avatarType: "human",
|
||||
content: `💡 (人工指令介入) ${shownText}${fileNote}`,
|
||||
content: `(人工指令介入) ${shownText}${fileNote}`,
|
||||
confidence: "最高指令",
|
||||
});
|
||||
|
||||
@@ -2977,7 +2977,7 @@ export function useStep2Orchestration(
|
||||
const answer = rawAnswer.trim();
|
||||
if (!answer) return;
|
||||
if (!threadIdsRef.current || !coordinatorNameRef.current) {
|
||||
triggerToast("⚠️ 圆桌尚未就绪,无法回复澄清");
|
||||
triggerToast("圆桌尚未就绪,无法回复澄清");
|
||||
return;
|
||||
}
|
||||
if (isOrchestratingRef.current) {
|
||||
@@ -2988,7 +2988,7 @@ export function useStep2Orchestration(
|
||||
appendDialogue({
|
||||
sender: "用户 (澄清回复)",
|
||||
avatarType: "human",
|
||||
content: `🗣 回复总控提问:${answer}`,
|
||||
content: `回复总控提问:${answer}`,
|
||||
confidence: "澄清回复",
|
||||
});
|
||||
setPendingClarification(null);
|
||||
@@ -3008,7 +3008,7 @@ export function useStep2Orchestration(
|
||||
const handleBudgetChange = useCallback(
|
||||
(newVal: number) => {
|
||||
setBudgetLimit(newVal);
|
||||
triggerToast(`💰 研商经费调优约束变更为 ${newVal} 万!各大智能体启动资源重算...`);
|
||||
triggerToast(`研商经费调优约束变更为 ${newVal} 万!各大智能体启动资源重算...`);
|
||||
|
||||
setTimeout(() => {
|
||||
const respTime = nowTime();
|
||||
@@ -3017,13 +3017,13 @@ export function useStep2Orchestration(
|
||||
let senderName = "风险审查智能体";
|
||||
|
||||
if (newVal < 400) {
|
||||
agentOpinion = `⚠️ [预算警报] 经费压缩至 ${newVal} 万元,自动触发紧急安全妥协防御策略!我们将不得不裁剪旁路冷备份服务器配置,降低静态演练深度,算力容灾等级重下降至 Tier I (低安全水位)。`;
|
||||
agentOpinion = `[预算警报] 经费压缩至 ${newVal} 万元,自动触发紧急安全妥协防御策略!我们将不得不裁剪旁路冷备份服务器配置,降低静态演练深度,算力容灾等级重下降至 Tier I (低安全水位)。`;
|
||||
} else if (newVal > 540) {
|
||||
agentOpinion = `🔋 [方案容量上升] 预算上调至充足的 ${newVal} 万元,资装弹性充裕!我已为 A 套极速构建增加了 4 组外部超大异地区容灾节点支持,灾备冗余度成功突破 Tier III+ 指标,高防高内聚!`;
|
||||
agentOpinion = `[方案容量上升] 预算上调至充足的 ${newVal} 万元,资装弹性充裕!我已为 A 套极速构建增加了 4 组外部超大异地区容灾节点支持,灾备冗余度成功突破 Tier III+ 指标,高防高内聚!`;
|
||||
speakerType = "purple";
|
||||
senderName = "情报收集与适配";
|
||||
} else {
|
||||
agentOpinion = `⚡ [资源调配优化] 总体经费设定为 ${newVal} 万元,空间适中。我们重新规划了轻量容器 K3s 集成开销(约 ${Math.round(newVal * 0.45)} 万)和安全审计费比,总体博弈过程保持稳定态收敛。`;
|
||||
agentOpinion = `[资源调配优化] 总体经费设定为 ${newVal} 万元,空间适中。我们重新规划了轻量容器 K3s 集成开销(约 ${Math.round(newVal * 0.45)} 万)和安全审计费比,总体博弈过程保持稳定态收敛。`;
|
||||
speakerType = "pink";
|
||||
senderName = "执行规划智能体";
|
||||
}
|
||||
@@ -3059,11 +3059,11 @@ export function useStep2Orchestration(
|
||||
appendDialogue({
|
||||
sender: `${roleName} (${targetModel})`,
|
||||
avatarType: avatarColor,
|
||||
content: `⚡ [模型偏好已保存] 本席位在下一轮研讨中将使用 ${targetModel} 进行推理。系统提示词与温度(${cfg?.temp ?? 0.2})当前仅在前端记录,等后端开放覆写后再同步生效。`,
|
||||
content: `[模型偏好已保存] 本席位在下一轮研讨中将使用 ${targetModel} 进行推理。系统提示词与温度(${cfg?.temp ?? 0.2})当前仅在前端记录,等后端开放覆写后再同步生效。`,
|
||||
confidence: "席位偏好",
|
||||
});
|
||||
setSelectedAgentId(null);
|
||||
triggerToast(`⚙️ "${roleName}"已切换至 ${targetModel},下轮生效`);
|
||||
triggerToast(`"${roleName}"已切换至 ${targetModel},下轮生效`);
|
||||
},
|
||||
[agentConfigs, agentNameToRole, appendDialogue, selectedAgents, selectedModel, triggerToast],
|
||||
);
|
||||
@@ -3162,7 +3162,7 @@ export function useStep2Orchestration(
|
||||
// 与 handleInjectToRoundtable 末尾「直接启动新一轮编排」同构。
|
||||
const resumeLiveTakeover = useCallback((): boolean => {
|
||||
if (!threadIdsRef.current || !coordinatorNameRef.current) {
|
||||
triggerToast("⚠️ 接管失败:未找到研讨线程,已切换为只读查看");
|
||||
triggerToast("接管失败:未找到研讨线程,已切换为只读查看");
|
||||
return false;
|
||||
}
|
||||
dagPlanExecutedRef.current = true;
|
||||
@@ -3178,7 +3178,7 @@ export function useStep2Orchestration(
|
||||
threadIdsRef.current,
|
||||
coordinatorNameRef.current,
|
||||
);
|
||||
triggerToast("🎮 已接管至前端,继续实时研讨");
|
||||
triggerToast("已接管至前端,继续实时研讨");
|
||||
return true;
|
||||
}, [abortAllInFlight, runActiveOrchestration, triggerToast]);
|
||||
|
||||
|
||||
Reference in new issue
Block a user