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
+4
View File
@@ -346,6 +346,10 @@ func (h *ModelHandler) DeleteModel(c *gin.Context) {
c.Error(errors.NewNotFoundError("Model not found"))
return
}
if appErr, ok := errors.IsAppError(err); ok {
c.Error(appErr)
return
}
logger.ErrorWithFields(ctx, err, nil)
c.Error(errors.NewInternalServerError(err.Error()))
return