From f23c847e136e1339433c6cf5525df56800b00746 Mon Sep 17 00:00:00 2001 From: liangxu Date: Wed, 8 Jul 2026 01:55:08 +0800 Subject: [PATCH] fix(agent-threads): hide prompt reference directives in thread titles Add a shared visiblePromptText helper and strip reference tokens, image-generator directives, and model-selection lines from agent thread summaries and the assistant panel header, so titles show the user's actual prompt instead of internal directives. Covered by a server test. Co-Authored-By: Claude Opus 4.8 (1M context) --- frontend/src/ui/lib/promptImageReferences.ts | 16 ++++++++ .../src/ui/pages/CanvasWorkspace/index.tsx | 21 +++++----- .../application/agent_threads_test.go | 38 +++++++++++++++++++ server/internal/application/design_service.go | 11 ++++-- 4 files changed, 72 insertions(+), 14 deletions(-) diff --git a/frontend/src/ui/lib/promptImageReferences.ts b/frontend/src/ui/lib/promptImageReferences.ts index a189085..13d654c 100644 --- a/frontend/src/ui/lib/promptImageReferences.ts +++ b/frontend/src/ui/lib/promptImageReferences.ts @@ -75,6 +75,22 @@ export function serializePromptImageReference(reference: Pick (part.type === "text" ? part.text : "")) + .join(""); + return text + .split("\n") + .map((line) => line.trim()) + .filter((line) => { + const lower = line.toLowerCase(); + return line && !lower.startsWith("image generator target node:") && !lower.startsWith("selected model:") && !line.startsWith("模型选择"); + }) + .join(" ") + .replace(/\s{2,}/g, " ") + .trim(); +} + function collectReferenceMatches(content: string) { const matches: ReferenceMatch[] = []; diff --git a/frontend/src/ui/pages/CanvasWorkspace/index.tsx b/frontend/src/ui/pages/CanvasWorkspace/index.tsx index a11e9cd..e6ec1b4 100644 --- a/frontend/src/ui/pages/CanvasWorkspace/index.tsx +++ b/frontend/src/ui/pages/CanvasWorkspace/index.tsx @@ -30,6 +30,7 @@ import { loadMotevaFontCatalog } from "@/ui/components/TextStyleToolbar/fontCata import { WorkspaceTitle } from "@/ui/components/WorkspaceTitle"; import { autoImageAdjustments, defaultImageAdjustments, parseImageAdjustments, serializeImageAdjustments } from "@/ui/lib/imageAdjustments"; import { canvasImageUrl } from "@/ui/lib/imageDelivery"; +import { visiblePromptText } from "@/ui/lib/promptImageReferences"; import { isImageGeneratorThreadMessage, visibleAgentMessages } from "./canvas/agentMessageFilters"; import { CanvasColorPopover } from "./canvas/CanvasColorPopover"; import { buildAlignmentGuides, clamp, minGroupNodeScale, nodeBounds, nodeIntersectsRect, normalizeScreenRect, pointInsideNode, scaleGroupNode, screenBoundsForNodes, screenRectToWorldRect, type AlignmentGuide, type NodeAlignment, type NodeDistribution, type NodeTransform, type ResizeHandle, type SelectionBox } from "@/ui/pages/CanvasWorkspace/canvas/canvasGeometry"; @@ -3756,7 +3757,7 @@ export function CanvasWorkspace({ projectId }: { projectId: string }) {