fix(image): tolerate shell-sourced REFERENCE_IMAGES
This commit is contained in:
@@ -71,7 +71,15 @@ def split_reference_values(raw_value: str) -> list[str]:
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
if value.startswith("["):
|
if value.startswith("["):
|
||||||
parsed = json.loads(value)
|
try:
|
||||||
|
parsed = json.loads(value)
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
inner = value[1:-1].strip()
|
||||||
|
if not inner:
|
||||||
|
return []
|
||||||
|
parts = [part.strip().strip('"').strip("'") for part in inner.split(",")]
|
||||||
|
return [part for part in parts if part]
|
||||||
|
|
||||||
if not isinstance(parsed, list):
|
if not isinstance(parsed, list):
|
||||||
raise RuntimeError("REFERENCE_IMAGES 必须是 JSON 数组")
|
raise RuntimeError("REFERENCE_IMAGES 必须是 JSON 数组")
|
||||||
return [str(item).strip() for item in parsed if str(item).strip()]
|
return [str(item).strip() for item in parsed if str(item).strip()]
|
||||||
|
|||||||
Reference in New Issue
Block a user