Add generic LLM worker
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user