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
This commit is contained in:
@@ -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 ``. Never provide plain text links.\n"
|
||||
"4. **Images & Files**: ALWAYS embed generated images (including GIF files) directly using ``. 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
|
||||
|
||||
Reference in New Issue
Block a user