Skip to content

Commit 2360532

Browse files
committed
refactor(image_generation): remove unused store dependency and streamline image generation logic
1 parent 3632242 commit 2360532

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

runner/server/handler/image.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@ import (
1414
"github.com/gin-gonic/gin"
1515
"github.com/openai/openai-go"
1616

17-
"github.com/NexaAI/nexa-sdk/runner/internal/store"
1817
"github.com/NexaAI/nexa-sdk/runner/internal/types"
1918
nexa_sdk "github.com/NexaAI/nexa-sdk/runner/nexa-sdk"
2019
"github.com/NexaAI/nexa-sdk/runner/server/service"
2120
)
2221

23-
// Use OpenAI's provided structs from openai-go library
24-
2522
// @Router /images/generations [post]
2623
// @Summary Creates an image given a prompt.
2724
// @Description Creates an image given a prompt. This endpoint follows OpenAI DALL-E 3 API specification for compatibility.
@@ -56,22 +53,6 @@ func ImageGenerations(c *gin.Context) {
5653
param.ResponseFormat = openai.ImageGenerateParamsResponseFormatURL
5754
}
5855

59-
s := store.Get()
60-
manifest, err := s.GetManifest(param.Model)
61-
if err != nil {
62-
if errors.Is(err, os.ErrNotExist) {
63-
c.JSON(http.StatusNotFound, map[string]any{"error": "model not found"})
64-
} else {
65-
c.JSON(http.StatusInternalServerError, map[string]any{"error": err.Error()})
66-
}
67-
return
68-
}
69-
70-
if manifest.ModelType != types.ModelTypeImageGen {
71-
c.JSON(http.StatusBadRequest, map[string]any{"error": "model does not support image generation"})
72-
return
73-
}
74-
7556
imageGen, err := service.KeepAliveGet[nexa_sdk.ImageGen](
7657
param.Model,
7758
types.ModelParam{},

0 commit comments

Comments
 (0)