feat(premium): sync promo video catalog seed

This commit is contained in:
iamxvbaba 2026-07-26 15:59:25 +08:00
parent c3c079edf3
commit 3369d0bd5c
14 changed files with 1137 additions and 10 deletions

View file

@ -211,6 +211,9 @@ type Config struct {
StickerSeedDir string
// StickerSeedMaxSets 限制导入的常规贴纸集数量(避免启动时导入过多包),<=0 表示不限。
StickerSeedMaxSets int
// PremiumPromoSeedDir 是 help.getPremiumPromo 视频与缩略图导出目录。
// 目录缺失时保留无视频兼容响应;目录存在但内容非法时启动失败。
PremiumPromoSeedDir string
// BusinessAIProvider 控制服务端 Business automation 回复生成器。
// 空值/"echo" 回显触发私聊文本,用于跑通后续 AI provider 链路;
// "template" 使用 quick reply 模板。
@ -566,6 +569,7 @@ func Load() (Config, error) {
BlobDir: envOr("TELESRV_BLOB_DIR", "data/blobs"),
StickerSeedDir: envOr("TELESRV_STICKER_SEED_DIR", "data/sticker-seed"),
StickerSeedMaxSets: envIntOr("TELESRV_STICKER_SEED_MAX_SETS", 300),
PremiumPromoSeedDir: envOr("TELESRV_PREMIUM_PROMO_SEED_DIR", "data/premium-promo"),
MapboxToken: envOr("TELESRV_MAPBOX_TOKEN", ""),
MapTileCacheDir: envOr("TELESRV_MAPTILE_CACHE_DIR", "data/maptiles"),
ExternalMediaEnable: envBoolOr("TELESRV_EXTERNAL_MEDIA_ENABLE", true),

View file

@ -37,6 +37,22 @@ func TestLoadDefaultsAdvertiseIPToLoopback(t *testing.T) {
if cfg.CallRegistryMaxEntries != 10_000 {
t.Fatalf("CallRegistryMaxEntries = %d, want 10000", cfg.CallRegistryMaxEntries)
}
if cfg.PremiumPromoSeedDir != "data/premium-promo" {
t.Fatalf("PremiumPromoSeedDir = %q, want data/premium-promo", cfg.PremiumPromoSeedDir)
}
}
func TestLoadPremiumPromoSeedDirOverride(t *testing.T) {
disableDefaultConfigFile(t)
t.Setenv("TELESRV_PREMIUM_PROMO_SEED_DIR", `D:\seed\premium-promo`)
cfg, err := Load()
if err != nil {
t.Fatalf("Load: %v", err)
}
if cfg.PremiumPromoSeedDir != `D:\seed\premium-promo` {
t.Fatalf("PremiumPromoSeedDir = %q", cfg.PremiumPromoSeedDir)
}
}
func TestLoadUsesExplicitAdvertiseIP(t *testing.T) {