AI: Add VisionApi, VisionUri, and VisionKey config options #127 #1090

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2025-04-07 20:30:07 +02:00
parent 2a6b9fb237
commit d304509c0d
14 changed files with 176 additions and 71 deletions

View File

@@ -7,6 +7,7 @@ import (
"github.com/photoprism/photoprism/internal/ai/vision"
"github.com/photoprism/photoprism/internal/auth/acl"
"github.com/photoprism/photoprism/internal/photoprism/get"
)
// PostVisionCaption returns a suitable caption for an image.
@@ -36,6 +37,13 @@ func PostVisionCaption(router *gin.RouterGroup) {
return
}
// Check if the Computer Vision API is enabled, otherwise abort with an error.
if !get.Config().VisionApi() {
AbortFeatureDisabled(c)
c.JSON(http.StatusForbidden, vision.NewApiError(request.GetId(), http.StatusForbidden))
return
}
// Generate Vision API service response.
response := vision.ApiResponse{
Id: request.GetId(),