Add AI provider configuration
All checks were successful
CI / test (push) Successful in 12s
Build and Deploy / build-and-deploy (push) Successful in 22s

This commit is contained in:
Grendgi
2026-06-08 13:42:18 +03:00
parent 0081e910ba
commit 0da278a45e
4 changed files with 49 additions and 0 deletions

View File

@@ -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
}