fix(model): block deletion when model is referenced by KB or agent

Reject model delete with HTTP 400 when the current tenant still has
knowledge bases or custom agents bound to the model ID.
This commit is contained in:
wizardchen
2026-06-23 20:33:01 +08:00
committed by lyingbug
parent 775cc9ef11
commit 7855f36799
11 changed files with 437 additions and 2 deletions
@@ -921,6 +921,9 @@ func (r *realKBRepo) CountByVectorStoreID(ctx context.Context, db *gorm.DB, tena
Count(&count).Error
return count, err
}
func (r *realKBRepo) CountByModelID(_ context.Context, _ uint64, _ string) (int64, error) {
return 0, nil
}
// The remaining methods are not called by the tested code paths; declare them
// so realKBRepo satisfies interfaces.KnowledgeBaseRepository.