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 []
|
||||
|
||||
if value.startswith("["):
|
||||
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):
|
||||
raise RuntimeError("REFERENCE_IMAGES 必须是 JSON 数组")
|
||||
return [str(item).strip() for item in parsed if str(item).strip()]
|
||||
|
||||
Reference in New Issue
Block a user