From 7c7daef30bb9933b89f07bc720e3c82919462401 Mon Sep 17 00:00:00 2001 From: fujie Date: Sat, 28 Feb 2026 04:56:28 +0800 Subject: [PATCH] refactor(pipes): optimize gif embedding and detection - update BASE_GUIDELINES to explicitly allow direct GIF embedding - update publish_file_from_workspace to support common image formats --- plugins/pipes/github-copilot-sdk/github_copilot_sdk.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/pipes/github-copilot-sdk/github_copilot_sdk.py b/plugins/pipes/github-copilot-sdk/github_copilot_sdk.py index d6ceb76..513c5ed 100644 --- a/plugins/pipes/github-copilot-sdk/github_copilot_sdk.py +++ b/plugins/pipes/github-copilot-sdk/github_copilot_sdk.py @@ -157,7 +157,7 @@ BASE_GUIDELINES = ( " - **Artifacts mode** (`embed_type='artifacts'`): You MUST provide the **[Preview]** and **[Download]** links, AND then you MUST output the provided `html_embed` (the iframe) wrapped within a ```html code block to enable the interactive preview.\n" " - **Process Visibility**: While raw code is often replaced by links/frames, you SHOULD provide a **very brief Markdown summary** of the component's structure or key features (e.g., 'Generated login form with validation') before publishing. This keeps the user informed of the 'processing' progress.\n" " - **Game/App Controls**: If your HTML includes keyboard controls (e.g., arrow keys, spacebar for games), you MUST include `event.preventDefault()` in your `keydown` listeners to prevent the parent browser page from scrolling.\n" - "4. **Images & Files**: ALWAYS embed generated images/files directly using `![caption](url)`. Never provide plain text links.\n" + "4. **Images & Files**: ALWAYS embed generated images (including GIF files) directly using `![caption](url)`. GIF files are treated as direct visual assets just like PNG or JPG. Never provide plain text links for visual media.\n" "5. **File Delivery Protocol (Dual-Channel Delivery)**:\n" " - **Definition**: **Artifacts** = content/code-block driven visual output in chat (typically with `html_embed`). **Rich UI** = tool/action returned embedded UI rendered by emitter in a persistent sandboxed iframe.\n" " - **Philosophy**: Visual Artifacts (HTML/Mermaid) and Downloadable Files are **COMPLEMENTARY**. Always aim to provide BOTH: instant visual insight in the chat AND a persistent file for the user to keep.\n" @@ -1151,6 +1151,9 @@ class Pipe: is_html = safe_filename.lower().endswith((".html", ".htm")) is_pdf = safe_filename.lower().endswith(".pdf") + is_img = safe_filename.lower().endswith( + (".png", ".jpg", ".jpeg", ".gif", ".webp", ".svg") + ) view_url = None has_preview = False