mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-08 01:39:12 +00:00
tweak: tool outputs to be more llm friendly (#13269)
This commit is contained in:
@@ -109,7 +109,8 @@ export const GrepTool = Tool.define("grep", {
|
||||
}
|
||||
}
|
||||
|
||||
const outputLines = [`Found ${finalMatches.length} matches`]
|
||||
const totalMatches = matches.length
|
||||
const outputLines = [`Found ${totalMatches} matches${truncated ? ` (showing first ${limit})` : ""}`]
|
||||
|
||||
let currentFile = ""
|
||||
for (const match of finalMatches) {
|
||||
@@ -127,7 +128,9 @@ export const GrepTool = Tool.define("grep", {
|
||||
|
||||
if (truncated) {
|
||||
outputLines.push("")
|
||||
outputLines.push("(Results are truncated. Consider using a more specific path or pattern.)")
|
||||
outputLines.push(
|
||||
`(Results truncated: showing ${limit} of ${totalMatches} matches (${totalMatches - limit} hidden). Consider using a more specific path or pattern.)`,
|
||||
)
|
||||
}
|
||||
|
||||
if (hasErrors) {
|
||||
@@ -138,7 +141,7 @@ export const GrepTool = Tool.define("grep", {
|
||||
return {
|
||||
title: params.pattern,
|
||||
metadata: {
|
||||
matches: finalMatches.length,
|
||||
matches: totalMatches,
|
||||
truncated,
|
||||
},
|
||||
output: outputLines.join("\n"),
|
||||
|
||||
Reference in New Issue
Block a user