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:
ABFS Tech
2026-03-06 10:29:06 -05:00
committed by GitHub
parent 151f26070b
commit 86a89d96d7

View File

@@ -192,8 +192,9 @@ def main():
if image_saved:
full_path = output_path.resolve()
print(f"\nImage saved: {full_path}")
# OpenClaw parses MEDIA tokens and will attach the file on supported providers.
print(f"MEDIA: {full_path}")
# OpenClaw parses MEDIA: tokens (line-start, no space after colon)
# and will attach the file on supported chat providers.
print(f"MEDIA:{full_path}")
else:
print("Error: No image was generated in the response.", file=sys.stderr)
sys.exit(1)