feat(admin-brand): add question expansion service and related functionality

- Implemented QuestionExpansionService for generating and materializing questions based on combinations and AI distillation.
- Added question metadata classification logic to infer intent and layer of questions.
- Created API handlers for question expansion operations including combination preview, AI distillation, metadata classification, and materialization.
- Introduced database migrations to support new question-related fields and constraints in brand_questions and brand_keywords tables.
- Added caching mechanism for AI distillation results to improve performance.
- Defined JSON schemas for question distillation responses to ensure data integrity.
This commit is contained in:
2026-05-12 21:53:36 +08:00
parent 77d542c282
commit 37b0b32327
27 changed files with 4619 additions and 908 deletions
+3
View File
@@ -56,6 +56,7 @@ type App struct {
DesktopDispatch *stream.DesktopDispatchHub
Cache cache.Cache
BrandService *tenantapp.BrandService
QuestionExpansion *tenantapp.QuestionExpansionService
MonitoringService *tenantapp.MonitoringService
KolProfiles repository.KolProfileRepository
KolPackages repository.KolPackageRepository
@@ -145,6 +146,7 @@ func New(configPath string) (*App, error) {
DeleteScanCount: cfg.Cache.DeleteScanCount,
})
brandService := tenantapp.NewBrandService(pool, monitoringPool, auditLogs, cfg.BrandLibrary).WithCache(appCache)
questionExpansion := tenantapp.NewQuestionExpansionService(pool, llmClient, brandService).WithCache(appCache)
monitoringService := tenantapp.NewMonitoringService(pool, monitoringPool, mqClient, cfg.MonitoringDispatch, cfg.BrandLibrary, logger).WithRedis(rdb)
kolProfiles := repository.NewKolProfileRepository(pool)
kolPackages := repository.NewKolPackageRepository(pool)
@@ -214,6 +216,7 @@ func New(configPath string) (*App, error) {
DesktopDispatch: desktopDispatch,
Cache: appCache,
BrandService: brandService,
QuestionExpansion: questionExpansion,
MonitoringService: monitoringService,
KolProfiles: kolProfiles,
KolPackages: kolPackages,