feat: add configurable AgentRouter AI provider

This commit is contained in:
2026-08-22 21:47:41 +08:00
parent 4f91726edb
commit cf2f114dc8
20 changed files with 1204 additions and 79 deletions

View File

@@ -43,7 +43,8 @@ func main() {
defer redisClient.Close()
repository := growthreport.NewRepository(pool)
coordinator := growthreport.NewCoordinator(redisClient, growthreport.CoordinatorConfig{CreatePerMinute: cfg.AICreatePerMinute, UncachedPerDay: cfg.AIUncachedScopesPerDay, DailyRequests: cfg.AIDailyRequestBudget, DailyTokens: cfg.AIDailyTokenBudget, MaxConcurrent: cfg.AIMaxConcurrent})
growthService := growthreport.NewService(repository, coordinator, growthreport.ServiceConfig{Enabled: cfg.AIGrowthEnabled, Model: cfg.AvalAIModel, PromptVersion: "1.0.0", SchemaVersion: "1.0.0"})
provider := cfg.SelectedAIProvider()
growthService := growthreport.NewService(repository, coordinator, growthreport.ServiceConfig{Enabled: cfg.AIGrowthEnabled, Model: provider.Model, PromptVersion: "1.0.5", SchemaVersion: "1.0.1"})
insightRepository := insight.NewRepository(pool)
insightService := insight.NewService(insightRepository, insight.NewPostgreSQLBuilder(pool))
appServer := api.NewServer(identity.New(pool), analytics.New(pool, cfg.CursorSecret), logger, cfg.FrontendOrigin, cfg.CookieSecure, growthService)