* Fix fmt
This commit is contained in:
parent
2b9e74007f
commit
cadf39c9ef
7 changed files with 33 additions and 23 deletions
|
|
@ -452,7 +452,7 @@ type PerplexityConfig struct {
|
|||
}
|
||||
|
||||
type WebToolsConfig struct {
|
||||
Enabled bool `json:"enabled" env:"PICOCLAW_TOOLS_WEB_ENABLED"`
|
||||
Enabled bool `json:"enabled" env:"PICOCLAW_TOOLS_WEB_ENABLED"`
|
||||
Brave BraveConfig `json:"brave"`
|
||||
Tavily TavilyConfig `json:"tavily"`
|
||||
DuckDuckGo DuckDuckGoConfig `json:"duckduckgo"`
|
||||
|
|
@ -463,7 +463,7 @@ type WebToolsConfig struct {
|
|||
}
|
||||
|
||||
type CronToolConfig struct {
|
||||
Enabled bool `json:"enabled" env:"PICOCLAW_TOOLS_CRON_ENABLED"`
|
||||
Enabled bool `json:"enabled" env:"PICOCLAW_TOOLS_CRON_ENABLED"`
|
||||
ExecTimeoutMinutes int `json:"exec_timeout_minutes" env:"PICOCLAW_TOOLS_CRON_EXEC_TIMEOUT_MINUTES"` // 0 means no timeout
|
||||
}
|
||||
|
||||
|
|
@ -472,7 +472,7 @@ type ToolConfig struct {
|
|||
}
|
||||
|
||||
type ExecConfig struct {
|
||||
Enabled bool `json:"enabled" env:"PICOCLAW_TOOLS_EXEC_ENABLED"`
|
||||
Enabled bool `json:"enabled" env:"PICOCLAW_TOOLS_EXEC_ENABLED"`
|
||||
EnableDenyPatterns bool `json:"enable_deny_patterns" env:"PICOCLAW_TOOLS_EXEC_ENABLE_DENY_PATTERNS"`
|
||||
CustomDenyPatterns []string `json:"custom_deny_patterns" env:"PICOCLAW_TOOLS_EXEC_CUSTOM_DENY_PATTERNS"`
|
||||
}
|
||||
|
|
@ -485,17 +485,17 @@ type ToolsConfig struct {
|
|||
Cron CronToolConfig `json:"cron"`
|
||||
|
||||
// File tools
|
||||
ReadFile ToolConfig `json:"read_file" env:"PICOCLAW_TOOLS_READ_FILE_ENABLED"`
|
||||
WriteFile ToolConfig `json:"write_file" env:"PICOCLAW_TOOLS_WRITE_FILE_ENABLED"`
|
||||
EditFile ToolConfig `json:"edit_file" env:"PICOCLAW_TOOLS_EDIT_FILE_ENABLED"`
|
||||
ReadFile ToolConfig `json:"read_file" env:"PICOCLAW_TOOLS_READ_FILE_ENABLED"`
|
||||
WriteFile ToolConfig `json:"write_file" env:"PICOCLAW_TOOLS_WRITE_FILE_ENABLED"`
|
||||
EditFile ToolConfig `json:"edit_file" env:"PICOCLAW_TOOLS_EDIT_FILE_ENABLED"`
|
||||
AppendFile ToolConfig `json:"append_file" env:"PICOCLAW_TOOLS_APPEND_FILE_ENABLED"`
|
||||
ListDir ToolConfig `json:"list_dir" env:"PICOCLAW_TOOLS_LIST_DIR_ENABLED"`
|
||||
ListDir ToolConfig `json:"list_dir" env:"PICOCLAW_TOOLS_LIST_DIR_ENABLED"`
|
||||
|
||||
// Exec tool
|
||||
Exec ExecConfig `json:"exec"`
|
||||
|
||||
// Skills tools
|
||||
FindSkills ToolConfig `json:"find_skills" env:"PICOCLAW_TOOLS_FIND_SKILLS_ENABLED"`
|
||||
FindSkills ToolConfig `json:"find_skills" env:"PICOCLAW_TOOLS_FIND_SKILLS_ENABLED"`
|
||||
InstallSkill ToolConfig `json:"install_skill" env:"PICOCLAW_TOOLS_INSTALL_SKILL_ENABLED"`
|
||||
|
||||
// Subagent tools
|
||||
|
|
|
|||
|
|
@ -137,7 +137,9 @@ func (t *CronTool) addJob(args map[string]any) *common.ToolResult {
|
|||
t.mu.RUnlock()
|
||||
|
||||
if channel == "" || chatID == "" {
|
||||
return common.ErrorResult("no session context (channel/chat_id not set). Use this tool in an active conversation.")
|
||||
return common.ErrorResult(
|
||||
"no session context (channel/chat_id not set). Use this tool in an active conversation.",
|
||||
)
|
||||
}
|
||||
|
||||
message, ok := args["message"].(string)
|
||||
|
|
|
|||
|
|
@ -85,7 +85,9 @@ func (t *I2CTool) scan(args map[string]any) *common.ToolResult {
|
|||
devPath := fmt.Sprintf("/dev/i2c-%s", bus)
|
||||
fd, err := syscall.Open(devPath, syscall.O_RDWR, 0)
|
||||
if err != nil {
|
||||
return common.ErrorResult(fmt.Sprintf("failed to open %s: %v (check permissions and i2c-dev module)", devPath, err))
|
||||
return common.ErrorResult(
|
||||
fmt.Sprintf("failed to open %s: %v (check permissions and i2c-dev module)", devPath, err),
|
||||
)
|
||||
}
|
||||
defer syscall.Close(fd)
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,9 @@ type spiTransfer struct {
|
|||
func configureSPI(devPath string, mode uint8, bits uint8, speed uint32) (int, *common.ToolResult) {
|
||||
fd, err := syscall.Open(devPath, syscall.O_RDWR, 0)
|
||||
if err != nil {
|
||||
return -1, common.ErrorResult(fmt.Sprintf("failed to open %s: %v (check permissions and spidev module)", devPath, err))
|
||||
return -1, common.ErrorResult(
|
||||
fmt.Sprintf("failed to open %s: %v (check permissions and spidev module)", devPath, err),
|
||||
)
|
||||
}
|
||||
|
||||
// Set SPI mode
|
||||
|
|
|
|||
|
|
@ -4,14 +4,16 @@ import (
|
|||
"github.com/sipeed/picoclaw/pkg/tools/common"
|
||||
)
|
||||
|
||||
type Tool = common.Tool
|
||||
type ToolResult = common.ToolResult
|
||||
type ContextualTool = common.ContextualTool
|
||||
type AsyncTool = common.AsyncTool
|
||||
type AsyncCallback = common.AsyncCallback
|
||||
type FileSystem = common.FileSystem
|
||||
type HostFs = common.HostFs
|
||||
type SandboxFs = common.SandboxFs
|
||||
type (
|
||||
Tool = common.Tool
|
||||
ToolResult = common.ToolResult
|
||||
ContextualTool = common.ContextualTool
|
||||
AsyncTool = common.AsyncTool
|
||||
AsyncCallback = common.AsyncCallback
|
||||
FileSystem = common.FileSystem
|
||||
HostFs = common.HostFs
|
||||
SandboxFs = common.SandboxFs
|
||||
)
|
||||
|
||||
func NewToolResult(forLLM string) *ToolResult {
|
||||
return common.NewToolResult(forLLM)
|
||||
|
|
|
|||
|
|
@ -3,12 +3,13 @@ package web_fetch
|
|||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"github.com/sipeed/picoclaw/pkg/tools/common"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/sipeed/picoclaw/pkg/tools/common"
|
||||
)
|
||||
|
||||
// TestWebTool_WebFetch_Success verifies successful URL fetching
|
||||
|
|
|
|||
|
|
@ -3,15 +3,16 @@ package write_file
|
|||
import (
|
||||
"context"
|
||||
"io"
|
||||
"github.com/sipeed/picoclaw/pkg/tools/list_dir"
|
||||
"github.com/sipeed/picoclaw/pkg/tools/read_file"
|
||||
"github.com/sipeed/picoclaw/pkg/tools/common"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/sipeed/picoclaw/pkg/tools/common"
|
||||
"github.com/sipeed/picoclaw/pkg/tools/list_dir"
|
||||
"github.com/sipeed/picoclaw/pkg/tools/read_file"
|
||||
)
|
||||
|
||||
// TestFilesystemTool_ReadFile_Success verifies successful file reading
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue