Add AI provider configuration
This commit is contained in:
@@ -3,6 +3,7 @@ package config
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
@@ -10,6 +11,13 @@ type Config struct {
|
||||
HTTPPort int
|
||||
DatabaseURL string
|
||||
MigrateOnStart bool
|
||||
|
||||
LLMBaseURL string
|
||||
LLMAPIKey string
|
||||
LLMModel string
|
||||
LLMTimeout time.Duration
|
||||
WhisperXURL string
|
||||
OpenClawURL string
|
||||
}
|
||||
|
||||
func Load() Config {
|
||||
@@ -18,6 +26,13 @@ func Load() Config {
|
||||
HTTPPort: envInt("HTTP_PORT", 8080),
|
||||
DatabaseURL: envString("DATABASE_URL", ""),
|
||||
MigrateOnStart: envBool("MIGRATE_ON_START", true),
|
||||
|
||||
LLMBaseURL: envString("LLM_BASE_URL", ""),
|
||||
LLMAPIKey: envString("LLM_API_KEY", ""),
|
||||
LLMModel: envString("LLM_MODEL", "qwen2.5-14b"),
|
||||
LLMTimeout: envDuration("LLM_TIMEOUT", 5*time.Minute),
|
||||
WhisperXURL: envString("WHISPERX_URL", ""),
|
||||
OpenClawURL: envString("OPENCLAW_URL", ""),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,3 +66,15 @@ func envBool(key string, fallback bool) bool {
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
func envDuration(key string, fallback time.Duration) time.Duration {
|
||||
raw := os.Getenv(key)
|
||||
if raw == "" {
|
||||
return fallback
|
||||
}
|
||||
v, err := time.ParseDuration(raw)
|
||||
if err != nil {
|
||||
return fallback
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user