From 743cd3602bfccfc57254a20b4bd9bd66901addc7 Mon Sep 17 00:00:00 2001 From: lc6464 <64722907+lc6464@users.noreply.github.com> Date: Fri, 17 Apr 2026 14:31:43 +0800 Subject: [PATCH] fix(tools): centralize shared LLM note constants --- pkg/tools/shared/result.go | 12 ++++++------ pkg/tools/shared_facade.go | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/tools/shared/result.go b/pkg/tools/shared/result.go index 1719e1d93..e4b16f7b3 100644 --- a/pkg/tools/shared/result.go +++ b/pkg/tools/shared/result.go @@ -8,8 +8,8 @@ import ( ) const ( - handledToolLLMNote = "The requested output has already been delivered to the user in the current chat. Do not call send_file or any other delivery tool again. If you reply, provide only a brief confirmation." - artifactPathsLLMNote = "Use `send_file` with one of these paths to send it to the user, or use file/exec tools to save it inside the workspace if requested." + HandledToolLLMNote = "The requested output has already been delivered to the user in the current chat. Do not call send_file or any other delivery tool again. If you reply, provide only a brief confirmation." + ArtifactPathsLLMNote = "Use `send_file` with one of these paths to send it to the user, or use file/exec tools to save it inside the workspace if requested." ) // ToolResult represents the structured return value from tool execution. @@ -73,14 +73,14 @@ func (tr *ToolResult) ContentForLLM() string { } if tr.ResponseHandled { if content == "" { - return handledToolLLMNote + return HandledToolLLMNote } - if !strings.Contains(content, handledToolLLMNote) { - content += "\n" + handledToolLLMNote + if !strings.Contains(content, HandledToolLLMNote) { + content += "\n" + HandledToolLLMNote } } if len(tr.ArtifactTags) > 0 { - artifactNote := "Local artifact paths: " + strings.Join(tr.ArtifactTags, " ") + "\n" + artifactPathsLLMNote + artifactNote := "Local artifact paths: " + strings.Join(tr.ArtifactTags, " ") + "\n" + ArtifactPathsLLMNote if content == "" { content = artifactNote } else if !strings.Contains(content, artifactNote) { diff --git a/pkg/tools/shared_facade.go b/pkg/tools/shared_facade.go index 28717c435..6e40e4e3a 100644 --- a/pkg/tools/shared_facade.go +++ b/pkg/tools/shared_facade.go @@ -26,8 +26,8 @@ type ( ) const ( - handledToolLLMNote = "The requested output has already been delivered to the user in the current chat. Do not call send_file or any other delivery tool again. If you reply, provide only a brief confirmation." - artifactPathsLLMNote = "Use `send_file` with one of these paths to send it to the user, or use file/exec tools to save it inside the workspace if requested." + handledToolLLMNote = toolshared.HandledToolLLMNote + artifactPathsLLMNote = toolshared.ArtifactPathsLLMNote ) func WithToolContext(ctx context.Context, channel, chatID string) context.Context {