feat: sync all features to image2api
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
||||
"backend/internal/provider/adobe"
|
||||
"backend/internal/provider/chatgpt"
|
||||
"backend/internal/provider/custom"
|
||||
"backend/internal/provider/creativefabrica"
|
||||
"backend/internal/provider/grok"
|
||||
"backend/internal/provider/imagine"
|
||||
"backend/internal/provider/krea"
|
||||
@@ -129,14 +130,15 @@ func NewApp(ctx context.Context) (*App, error) {
|
||||
// (a reship made the recipe stale). No polling.
|
||||
startGrokStatsigRefresh(siteRepo)
|
||||
customClient := custom.NewClient()
|
||||
v1Svc := service.NewV1Service(cfg, modelRepo, userRepo, eventRepo, tokenRepo, siteRepo, cgroupRepo, concSvc, adobeClient, chatGPTClient, runwayClient, leonardoClient, kreaClient, imagineClient, grokClient, customClient, rustfsClient)
|
||||
cfClient := creativefabrica.NewClient("")
|
||||
v1Svc := service.NewV1Service(cfg, modelRepo, userRepo, eventRepo, tokenRepo, siteRepo, cgroupRepo, concSvc, adobeClient, chatGPTClient, runwayClient, leonardoClient, kreaClient, imagineClient, grokClient, customClient, cfClient, rustfsClient)
|
||||
siteSvc := service.NewSiteService(siteRepo, cfg.AppTitle)
|
||||
showcaseSvc := service.NewShowcaseService(showcaseRepo)
|
||||
adminReadSvc := service.NewAdminReadService(cfg, userRepo, modelRepo, eventRepo, siteRepo, tokenRepo, cdkRepo, rustfsClient, showcaseRepo)
|
||||
adminWriteSvc := service.NewAdminWriteService(userRepo, showcaseRepo, modelRepo, eventRepo, apiKeyRepo, tokenRepo, orderRepo)
|
||||
cdkSvc := service.NewCDKService(cdkRepo, userRepo, siteRepo, orderRepo)
|
||||
apiKeySvc := service.NewAPIKeyService(apiKeyRepo)
|
||||
tokenSvc := service.NewTokenService(tokenRepo, refreshRepo, eventRepo, siteRepo, adobeClient, chatGPTClient, runwayClient, leonardoClient, kreaClient, imagineClient, grokClient)
|
||||
tokenSvc := service.NewTokenService(tokenRepo, refreshRepo, eventRepo, siteRepo, adobeClient, chatGPTClient, runwayClient, leonardoClient, kreaClient, imagineClient, grokClient, cfClient)
|
||||
refreshSvc := service.NewRefreshProfileService(refreshRepo, tokenRepo, adobeClient)
|
||||
// Enable refresh-then-retry on a mid-request Adobe 401 (re-mint access token
|
||||
// from the cookie). Wired post-construction to avoid a ctor init cycle.
|
||||
|
||||
@@ -55,6 +55,23 @@ func seedDefaults(ctx context.Context, db *gorm.DB) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// Adobe 的 Seedance 目录 ID 带 adobe- 前缀(与 Leonardo 私有款区分);把旧 ID
|
||||
// 的存量行改名,保留计价配置、次数和历史日志归属。
|
||||
for _, r := range [][2]string{
|
||||
{"seedance-2.0", "adobe-seedance-2.0"},
|
||||
{"seedance-2.0-fast", "adobe-seedance-2.0-fast"},
|
||||
} {
|
||||
if err := db.WithContext(ctx).Exec(
|
||||
`UPDATE model_configs SET id = ? WHERE id = ?
|
||||
AND NOT EXISTS (SELECT 1 FROM model_configs WHERE id = ?)`,
|
||||
r[1], r[0], r[1]).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
if err := db.WithContext(ctx).Exec(
|
||||
`UPDATE event_logs SET model = ? WHERE model = ?`, r[1], r[0]).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// One-time backfill of the persistent per-model generation counter from
|
||||
// historical success logs, so the admin "次数" keeps its running total when we
|
||||
// switch it off the (retention-pruned) event_log. Only touches models still at
|
||||
|
||||
Reference in New Issue
Block a user