Spaces:
raheem786
/
Paused

akhaliq HF Staff commited on
Commit
f5a9d8a
·
1 Parent(s): 1230bba

Fix transformers.js parser: Support both === and markdown formats

Browse files

Issue: LLM was generating code with markdown blocks (html, javascript, css)
but parser only looked for === filename === format

Fixes:
1. Updated TRANSFORMERS_JS_SYSTEM_PROMPT to specify === format explicitly
- Added clear examples showing === index.html ===, === index.js ===, === style.css ===
- Explicitly stated NOT to use markdown code blocks

2. Enhanced parse_transformers_js_output() with fallback logic:
- Primary: Parse === filename === sections
- Fallback: Parse markdown code blocks (html, javascript, css)
- Last resort: Try single HTML file extraction
- Removes placeholder comments from extracted content

This ensures backward compatibility with already-generated code while
guiding future generations to use the correct format.

2 files changed +62 -12
Files changed (2)
backend_deploy.py+51-5
backend_prompts.py+11-7