Enha: /completion command explanation

This commit is contained in:
Grail Finder
2025-12-08 16:43:38 +03:00
parent dc71009f43
commit e7b542730c
2 changed files with 20 additions and 4 deletions

View File

@@ -118,7 +118,7 @@ func renameUser(oldname, newname string) {
if role == cfg.AssistantRole { if role == cfg.AssistantRole {
continue continue
} }
if role == cfg.ToolRole { if role == "tool" {
continue continue
} }
if role == "system" { if role == "system" {

View File

@@ -90,7 +90,7 @@ Your current tools:
{ {
"name":"execute_command", "name":"execute_command",
"args": ["command", "args"], "args": ["command", "args"],
"when_to_use": "when asked to execute a system command; args is optional" "when_to_use": "when asked to execute a system command; args is optional; allowed commands: grep, sed, awk, find, cat, head, tail, sort, uniq, wc, ls, echo, cut, tr, cp, mv, rm, mkdir, rmdir, pwd, df, free, ps, top, du, whoami, date, uname"
} }
] ]
</tools> </tools>
@@ -103,6 +103,14 @@ __tool_call__
} }
__tool_call__ __tool_call__
</example_request> </example_request>
<example_request>
__tool_call__
{
"name":"execute_command",
"args": {"command": "ls", "args": "-la /home"}
}
__tool_call__
</example_request>
Tool call is addressed to the tool agent, avoid sending more info than tool call itself, while making a call. Tool call is addressed to the tool agent, avoid sending more info than tool call itself, while making a call.
When done right, tool call will be delivered to the tool agent. tool agent will respond with the results of the call. When done right, tool call will be delivered to the tool agent. tool agent will respond with the results of the call.
<example_response> <example_response>
@@ -784,6 +792,14 @@ func isCommandAllowed(command string) bool {
"mkdir": true, "mkdir": true,
"rmdir": true, "rmdir": true,
"pwd": true, "pwd": true,
"df": true,
"free": true,
"ps": true,
"top": true,
"du": true,
"whoami": true,
"date": true,
"uname": true,
} }
return allowedCommands[command] return allowedCommands[command]
} }
@@ -1045,14 +1061,14 @@ var baseTools = []models.Tool{
Type: "function", Type: "function",
Function: models.ToolFunc{ Function: models.ToolFunc{
Name: "execute_command", Name: "execute_command",
Description: "Execute a shell command safely. Use when you need to run system commands like grep sed awk find cat head tail sort uniq wc ls echo cut tr cp mv rm mkdir rmdir pwd", Description: "Execute a shell command safely. Use when you need to run system commands like grep sed awk find cat head tail sort uniq wc ls echo cut tr cp mv rm mkdir rmdir pwd df free ps top du whoami date uname",
Parameters: models.ToolFuncParams{ Parameters: models.ToolFuncParams{
Type: "object", Type: "object",
Required: []string{"command"}, Required: []string{"command"},
Properties: map[string]models.ToolArgProps{ Properties: map[string]models.ToolArgProps{
"command": models.ToolArgProps{ "command": models.ToolArgProps{
Type: "string", Type: "string",
Description: "command to execute (only commands from whitelist are allowed: grep sed awk find cat head tail sort uniq wc ls echo cut tr cp mv rm mkdir rmdir pwd", Description: "command to execute (only commands from whitelist are allowed: grep sed awk find cat head tail sort uniq wc ls echo cut tr cp mv rm mkdir rmdir pwd df free ps top du whoami date uname",
}, },
"args": models.ToolArgProps{ "args": models.ToolArgProps{
Type: "string", Type: "string",