image strugles 2
This commit is contained in:
@@ -845,24 +845,46 @@ Make sure each prompt is detailed enough for image generation, describing the vi
|
||||
# Reference: image-generation.php lines 79-97
|
||||
import uuid
|
||||
logger.info(f"[AIProcessor.generate_image] Runware API key check: has_key={bool(api_key)}, key_length={len(api_key) if api_key else 0}, key_preview={api_key[:10] + '...' + api_key[-4:] if api_key and len(api_key) > 14 else 'N/A'}")
|
||||
|
||||
# Build base inference task
|
||||
inference_task = {
|
||||
'taskType': 'imageInference',
|
||||
'taskUUID': str(uuid.uuid4()),
|
||||
'positivePrompt': prompt,
|
||||
'negativePrompt': negative_prompt,
|
||||
'model': runware_model,
|
||||
'width': width,
|
||||
'height': height,
|
||||
'numberResults': 1,
|
||||
'outputFormat': kwargs.get('format', 'webp')
|
||||
}
|
||||
|
||||
# Model-specific parameter configuration
|
||||
if runware_model.startswith('bria:'):
|
||||
# Bria models need steps
|
||||
inference_task['steps'] = 20
|
||||
elif runware_model.startswith('google:'):
|
||||
# Google models use resolution instead of width/height
|
||||
del inference_task['width']
|
||||
del inference_task['height']
|
||||
inference_task['resolution'] = '1k'
|
||||
elif runware_model.startswith('bytedance:'):
|
||||
# Seedream models use basic format - no steps, CFGScale needed
|
||||
pass
|
||||
elif runware_model.startswith('runware:'):
|
||||
# Hi Dream Full - needs steps and CFGScale
|
||||
inference_task['steps'] = 30
|
||||
inference_task['CFGScale'] = 7.5
|
||||
else:
|
||||
# Unknown model - use basic format
|
||||
pass
|
||||
|
||||
payload = [
|
||||
{
|
||||
'taskType': 'authentication',
|
||||
'apiKey': api_key
|
||||
},
|
||||
{
|
||||
'taskType': 'imageInference',
|
||||
'taskUUID': str(uuid.uuid4()),
|
||||
'positivePrompt': prompt,
|
||||
'negativePrompt': negative_prompt,
|
||||
'model': runware_model,
|
||||
'width': width,
|
||||
'height': height,
|
||||
'steps': 30,
|
||||
'CFGScale': 7.5,
|
||||
'numberResults': 1,
|
||||
'outputFormat': kwargs.get('format', 'webp')
|
||||
}
|
||||
inference_task
|
||||
]
|
||||
|
||||
logger.info(f"[AIProcessor.generate_image] Runware request payload: model={runware_model}, width={width}, height={height}, prompt_length={len(prompt)}")
|
||||
|
||||
Reference in New Issue
Block a user