feat(channels): 拉模型改为勾选即绑定,启动清扫遗留模型
- fetch-models 返回 bound 标记,渠道页勾选=立即导入绑定, 取消=解绑(无其他渠道接入时本地模型行一并删除) - 新增 POST /channels/unbind-model - 启动时 PurgeOrphanModels 清掉 provider 时代的无绑定模型行 - 模型管理页移除「渠道导入模型」按钮 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -115,6 +115,13 @@ func NewApp(ctx context.Context) (*App, error) {
|
||||
channelSecret = cfg.PostgresDSN
|
||||
}
|
||||
channelSvc := service.NewChannelService(channelRepo, modelRepo, upClient, channelSecret)
|
||||
// Sweep provider-era model rows: anything not bound to a channel can never
|
||||
// be routed under the channel scheduler.
|
||||
if n, err := channelSvc.PurgeOrphanModels(ctx); err != nil {
|
||||
log.Printf("purge orphan models: %v", err)
|
||||
} else if n > 0 {
|
||||
log.Printf("purged %d unbound model(s) left over from the provider era", n)
|
||||
}
|
||||
v1Svc := service.NewV1Service(cfg, modelRepo, userRepo, eventRepo, channelSvc, siteRepo, cgroupRepo, concSvc, rustfsClient)
|
||||
siteSvc := service.NewSiteService(siteRepo, cfg.AppTitle)
|
||||
showcaseSvc := service.NewShowcaseService(showcaseRepo)
|
||||
|
||||
Reference in New Issue
Block a user