Compare commits
2 Commits
eeca909b65
...
d3361c13c5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3361c13c5 | ||
|
|
7c1a8b0122 |
2
bot.go
2
bot.go
@@ -1070,7 +1070,7 @@ func findCall(msg, toolCall string) bool {
|
|||||||
}
|
}
|
||||||
resp := callToolWithAgent(fc.Name, fc.Args)
|
resp := callToolWithAgent(fc.Name, fc.Args)
|
||||||
toolMsg := string(resp) // Remove the "tool response: " prefix and %+v formatting
|
toolMsg := string(resp) // Remove the "tool response: " prefix and %+v formatting
|
||||||
logger.Info("llm used tool call", "tool_resp", toolMsg, "tool_attrs", fc)
|
logger.Info("llm used a tool call", "tool_name", fc.Name, "too_args", fc.Args, "id", fc.ID, "tool_resp", toolMsg)
|
||||||
fmt.Fprintf(textView, "%s[-:-:b](%d) <%s>: [-:-:-]\n%s\n",
|
fmt.Fprintf(textView, "%s[-:-:b](%d) <%s>: [-:-:-]\n%s\n",
|
||||||
"\n\n", len(chatBody.Messages), cfg.ToolRole, toolMsg)
|
"\n\n", len(chatBody.Messages), cfg.ToolRole, toolMsg)
|
||||||
// Create tool response message with the proper tool_call_id
|
// Create tool response message with the proper tool_call_id
|
||||||
|
|||||||
51
helpfuncs.go
51
helpfuncs.go
@@ -9,6 +9,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
|
"path/filepath"
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
@@ -706,23 +707,51 @@ func searchPrev() {
|
|||||||
// == tab completion ==
|
// == tab completion ==
|
||||||
|
|
||||||
func scanFiles(dir, filter string) []string {
|
func scanFiles(dir, filter string) []string {
|
||||||
|
const maxDepth = 3
|
||||||
|
const maxFiles = 50
|
||||||
var files []string
|
var files []string
|
||||||
entries, err := os.ReadDir(dir)
|
|
||||||
if err != nil {
|
var scanRecursive func(currentDir string, currentDepth int, relPath string)
|
||||||
return files
|
scanRecursive = func(currentDir string, currentDepth int, relPath string) {
|
||||||
}
|
if len(files) >= maxFiles {
|
||||||
for _, entry := range entries {
|
return
|
||||||
name := entry.Name()
|
|
||||||
if strings.HasPrefix(name, ".") {
|
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
if filter == "" || strings.HasPrefix(strings.ToLower(name), strings.ToLower(filter)) {
|
if currentDepth > maxDepth {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
entries, err := os.ReadDir(currentDir)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, entry := range entries {
|
||||||
|
if len(files) >= maxFiles {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
name := entry.Name()
|
||||||
|
if strings.HasPrefix(name, ".") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
fullPath := name
|
||||||
|
if relPath != "" {
|
||||||
|
fullPath = relPath + "/" + name
|
||||||
|
}
|
||||||
|
|
||||||
if entry.IsDir() {
|
if entry.IsDir() {
|
||||||
files = append(files, name+"/")
|
// Recursively scan subdirectories
|
||||||
|
scanRecursive(filepath.Join(currentDir, name), currentDepth+1, fullPath)
|
||||||
} else {
|
} else {
|
||||||
files = append(files, name)
|
// Check if file matches filter
|
||||||
|
if filter == "" || strings.HasPrefix(strings.ToLower(fullPath), strings.ToLower(filter)) {
|
||||||
|
files = append(files, fullPath)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scanRecursive(dir, 0, "")
|
||||||
return files
|
return files
|
||||||
}
|
}
|
||||||
|
|||||||
2
tui.go
2
tui.go
@@ -112,7 +112,7 @@ var (
|
|||||||
[yellow]x[white]: to exit
|
[yellow]x[white]: to exit
|
||||||
|
|
||||||
=== shell mode ===
|
=== shell mode ===
|
||||||
[yellow]@match->Tab[white]: file completion (type @ in input to get file suggestions)
|
[yellow]@match->Tab[white]: file completion with relative paths (recursive, depth 3, max 50 files)
|
||||||
|
|
||||||
=== status line ===
|
=== status line ===
|
||||||
%s
|
%s
|
||||||
|
|||||||
Reference in New Issue
Block a user