feat(kol): AI assist service + worker
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
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()
|
||||
|
||||
assistworker.NewKolAssistWorker(
|
||||
app.RabbitMQ,
|
||||
app.KolAssists,
|
||||
app.LLM,
|
||||
app.Logger,
|
||||
app.Config.Generation.WorkerConcurrency,
|
||||
app.Config.Generation.ArticleTimeout,
|
||||
).Start(ctx)
|
||||
|
||||
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...")
|
||||
}
|
||||
Reference in New Issue
Block a user