diff options
Diffstat (limited to 'internal/cli')
| -rw-r--r-- | internal/cli/run.go | 16 | ||||
| -rw-r--r-- | internal/cli/serve.go | 17 |
2 files changed, 31 insertions, 2 deletions
diff --git a/internal/cli/run.go b/internal/cli/run.go index 1c53b1a..a5a6419 100644 --- a/internal/cli/run.go +++ b/internal/cli/run.go @@ -6,12 +6,14 @@ import ( "os" "os/signal" "syscall" + "time" + "github.com/spf13/cobra" "github.com/thepeterstone/claudomator/internal/executor" + "github.com/thepeterstone/claudomator/internal/provider/anthropic" "github.com/thepeterstone/claudomator/internal/provider/openaicompat" "github.com/thepeterstone/claudomator/internal/storage" "github.com/thepeterstone/claudomator/internal/task" - "github.com/spf13/cobra" ) func newRunCmd() *cobra.Command { @@ -116,6 +118,18 @@ func runTasks(file string, parallel int, dryRun bool) error { } } + if pc, ok := cfg.Providers["anthropic"]; ok && pc.APIKey != "" && cfg.Runners.AnthropicEnabled() { + timeout := time.Duration(0) + if pc.TimeoutSeconds > 0 { + timeout = time.Duration(pc.TimeoutSeconds) * time.Second + } + runners["anthropic"] = &executor.NativeRunner{ + Provider: anthropic.New(pc.APIKey, pc.Endpoint, timeout), + Logger: logger, + LogDir: cfg.LogDir, + DefaultModel: pc.DefaultModel, + } + } pool := executor.NewPool(parallel, runners, store, logger) pool.Classifier = &executor.Classifier{ diff --git a/internal/cli/serve.go b/internal/cli/serve.go index d8ec6a1..d9bf609 100644 --- a/internal/cli/serve.go +++ b/internal/cli/serve.go @@ -10,15 +10,16 @@ import ( "syscall" "time" + "github.com/spf13/cobra" "github.com/thepeterstone/claudomator/internal/api" "github.com/thepeterstone/claudomator/internal/budget" "github.com/thepeterstone/claudomator/internal/config" "github.com/thepeterstone/claudomator/internal/executor" "github.com/thepeterstone/claudomator/internal/notify" + "github.com/thepeterstone/claudomator/internal/provider/anthropic" "github.com/thepeterstone/claudomator/internal/provider/openaicompat" "github.com/thepeterstone/claudomator/internal/storage" "github.com/thepeterstone/claudomator/internal/version" - "github.com/spf13/cobra" ) func newServeCmd() *cobra.Command { @@ -150,6 +151,20 @@ func serve(addr, basePath string) error { logger.Info("local runner registered", "endpoint", cfg.LocalModel.Endpoint, "model", cfg.LocalModel.Model) } + if pc, ok := cfg.Providers["anthropic"]; ok && pc.APIKey != "" && cfg.Runners.AnthropicEnabled() { + timeout := time.Duration(0) + if pc.TimeoutSeconds > 0 { + timeout = time.Duration(pc.TimeoutSeconds) * time.Second + } + runners["anthropic"] = &executor.NativeRunner{ + Provider: anthropic.New(pc.APIKey, pc.Endpoint, timeout), + Logger: logger, + LogDir: cfg.LogDir, + DefaultModel: pc.DefaultModel, + } + logger.Info("anthropic runner registered", "default_model", pc.DefaultModel) + } + pool := executor.NewPool(cfg.MaxConcurrent, runners, store, logger) pool.Classifier = &executor.Classifier{ LLM: localClient, |
