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()
|
|
|
|
|
|
2026-05-01 16:01:23 +08:00
|
|
|
app.StartConfigWatcher(ctx)
|
|
|
|
|
|
2026-04-17 13:52:01 +08:00
|
|
|
assistworker.NewKolAssistWorker(
|
2026-04-28 11:33:47 +08:00
|
|
|
app.DB,
|
2026-04-17 13:52:01 +08:00
|
|
|
app.RabbitMQ,
|
|
|
|
|
app.KolAssists,
|
|
|
|
|
app.LLM,
|
|
|
|
|
app.Logger,
|
2026-04-28 11:33:47 +08:00
|
|
|
app.Cache,
|
2026-05-01 16:01:23 +08:00
|
|
|
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...")
|
|
|
|
|
}
|