fix(tools): centralize shared LLM note constants

This commit is contained in:
lc6464
2026-04-17 14:31:43 +08:00
parent 9b4efddd9b
commit 743cd3602b
2 changed files with 8 additions and 8 deletions
+6 -6
View File
@@ -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) {
+2 -2
View File
@@ -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 {