Add generic LLM worker
All checks were successful
CI / test (push) Successful in 13s
Build and Deploy / build-and-deploy (push) Successful in 20s

This commit is contained in:
Grendgi
2026-06-08 13:52:29 +03:00
parent e0f74c62b0
commit 24c5d89c7b
10 changed files with 420 additions and 1 deletions

View File

@@ -17,6 +17,10 @@ type Config struct {
LLMModel string
LLMTimeout time.Duration
WhisperXURL string
WorkerID string
WorkerPollInterval time.Duration
WorkerClaimLimit int
}
func Load() Config {
@@ -31,6 +35,10 @@ func Load() Config {
LLMModel: envString("LLM_MODEL", "qwen2.5-14b"),
LLMTimeout: envDuration("LLM_TIMEOUT", 5*time.Minute),
WhisperXURL: envString("WHISPERX_URL", ""),
WorkerID: envString("WORKER_ID", hostname()),
WorkerPollInterval: envDuration("WORKER_POLL_INTERVAL", 2*time.Second),
WorkerClaimLimit: envInt("WORKER_CLAIM_LIMIT", 4),
}
}
@@ -76,3 +84,11 @@ func envDuration(key string, fallback time.Duration) time.Duration {
}
return v
}
func hostname() string {
h, err := os.Hostname()
if err != nil || h == "" {
return "ai-service-worker"
}
return h
}