e307a048d1
Adds an ai_point_usage_logs ledger and a reserve/refund/complete pipeline that charges AI points for article selection optimize, template analyze /title/outline, and KOL prompt generate/optimize. Pending reservations are reconciled when the kol-assist worker and template-assist tasks finish or fail, so points refund automatically on errors. Workspace now exposes the AI quota status and a paginated usage ledger. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
48 lines
934 B
Go
48 lines
934 B
Go
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.DB,
|
|
app.RabbitMQ,
|
|
app.KolAssists,
|
|
app.LLM,
|
|
app.Logger,
|
|
app.Cache,
|
|
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...")
|
|
}
|