mirror of
https://github.com/zebrajr/ollama-webui.git
synced 2026-01-15 12:15:13 +00:00
refac: gpt-image support
This commit is contained in:
@@ -195,12 +195,12 @@ async def update_config(
|
||||
set_image_model(request, form_data.IMAGE_GENERATION_MODEL)
|
||||
if (
|
||||
form_data.IMAGE_SIZE == "auto"
|
||||
and form_data.IMAGE_GENERATION_MODEL != "gpt-image-1"
|
||||
and not form_data.IMAGE_GENERATION_MODEL.startswith("gpt-image")
|
||||
):
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail=ERROR_MESSAGES.INCORRECT_FORMAT(
|
||||
" (auto is only allowed with gpt-image-1)."
|
||||
" (auto is only allowed with gpt-image models)."
|
||||
),
|
||||
)
|
||||
|
||||
@@ -379,6 +379,7 @@ def get_models(request: Request, user=Depends(get_verified_user)):
|
||||
{"id": "dall-e-2", "name": "DALL·E 2"},
|
||||
{"id": "dall-e-3", "name": "DALL·E 3"},
|
||||
{"id": "gpt-image-1", "name": "GPT-IMAGE 1"},
|
||||
{"id": "gpt-image-1.5", "name": "GPT-IMAGE 1.5"},
|
||||
]
|
||||
elif request.app.state.config.IMAGE_GENERATION_ENGINE == "gemini":
|
||||
return [
|
||||
@@ -563,7 +564,9 @@ async def image_generations(
|
||||
),
|
||||
**(
|
||||
{}
|
||||
if "gpt-image-1" in request.app.state.config.IMAGE_GENERATION_MODEL
|
||||
if request.app.state.config.IMAGE_GENERATION_MODEL.startswith(
|
||||
"gpt-image"
|
||||
)
|
||||
else {"response_format": "b64_json"}
|
||||
),
|
||||
**(
|
||||
@@ -866,7 +869,7 @@ async def image_edits(
|
||||
**({"size": size} if size else {}),
|
||||
**(
|
||||
{}
|
||||
if "gpt-image-1" in request.app.state.config.IMAGE_EDIT_MODEL
|
||||
if request.app.state.config.IMAGE_EDIT_MODEL.startswith("gpt-image")
|
||||
else {"response_format": "b64_json"}
|
||||
),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user