fix: 会商沙箱预览头仅在可提交的 Markdown 产物显示提交按钮

This commit is contained in:
董宏凯 committed 2026-08-30 20:02:21 +08:00
1 parent a4f95a4fa9
commit dd560ceb46
1 file changed
+23 -8
@@ -144,6 +144,25 @@ export function Step2SandboxLayout({
}, [artifacts, isStreaming, seatMessages]); }, [artifacts, isStreaming, seatMessages]);
const previewThreadId = activeThreadId ?? ""; const previewThreadId = activeThreadId ?? "";
const selectedArtifactTarget = useMemo(() => {
const target = {
threadId: previewThreadId,
path: selectedArtifact ?? "",
content: selectedArtifactContent,
};
return taskArtifactSubmission?.targetFor(target) ?? target;
}, [
previewThreadId,
selectedArtifact,
selectedArtifactContent,
taskArtifactSubmission,
]);
// 8BF 等接入任务过程产物提交的页面,用提交按钮替换文件类型;其余普通/任务深链
// 会商仍保留原有文件类型徽标。非 Markdown 产物本身不能提交,也应显示类型。
const showTaskArtifactSubmit = Boolean(
taskArtifactSubmission?.enabled
&& taskArtifactSubmission.isMarkdown(selectedArtifactTarget),
);
const artifactPanelBody = ( const artifactPanelBody = (
<div <div
@@ -162,18 +181,14 @@ export function Step2SandboxLayout({
onClose={artifactsFill && onArtifactsClose ? handleArtifactsClose : undefined} onClose={artifactsFill && onArtifactsClose ? handleArtifactsClose : undefined}
// 会商「消息列表沙箱」按需求不脱敏产物内容(用户要拿原始文件)。 // 会商「消息列表沙箱」按需求不脱敏产物内容(用户要拿原始文件)。
disableDesensitize disableDesensitize
headerLeadingActionBare headerLeadingAction={showTaskArtifactSubmit ? (
headerLeadingAction={(
<TaskArtifactSubmitButton <TaskArtifactSubmitButton
compact compact
controller={taskArtifactSubmission} controller={taskArtifactSubmission}
target={taskArtifactSubmission?.targetFor({ target={selectedArtifactTarget}
threadId: previewThreadId,
path: selectedArtifact,
content: selectedArtifactContent,
}) ?? { threadId: previewThreadId, path: selectedArtifact }}
/> />
)} ) : undefined}
headerLeadingActionBare={showTaskArtifactSubmit}
/> />
) : ( ) : (
<div className="relative flex size-full justify-center"> <div className="relative flex size-full justify-center">