mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-18 04:41:56 +00:00
fix: send correct resolution param to xAI image generation API
The xAI /v1/images/generations endpoint expects resolution as a
literal string ('1k' or '2k'), not the numeric value ('1024').
- Change _XAI_RESOLUTIONS from a dict mapping to a validation set
- Use the resolution key directly instead of the mapped value
- Fall back to DEFAULT_RESOLUTION on invalid config values
Fixes 422 Unprocessable Entity errors when resolution was sent.
This commit is contained in:
parent
e612c3d6f0
commit
13b474c56e
1 changed files with 2 additions and 5 deletions
|
|
@ -63,10 +63,7 @@ _XAI_ASPECT_RATIOS = {
|
|||
}
|
||||
|
||||
# xAI resolutions
|
||||
_XAI_RESOLUTIONS = {
|
||||
"1k": "1024",
|
||||
"2k": "2048",
|
||||
}
|
||||
_XAI_RESOLUTIONS = {"1k", "2k"}
|
||||
|
||||
DEFAULT_RESOLUTION = "1k"
|
||||
|
||||
|
|
@ -177,7 +174,7 @@ class XAIImageGenProvider(ImageGenProvider):
|
|||
aspect = resolve_aspect_ratio(aspect_ratio)
|
||||
xai_ar = _XAI_ASPECT_RATIOS.get(aspect, "1:1")
|
||||
resolution = _resolve_resolution()
|
||||
xai_res = _XAI_RESOLUTIONS.get(resolution, "1024")
|
||||
xai_res = resolution if resolution in _XAI_RESOLUTIONS else DEFAULT_RESOLUTION
|
||||
|
||||
payload: Dict[str, Any] = {
|
||||
"model": API_MODEL,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue