mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
fix(nano-banana-pro): remove space after MEDIA: token in generate_image.py (#18706)
The MEDIA: output token must appear at line start with no space after the colon for OpenClaw's splitMediaFromOutput parser to extract the file path and auto-attach media on outbound chat channels (Discord, Telegram, WhatsApp, etc.). The script was printing 'MEDIA: /path' (with space), which while tolerated by the regex, does not match the canonical 'MEDIA:/path' format used by all other skills (e.g. openai-image-gen) and tested in the codebase (pi-embedded-subscribe.tools.media.test.ts, media/parse.test.ts). Also updated the comment to clarify the format constraint.
This commit is contained in:
@@ -192,8 +192,9 @@ def main():
|
|||||||
if image_saved:
|
if image_saved:
|
||||||
full_path = output_path.resolve()
|
full_path = output_path.resolve()
|
||||||
print(f"\nImage saved: {full_path}")
|
print(f"\nImage saved: {full_path}")
|
||||||
# OpenClaw parses MEDIA tokens and will attach the file on supported providers.
|
# OpenClaw parses MEDIA: tokens (line-start, no space after colon)
|
||||||
print(f"MEDIA: {full_path}")
|
# and will attach the file on supported chat providers.
|
||||||
|
print(f"MEDIA:{full_path}")
|
||||||
else:
|
else:
|
||||||
print("Error: No image was generated in the response.", file=sys.stderr)
|
print("Error: No image was generated in the response.", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user