Skip to content

feat(generator): replace LLM-generated HTML with local template wrapping - #959

Merged
ninelcc336 merged 5 commits into
aifrom
feat-generator
May 25, 2026
Merged

feat(generator): replace LLM-generated HTML with local template wrapping#959
ninelcc336 merged 5 commits into
aifrom
feat-generator

Conversation

@ninelcc336

@ninelcc336 ninelcc336 commented May 18, 2026

Copy link
Copy Markdown
Contributor
  • 让LLM只生成纯GPT-Vis语法,而不是完整的HTML
  • 添加wrapSyntaxInHTML()函数,用于在预设的HTML模板中嵌入vis语法
image

@github-actions

github-actions Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

🎊 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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/visualization/generator.ts Outdated
Comment thread src/visualization/generator.ts Outdated
lkn added 2 commits May 18, 2026 17:49
- 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
@ninelcc336

Copy link
Copy Markdown
Contributor Author

@gemini-code-assist[bot] 重新评审

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/visualization/generator.ts Outdated
@ninelcc336 ninelcc336 changed the title feat(generator): strictly regulate the syntax generation of GPT-Vis feat(generator): replace LLM-generated HTML with local template wrapping May 22, 2026
@ninelcc336
ninelcc336 merged commit b7f7ec0 into ai May 25, 2026
3 checks passed
@ninelcc336
ninelcc336 deleted the feat-generator branch May 25, 2026 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant