summaryrefslogtreecommitdiff
path: root/internal/config/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/config/config.go')
-rw-r--r--internal/config/config.go68
1 files changed, 49 insertions, 19 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index 71258c1..25187cf 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -16,28 +16,58 @@ type Project struct {
Dir string `toml:"dir"`
}
+// LocalModel configures an OpenAI-compatible local LLM endpoint used for
+// internal helpers (classifier, elaboration, future summarization) and as
+// the backend for the "local" runner. If Endpoint is empty, the LocalRunner
+// is not registered and the classifier falls back to the Gemini CLI.
+//
+// PreferForElaborate gates whether the API server's elaboration handler
+// uses this client. It defaults to true when Endpoint is set; users with a
+// slow or low-quality local model can disable it.
+type LocalModel struct {
+ Endpoint string `toml:"endpoint"` // e.g. "http://localhost:11434/v1"
+ Model string `toml:"model"` // e.g. "llama3.1:8b"
+ TimeoutSeconds int `toml:"timeout_seconds"` // default 60
+ DefaultTemperature float64 `toml:"default_temperature"` // default 0.2
+ APIKey string `toml:"api_key"` // optional bearer token
+ PreferForElaborate *bool `toml:"prefer_for_elaborate"` // pointer so default-true survives parse
+}
+
+// UseForElaborate returns true when elaboration should try this local model
+// before falling back to Claude/Gemini. Default is true when Endpoint is set.
+func (m LocalModel) UseForElaborate() bool {
+ if m.Endpoint == "" {
+ return false
+ }
+ if m.PreferForElaborate == nil {
+ return true
+ }
+ return *m.PreferForElaborate
+}
+
type Config struct {
- DataDir string `toml:"data_dir"`
- DBPath string `toml:"-"`
- LogDir string `toml:"-"`
- DropsDir string `toml:"-"`
- SSHAuthSock string `toml:"ssh_auth_sock"`
- ClaudeBinaryPath string `toml:"claude_binary_path"`
- GeminiBinaryPath string `toml:"gemini_binary_path"`
- ClaudeImage string `toml:"claude_image"`
- GeminiImage string `toml:"gemini_image"`
+ DataDir string `toml:"data_dir"`
+ DBPath string `toml:"-"`
+ LogDir string `toml:"-"`
+ DropsDir string `toml:"-"`
+ SSHAuthSock string `toml:"ssh_auth_sock"`
+ ClaudeBinaryPath string `toml:"claude_binary_path"`
+ GeminiBinaryPath string `toml:"gemini_binary_path"`
+ ClaudeImage string `toml:"claude_image"`
+ GeminiImage string `toml:"gemini_image"`
MaxConcurrent int `toml:"max_concurrent"`
ShutdownTimeout time.Duration `toml:"shutdown_timeout"`
- DefaultTimeout string `toml:"default_timeout"`
- ServerAddr string `toml:"server_addr"`
- WebhookURL string `toml:"webhook_url"`
- WorkspaceRoot string `toml:"workspace_root"`
- WebhookSecret string `toml:"webhook_secret"`
- Projects []Project `toml:"projects"`
- VAPIDPublicKey string `toml:"vapid_public_key"`
- VAPIDPrivateKey string `toml:"vapid_private_key"`
- VAPIDEmail string `toml:"vapid_email"`
- ClaudeConfigDir string `toml:"claude_config_dir"`
+ DefaultTimeout string `toml:"default_timeout"`
+ ServerAddr string `toml:"server_addr"`
+ WebhookURL string `toml:"webhook_url"`
+ WorkspaceRoot string `toml:"workspace_root"`
+ WebhookSecret string `toml:"webhook_secret"`
+ Projects []Project `toml:"projects"`
+ VAPIDPublicKey string `toml:"vapid_public_key"`
+ VAPIDPrivateKey string `toml:"vapid_private_key"`
+ VAPIDEmail string `toml:"vapid_email"`
+ ClaudeConfigDir string `toml:"claude_config_dir"`
+ LocalModel LocalModel `toml:"local_model"`
}
func Default() (*Config, error) {