feat: polish web master-agent controls and dispatch recovery

This commit is contained in:
kris
2026-04-01 07:50:20 +08:00
parent 87093677b8
commit e52932e8ef
8 changed files with 153 additions and 29 deletions

View File

@@ -867,10 +867,12 @@ export function ChatComposer({
projectId,
initialPendingDispatchPlan,
initialRejectedDispatchPlan,
dispatchPlanRecoveryHint,
}: {
projectId: string;
initialPendingDispatchPlan?: PendingDispatchPlanState | null;
initialRejectedDispatchPlan?: PendingDispatchPlanState | null;
dispatchPlanRecoveryHint?: string | null;
}) {
const router = useRouter();
const [value, setValue] = useState("");
@@ -1128,6 +1130,11 @@ export function ChatComposer({
{message}
</div>
) : null}
{dispatchPlanRecoveryHint ? (
<div className="mt-3 rounded-2xl border border-[#E5E5EA] bg-[#F7F8FA] px-4 py-3 text-[12px] leading-6 text-[#57606A]">
{dispatchPlanRecoveryHint}
</div>
) : null}
{pendingDispatchPlan ? (
<div className="mt-3 rounded-2xl border border-[#E5E5EA] bg-[#F7F8FA] px-4 py-4 text-[12px] leading-6 text-[#57606A]">
<div className="text-[14px] font-semibold text-[#111111]"> Agent </div>
@@ -1167,7 +1174,10 @@ export function ChatComposer({
<div className="mt-3 rounded-2xl border border-[#F3D19C] bg-[#FFF7E6] px-4 py-4 text-[12px] leading-6 text-[#8D5D00]">
<div className="text-[14px] font-semibold text-[#111111]"></div>
<div className="mt-2 whitespace-pre-line">{summarizeDispatchPlan(rejectedDispatchPlan)}</div>
<div className="mt-2"></div>
<div className="mt-2">
{dispatchPlanRecoveryHint ??
"如果还想继续当前协作,可以直接重新生成新的推荐,不用把整条需求重新打一遍。"}
</div>
<div className="mt-3 flex flex-wrap gap-2">
<button
type="button"
@@ -1175,7 +1185,7 @@ export function ChatComposer({
onClick={() => void retryDispatchPlan()}
className="rounded-full bg-[#07C160] px-4 py-2 text-[13px] font-semibold text-white disabled:bg-[#B7E6C9]"
>
</button>
</div>
</div>

View File

@@ -11,6 +11,7 @@ import type {
ProjectAgentControls,
UserMasterPrompt,
} from "@/lib/boss-data";
import type { MasterAgentChatPageAnchors } from "@/lib/master-agent-chat-menu";
import { formatTimestampLabel } from "@/lib/boss-projections";
type MemoryDraft = {
@@ -146,6 +147,7 @@ export function MasterAgentPromptMemoryClient({
projectControls,
globalMemories,
projectMemories,
anchors,
}: {
isAdmin: boolean;
promptPolicy: MasterAgentPromptPolicy | null;
@@ -153,6 +155,7 @@ export function MasterAgentPromptMemoryClient({
projectControls: ProjectAgentControls | null;
globalMemories: MasterAgentMemory[];
projectMemories: MasterAgentMemory[];
anchors: MasterAgentChatPageAnchors;
}) {
const router = useRouter();
const [busyKey, setBusyKey] = useState<string | null>(null);
@@ -326,7 +329,7 @@ export function MasterAgentPromptMemoryClient({
return (
<div className="flex flex-col gap-4 px-[18px] pb-6">
<div id="prompt-section" className="rounded-2xl border border-[#E5E5EA] bg-white px-4 py-4 scroll-mt-4">
<div id={anchors.prompt.split("#")[1]} className="rounded-2xl border border-[#E5E5EA] bg-white px-4 py-4 scroll-mt-4">
<div className="text-[16px] font-semibold text-[#111111]"> Agent </div>
<div className="mt-2 text-[12px] leading-6 text-[#8C8C8C]">
@@ -400,7 +403,7 @@ export function MasterAgentPromptMemoryClient({
</span>
</div>
<div className="grid gap-3 md:grid-cols-2">
<label className="space-y-1">
<label id={anchors.model.split("#")[1]} className="space-y-1 scroll-mt-4">
<div className="text-[12px] text-[#8C8C8C]"></div>
<select
value={modelOverride}
@@ -413,7 +416,7 @@ export function MasterAgentPromptMemoryClient({
<option value="gpt-4.1-mini">gpt-4.1-mini</option>
</select>
</label>
<label className="space-y-1">
<label id={anchors.reasoningEffort.split("#")[1]} className="space-y-1 scroll-mt-4">
<div className="text-[12px] text-[#8C8C8C]"></div>
<select
value={reasoningEffortOverride}
@@ -453,7 +456,7 @@ export function MasterAgentPromptMemoryClient({
</div>
</div>
<div id="memory-section" className="rounded-2xl border border-[#E5E5EA] bg-white px-4 py-4 scroll-mt-4">
<div id={anchors.memory.split("#")[1]} className="rounded-2xl border border-[#E5E5EA] bg-white px-4 py-4 scroll-mt-4">
<div className="text-[16px] font-semibold text-[#111111]"></div>
<div className="mt-2 text-[12px] leading-6 text-[#8C8C8C]">
master-agent