Files
geo/server/cmd/kol-assist-worker/main.go
T

50 lines
1004 B
Go
Raw Normal View History

2026-04-17 13:52:01 +08:00
package main
import (
"context"
"log"
"os"
"os/signal"
"syscall"
"github.com/geo-platform/tenant-api/internal/bootstrap"
assistworker "github.com/geo-platform/tenant-api/internal/worker/assist"
)
func main() {
configPath := "configs/config.yaml"
if p := os.Getenv("CONFIG_PATH"); p != "" {
configPath = p
}
app, err := bootstrap.New(configPath)
if err != nil {
log.Fatalf("bootstrap: %v", err)
}
defer app.Close()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
app.StartConfigWatcher(ctx)
2026-04-17 13:52:01 +08:00
assistworker.NewKolAssistWorker(
app.DB,
2026-04-17 13:52:01 +08:00
app.RabbitMQ,
app.KolAssists,
app.LLM,
app.Logger,
app.Cache,
app.Config().Generation.WorkerConcurrency,
app.Config().Generation.ArticleTimeout,
).WithConfigProvider(app.ConfigStore).Start(ctx)
2026-04-17 13:52:01 +08:00
app.Logger.Info("kol-assist-worker started")
quit := make(chan os.Signal, 1)
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
<-quit
cancel()
app.Logger.Info("kol-assist-worker shutting down...")
}