Commit b70ae900 authored by Your Name's avatar Your Name

Fallback to main --model for image generation if --image-model not set

If --image-model is not specified, try to use the main --model as
the image model fallback when requesting 'default' model.
parent 9c681ed1
......@@ -3336,11 +3336,22 @@ async def create_image_generation(request: ImageGenerationRequest):
async with semaphore:
image_model = multi_model_manager.image_model
# If no image model configured, return an error
# If no image model configured, try to use main --model as fallback
if not image_model:
# Try to get the main model from args
main_model = getattr(global_args, 'model', None)
if main_model and isinstance(main_model, list) and len(main_model) > 0:
image_model = main_model[0]
print(f"Using main --model as image model fallback: {image_model}")
elif main_model:
image_model = main_model
print(f"Using main --model as image model fallback: {image_model}")
# If still no image model configured, return an error
if not image_model:
raise HTTPException(
status_code=400,
detail="Image generation not configured. Use --image-model to specify a model."
detail="Image generation not configured. Use --image-model or --model to specify a model."
)
# Determine model to use
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment