missing_models.go 592 B

123456789101112131415161718192021222324252627
  1. package controller
  2. import (
  3. "net/http"
  4. "one-api/model"
  5. "github.com/gin-gonic/gin"
  6. )
  7. // GetMissingModels returns the list of model names that are referenced by channels
  8. // but do not have corresponding records in the models meta table.
  9. // This helps administrators quickly discover models that need configuration.
  10. func GetMissingModels(c *gin.Context) {
  11. missing, err := model.GetMissingModels()
  12. if err != nil {
  13. c.JSON(http.StatusOK, gin.H{
  14. "success": false,
  15. "message": err.Error(),
  16. })
  17. return
  18. }
  19. c.JSON(http.StatusOK, gin.H{
  20. "success": true,
  21. "data": missing,
  22. })
  23. }