代码提交
This commit is contained in:
1 parent
250db4de04
commit
1244fb1f2f
14 files changed
+515
-38
No files matched your search
@@ -12,6 +12,9 @@ export type { ClarificationPayload };
|
||||
export const INTENT_AGENT_ID = "roundtable-intent";
|
||||
/** Dedicated Step 1 agent for the position-roundtable workspace. */
|
||||
export const POSITION_INTENT_AGENT_ID = "position-roundtable-intent";
|
||||
/** Dedicated Step 1 agent for the 8BF roundtable workspace (same prompt family
|
||||
* as `roundtable-intent`, independently tunable via the agent config UI). */
|
||||
export const EIGHTBF_INTENT_AGENT_ID = "eightbf-roundtable-intent";
|
||||
|
||||
/**
|
||||
* Task-intent agent (Step 1) API. Mirror of multi-agent.ts but with a single
|
||||
|
||||
@@ -81,7 +81,8 @@ export interface Step1InputAreaProps {
|
||||
isSending: boolean;
|
||||
canSend: boolean;
|
||||
pendingClarification: boolean;
|
||||
onSend: () => void;
|
||||
/** 发送当前输入框内容;传 `overrideText` 时直接发送该文本(常用问题一键发送)。 */
|
||||
onSend: (overrideText?: string) => void;
|
||||
onStop: () => void;
|
||||
onFollowUp: () => void;
|
||||
onSkip: () => void;
|
||||
@@ -236,9 +237,12 @@ export function Step1Panel(props: Step1PanelProps) {
|
||||
setAttachedFiles((prev) => prev.filter((_, i) => i !== idx));
|
||||
};
|
||||
|
||||
const handleSend = () => {
|
||||
if (!inputText.trim() && attachedFiles.length === 0) return;
|
||||
onSendMessage(inputText, attachedFiles.length > 0 ? attachedFiles : undefined);
|
||||
const handleSend = (overrideText?: string) => {
|
||||
// overrideText:常用问题 chip 一键发送——绕过异步的输入框 state,
|
||||
// 直接以问题全文作为本回合消息(仍共享附件与发送后的清空逻辑)。
|
||||
const textToSend = overrideText ?? inputText;
|
||||
if (!textToSend.trim() && attachedFiles.length === 0) return;
|
||||
onSendMessage(textToSend, attachedFiles.length > 0 ? attachedFiles : undefined);
|
||||
handleInputTextChange("");
|
||||
setAttachedFiles([]);
|
||||
};
|
||||
@@ -411,7 +415,7 @@ export function Step1Panel(props: Step1PanelProps) {
|
||||
<div className="flex items-center gap-2">
|
||||
<button
|
||||
id="send-message-btn"
|
||||
onClick={handleSend}
|
||||
onClick={() => handleSend()}
|
||||
disabled={isIntentSending || !intentThreadId}
|
||||
className="bg-primary text-white hover:bg-[var(--brand-900)] disabled:bg-slate-300 disabled:cursor-not-allowed text-xs font-bold px-4 py-2.5 rounded-xl flex items-center gap-1.5 transition-all shadow-[0_2px_8px_rgba(245,34,45,0.15)] active:scale-95"
|
||||
>
|
||||
|
||||
@@ -422,6 +422,12 @@ export interface UseStep2OrchestrationOptions {
|
||||
seatSkillDirectives?: Record<string, boolean>;
|
||||
/** Per-seat human-validation checkpoints inherited from the selected chain. */
|
||||
humanValidations?: Record<string, boolean>;
|
||||
/**
|
||||
* 全局「人工干预」开关(8BF 页头):开启后第二步每走一步(链条每席位 / DAG 每 stage
|
||||
* 完成)就暂停等待用户输入或恢复;关闭则全自动推进,与既有行为一致。与 per-seat
|
||||
* `humanValidations` 取 OR——任一生效即在最近一步边界暂停。
|
||||
*/
|
||||
manualIntervention?: boolean;
|
||||
/**
|
||||
* 每席位「推理深度覆盖」映射 {agentId: SeatMode | null}(沿用所选业务链条里每个席位的配置)。
|
||||
* 派活该 special 席位时按 agentId 查表,**席位覆盖优先、否则跟随链条级 `selectedMode`**:
|
||||
@@ -593,6 +599,7 @@ export function useStep2Orchestration(
|
||||
selectedMode,
|
||||
seatSkillDirectives = {},
|
||||
humanValidations = {},
|
||||
manualIntervention = false,
|
||||
seatModes = {},
|
||||
gatherFirst = false,
|
||||
orchestrationMode,
|
||||
@@ -746,6 +753,9 @@ export function useStep2Orchestration(
|
||||
// 每席位技能识别强化映射(所选业务链条各席位开关)同样打到 ref,席位调用按 agentId 读最新值。
|
||||
const seatSkillDirectivesRef = useRef<Record<string, boolean>>(seatSkillDirectives);
|
||||
const humanValidationsRef = useRef<Record<string, boolean>>(humanValidations);
|
||||
// 全局「人工干预」开关(8BF 页头):编排循环在每个一步边界读最新值,
|
||||
// 中途切换只影响下一次边界,不打断在途 run。
|
||||
const manualInterventionRef = useRef<boolean>(manualIntervention);
|
||||
// 每席位推理深度覆盖映射(所选业务链条各席位 seatMode)打到 ref,席位调用按 agentId 读最新值;
|
||||
// 覆盖优先、否则跟随 selectedModeRef。
|
||||
const seatModesRef = useRef<Record<string, SeatMode | null>>(seatModes);
|
||||
@@ -800,6 +810,9 @@ export function useStep2Orchestration(
|
||||
useEffect(() => {
|
||||
humanValidationsRef.current = humanValidations;
|
||||
}, [humanValidations]);
|
||||
useEffect(() => {
|
||||
manualInterventionRef.current = manualIntervention;
|
||||
}, [manualIntervention]);
|
||||
useEffect(() => {
|
||||
seatModesRef.current = seatModes;
|
||||
}, [seatModes]);
|
||||
@@ -1681,12 +1694,16 @@ export function useStep2Orchestration(
|
||||
);
|
||||
|
||||
const pauseForHumanValidation = useCallback(
|
||||
(continuation: HumanValidationContinuation, seatNames: string[]) => {
|
||||
(
|
||||
continuation: HumanValidationContinuation,
|
||||
seatNames: string[],
|
||||
source = "业务链条配置",
|
||||
) => {
|
||||
humanValidationContinuationRef.current = continuation;
|
||||
appendDialogue({
|
||||
sender: "系统",
|
||||
avatarType: "blue",
|
||||
content: `已完成 ${seatNames.join("、")} 的输出,按业务链条配置暂停,等待人工校验。可直接点击“恢复会商”继续,或在下方输入修改意见后提交。`,
|
||||
content: `已完成 ${seatNames.join("、")} 的输出,按${source}暂停,等待人工校验。可直接点击“恢复会商”继续,或在下方输入修改意见后提交。`,
|
||||
confidence: "等待人工校验",
|
||||
});
|
||||
setIsRoundTableRunning(false);
|
||||
@@ -2793,18 +2810,27 @@ export function useStep2Orchestration(
|
||||
}
|
||||
if (!chainInvalidNames.includes(seatName)) chainInvalidNames.push(seatName);
|
||||
finishedAllSeats = false;
|
||||
if (humanValidationsRef.current[seat.agent_id]) {
|
||||
pauseForHumanValidation({ mode: "chain", nextSeatIndex: i }, [seatName]);
|
||||
if (manualInterventionRef.current || humanValidationsRef.current[seat.agent_id]) {
|
||||
pauseForHumanValidation(
|
||||
{ mode: "chain", nextSeatIndex: i },
|
||||
[seatName],
|
||||
manualInterventionRef.current && !humanValidationsRef.current[seat.agent_id]
|
||||
? "人工干预开关"
|
||||
: undefined,
|
||||
);
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
setConsensusPercentage(Math.min(95, Math.round(((i + 1) / total) * 90)));
|
||||
if (humanValidationsRef.current[seat.agent_id]) {
|
||||
if (manualInterventionRef.current || humanValidationsRef.current[seat.agent_id]) {
|
||||
pauseForHumanValidation(
|
||||
{ mode: "chain", nextSeatIndex: i + 1 },
|
||||
[seatName],
|
||||
manualInterventionRef.current && !humanValidationsRef.current[seat.agent_id]
|
||||
? "人工干预开关"
|
||||
: undefined,
|
||||
);
|
||||
finishedAllSeats = false;
|
||||
break;
|
||||
@@ -3237,8 +3263,11 @@ export function useStep2Orchestration(
|
||||
setConsensusPercentage(
|
||||
Math.min(95, Math.round(((s + 1) / plan.stages.length) * 90)),
|
||||
);
|
||||
const manualInterventionOn = manualInterventionRef.current;
|
||||
const validationSeatNames = stageSeats
|
||||
.filter(({ agentId }) => humanValidationsRef.current[agentId])
|
||||
.filter(
|
||||
({ agentId }) => manualInterventionOn || humanValidationsRef.current[agentId],
|
||||
)
|
||||
.map(({ name }) => name);
|
||||
if (validationSeatNames.length > 0) {
|
||||
pauseForHumanValidation(
|
||||
@@ -3248,6 +3277,7 @@ export function useStep2Orchestration(
|
||||
priorDeliveries: [...priorDeliveries],
|
||||
},
|
||||
validationSeatNames,
|
||||
manualInterventionOn ? "人工干预开关" : undefined,
|
||||
);
|
||||
finishedAllStages = false;
|
||||
break;
|
||||
|
||||
@@ -75,6 +75,7 @@ import {
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { desensitize } from "@/lib/desensitize";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { useDesensitizeSubtree } from "@/roundtable-planning/lib/use-desensitize-subtree";
|
||||
@@ -324,6 +325,15 @@ export default function RoundtablePlanningPage({
|
||||
entryRailTaskCardSlot,
|
||||
/** 独立业务页传给意图智能体的隐藏任务上下文。 */
|
||||
taskContext,
|
||||
/** 第一步绑定的内置意图智能体 id(如 8BF 的 eightbf-roundtable-intent)。
|
||||
* 缺省沿用通用会商的 roundtable-intent,原多智能体会商入口行为不变。 */
|
||||
intentAgentId,
|
||||
/**
|
||||
* 8BF 页头「人工干预」开关(受控):开启后第二步每走一步暂停等待用户输入,
|
||||
* 关闭自动推进。提供 onStep2InterventionChange 时才渲染开关,通用会商页不受影响。
|
||||
*/
|
||||
step2InterventionEnabled,
|
||||
onStep2InterventionChange,
|
||||
/** 独立业务页的任务作用域,仅用于左栏记录筛选,不改变原深链逻辑。 */
|
||||
entryRailTaskId,
|
||||
/** 独立业务页的根节点样式类,避免修改原会商样式。 */
|
||||
@@ -367,6 +377,11 @@ export default function RoundtablePlanningPage({
|
||||
entryRailBusinessChainSlot?: ReactNode;
|
||||
entryRailTaskCardSlot?: ReactNode;
|
||||
taskContext?: Record<string, unknown> | null;
|
||||
/** 第一步绑定的内置意图智能体 id;缺省走通用 roundtable-intent。 */
|
||||
intentAgentId?: string;
|
||||
/** 第二步「人工干预」开关(8BF 页头,新建任务按钮左侧)。 */
|
||||
step2InterventionEnabled?: boolean;
|
||||
onStep2InterventionChange?: (enabled: boolean) => void;
|
||||
entryRailTaskId?: string | null;
|
||||
rootClassName?: string;
|
||||
renderStep1?: (props: Step1PanelProps & {
|
||||
@@ -755,6 +770,7 @@ export default function RoundtablePlanningPage({
|
||||
selectedMode: seatMode,
|
||||
seatSkillDirectives,
|
||||
humanValidations,
|
||||
manualIntervention: step2InterventionEnabled ?? false,
|
||||
seatModes,
|
||||
gatherFirst,
|
||||
orchestrationMode,
|
||||
@@ -771,6 +787,7 @@ export default function RoundtablePlanningPage({
|
||||
selectedModel,
|
||||
triggerToast,
|
||||
taskContext,
|
||||
intentAgentId,
|
||||
});
|
||||
|
||||
const taskArtifactSubmission = useTaskArtifactSubmission(
|
||||
@@ -2381,6 +2398,23 @@ export default function RoundtablePlanningPage({
|
||||
</button>
|
||||
)}
|
||||
|
||||
{/* 8BF:第二步「人工干预」开关。开启后第二步每走一步暂停,等待用户输入 /
|
||||
恢复后继续;关闭则自动推进(与原行为一致)。仅独立业务页传入受控回调时渲染。 */}
|
||||
{onStep2InterventionChange && (
|
||||
<label
|
||||
id="step2-intervention-toggle"
|
||||
title="开启后:第二步每完成一步暂停,可在下方输入修改意见或点击“恢复会商”继续;关闭后:自动完成整个研讨"
|
||||
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-2 transition cursor-pointer select-none dark:border-border dark:bg-secondary dark:text-foreground dark:hover:bg-accent"
|
||||
>
|
||||
<Switch
|
||||
checked={step2InterventionEnabled ?? false}
|
||||
onCheckedChange={onStep2InterventionChange}
|
||||
className="scale-90"
|
||||
/>
|
||||
人工干预
|
||||
</label>
|
||||
)}
|
||||
|
||||
{/* 深链接(taskId)模式:任务固定,把「新建任务」换成「重新分析」——清空会话、对同一任务重做意图分析。 */}
|
||||
{prefillRef.current?.taskId ? (
|
||||
<button
|
||||
|
||||
Reference in new issue
Block a user