fix: 会商第二步只对可预览成品出文件卡/开沙箱,去掉干预并发送按钮

This commit is contained in:
董宏凯 committed 2026-08-30 20:02:21 +08:00
1 parent 7066798ab0
commit b92a26cdd4
3 files changed
+41 -29

No files matched your search

@@ -43,6 +43,7 @@ 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 { languageOfStreamingArtifact } from "@/core/artifacts/streaming-write-preview";
import { cn } from "@/lib/utils";
import type { MessageMetric } from "@/components/workspace/messages/use-message-metrics";
@@ -985,14 +986,6 @@ function Step2LegacyComposer({
</span>
</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}
@@ -1163,11 +1156,17 @@ function RoundtableSubtaskCard({
/**
* 收集气泡里所有"写了文件"的产出路径,按出现顺序去重,聚合到一行文件卡片。
*
* 三类来源都算:
* - `present_files`:总控呈现文件,args.filepaths 是数组(可一次多个);
* 三类来源:
* - `present_files`:总控呈现文件,args.filepaths 是数组(可一次多个)。后端
* present_files 已强制"必须在 /mnt/user-data/outputs 下且真实存在",与主聊天
* `chats/:threadId` 的产物面板同源,原样放行;
* - `write_file` / `str_replace`:子智能体被后端 excluded_tools 禁用了 present_files,
* 只能 write_file 写文件,单文件 path 在 args.path —— 也聚合进卡片,保证"凡是写了
* 文件就出可点的卡片",而不是只有 present_files 才出。
* 成品文件就出可点的卡片"。
*
* write_file/str_replace 的 path 需过 `languageOfStreamingArtifact`(只认 .md/.html/
* .mermaid 等可预览产物,与主聊天 `ArtifactWriteToolCall` 的流式预览门槛同一套):
* 席位在沙箱里写的过程文件(fetch.py / r1.txt 等)与无扩展名的畸形路径不再出卡。
*/
function collectPresentedFiles(
steps: Step2Dialogue["steps"],
@@ -1175,22 +1174,23 @@ function collectPresentedFiles(
if (!Array.isArray(steps) || steps.length === 0) return [];
const out: string[] = [];
const seen = new Set<string>();
const add = (fp: unknown) => {
const add = (fp: unknown, requirePreviewable = false) => {
if (typeof fp !== "string" || !fp || seen.has(fp)) return;
if (requirePreviewable && !languageOfStreamingArtifact(fp)) return;
seen.add(fp);
out.push(fp);
};
for (const step of steps) {
if (step.key === "tool_calling:present_files") {
const fps = step.args?.filepaths;
if (Array.isArray(fps)) fps.forEach(add);
if (Array.isArray(fps)) fps.forEach((fp) => add(fp));
continue;
}
if (
step.key === "tool_calling:write_file" ||
step.key === "tool_calling:str_replace"
) {
add(step.args?.path);
add(step.args?.path, true);
}
}
return out;