fix: correct arguments for NewFreeRideTool in CLI command

This commit is contained in:
Your Name 2026-04-30 13:01:10 +02:00
parent 2f5b435903
commit a8186acdb2

View file

@ -3,6 +3,7 @@ package freeride
import ( import (
"context" "context"
"fmt" "fmt"
"path/filepath"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -37,7 +38,8 @@ func newListCommand() *cobra.Command {
Use: "list", Use: "list",
Short: "List available free models from OpenRouter", Short: "List available free models from OpenRouter",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
t := tools.NewFreeRideTool(internal.GetConfigPath(), nil) cdPath := filepath.Join(internal.GetPicoclawHome(), "freeride_cooldown.json")
t := tools.NewFreeRideTool(internal.GetConfigPath(), cdPath, nil)
result := t.Execute(context.Background(), map[string]any{ result := t.Execute(context.Background(), map[string]any{
"command": "list", "command": "list",
"limit": float64(limit), "limit": float64(limit),
@ -56,7 +58,8 @@ func newAutoCommand() *cobra.Command {
Use: "auto", Use: "auto",
Short: "Automatically configure best free models as fallbacks", Short: "Automatically configure best free models as fallbacks",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
t := tools.NewFreeRideTool(internal.GetConfigPath(), nil) cdPath := filepath.Join(internal.GetPicoclawHome(), "freeride_cooldown.json")
t := tools.NewFreeRideTool(internal.GetConfigPath(), cdPath, nil)
result := t.Execute(context.Background(), map[string]any{ result := t.Execute(context.Background(), map[string]any{
"command": "auto", "command": "auto",
"limit": float64(limit), "limit": float64(limit),
@ -74,7 +77,8 @@ func newStatusCommand() *cobra.Command {
Use: "status", Use: "status",
Short: "Check current FreeRide configuration", Short: "Check current FreeRide configuration",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
t := tools.NewFreeRideTool(internal.GetConfigPath(), nil) cdPath := filepath.Join(internal.GetPicoclawHome(), "freeride_cooldown.json")
t := tools.NewFreeRideTool(internal.GetConfigPath(), cdPath, nil)
result := t.Execute(context.Background(), map[string]any{ result := t.Execute(context.Background(), map[string]any{
"command": "status", "command": "status",
}) })
@ -90,7 +94,8 @@ func newSetTimeoutCommand() *cobra.Command {
Use: "settimeout", Use: "settimeout",
Short: "Set request timeout for all OpenRouter models", Short: "Set request timeout for all OpenRouter models",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
t := tools.NewFreeRideTool(internal.GetConfigPath(), nil) cdPath := filepath.Join(internal.GetPicoclawHome(), "freeride_cooldown.json")
t := tools.NewFreeRideTool(internal.GetConfigPath(), cdPath, nil)
result := t.Execute(context.Background(), map[string]any{ result := t.Execute(context.Background(), map[string]any{
"command": "settimeout", "command": "settimeout",
"timeout": float64(timeout), "timeout": float64(timeout),