feat(generator): replace LLM-generated HTML with local template wrapping - #959
Conversation
|
🎊 PR Preview 6d6867b has been successfully built and deployed to https://antvis-AVA-preview-pr-959.surge.sh 🕐 Build time: 0.011s 🤖 By surge-preview |
There was a problem hiding this comment.
Code Review
This pull request updates the GPT-Vis generation instructions and HTML template in src/visualization/generator.ts to enforce stricter formatting rules, such as prohibiting string interpolation and requiring specific indentation for the visSyntax variable. Review feedback correctly identifies that the use of triple backslashes for template string delimiters in both the instructions and the example code is incorrect and would lead to invalid JavaScript in the generated output; using a single escaped backtick is recommended instead.
- Let LLM only generate pure GPT-Vis syntax instead of full HTML - Add wrapSyntaxInHTML() to embed syntax into a fixed HTML template locally - Remove fragile regex-based syntax extraction from LLM output - Simplify prompt by removing HTML structure requirements - Ensure HTML output is always well-formed regardless of LLM variance
|
@gemini-code-assist[bot] 重新评审 |
There was a problem hiding this comment.
Code Review
This pull request refactors the visualization generation logic to improve reliability by having the LLM generate pure GPT-Vis syntax instead of full HTML. The syntax is now wrapped into a local HTML template via the wrapSyntaxInHTML function. Feedback identifies a high-severity XSS vulnerability in this function, as LLM-generated content containing </script> tags could prematurely close the script block, and a code suggestion was provided to escape such tags.

Uh oh!
There was an error while loading. Please reload this page.