Enha: tool args preview
This commit is contained in:
8
bot.go
8
bot.go
@@ -1398,10 +1398,14 @@ func chatToTextSlice(messages []models.RoleMsg, showSys bool) []string {
|
|||||||
// This is a tool call indicator - show collapsed
|
// This is a tool call indicator - show collapsed
|
||||||
if toolCollapsed {
|
if toolCollapsed {
|
||||||
toolName := messages[i].ToolCall.Name
|
toolName := messages[i].ToolCall.Name
|
||||||
|
argsPreview := messages[i].ToolCall.Args
|
||||||
|
if len(messages[i].ToolCall.Args) > 30 {
|
||||||
|
argsPreview = messages[i].ToolCall.Args[:30]
|
||||||
|
}
|
||||||
resp[i] = strings.ReplaceAll(
|
resp[i] = strings.ReplaceAll(
|
||||||
fmt.Sprintf(
|
fmt.Sprintf(
|
||||||
"%s\n%s\n[yellow::i][tool call: %s (press Ctrl+T to expand)][-:-:-]\n",
|
"%s\n%s\n[yellow::i][tool call: %s %s (press Ctrl+T to expand)][-:-:-]\n",
|
||||||
icon, messages[i].GetText(), toolName),
|
icon, messages[i].GetText(), toolName, argsPreview),
|
||||||
"\n\n", "\n")
|
"\n\n", "\n")
|
||||||
} else {
|
} else {
|
||||||
// Show full tool call info
|
// Show full tool call info
|
||||||
|
|||||||
@@ -595,7 +595,6 @@ func executeCommandAndDisplay(cmdText string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use /bin/sh to support pipes, redirects, etc.
|
// Use /bin/sh to support pipes, redirects, etc.
|
||||||
cmd := exec.Command("/bin/sh", "-c", cmdText)
|
cmd := exec.Command("/bin/sh", "-c", cmdText)
|
||||||
cmd.Dir = workingDir
|
cmd.Dir = workingDir
|
||||||
|
|||||||
Reference in New Issue
Block a user