-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Request] markdown输出的svg图片实时渲染功能的支持 #3941
Comments
🥰 Description of requirementsAI can be guided to output SVG code through prompt words and rendered through markdown. In this way, AI will have more visual gameplay. The idea comes from the "New Interpretation of Chinese Language" prompt by @李杰强 🧐 SolutionI don’t know much about this technology, but I just saw that Typora supports real-time rendering. You can refer to the implementation of typora 📝 Supplementary informationNo response |
Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. |
@Helium-327 你好,我是一个可以帮助你解决 bug、回答问题并成为贡献者的机器人。如果你有任何疑问,我会很乐意帮助你。 要在markdown中支持SVG图片的实时渲染,可以使用 import { remark } from 'remark';
import remarkGfm from 'remark-gfm';
import remarkHtml from 'remark-html';
import remarkSanitize from 'remark-sanitize';
export const parseMarkdown = async (content: string) => {
const file = await remark()
.use(remarkGfm)
.use(remarkHtml)
.use(remarkSanitize, {
tagNames: ['svg', 'path', 'circle', 'rect', 'line', 'polyline', 'polygon', 'text', 'g', 'defs', 'marker', 'use', 'symbol'],
attributes: {
'*': ['className', 'style', 'id', 'width', 'height', 'x', 'y', 'viewBox', 'xmlns', 'd', 'fill', 'stroke', 'stroke-width', 'transform', 'xlink:href']
}
})
.process(content.trim());
return String(file);
}; 这段代码添加了 |
要在markdown中支持SVG图片的实时渲染,可以使用 import { remark } from 'remark';
import remarkGfm from 'remark-gfm';
import remarkHtml from 'remark-html';
import remarkSanitize from 'remark-sanitize';
export const parseMarkdown = async (content: string) => {
const file = await remark()
.use(remarkGfm)
.use(remarkHtml)
.use(remarkSanitize, {
tagNames: ['svg', 'path', 'circle', 'rect', 'line', 'polyline', 'polygon', 'text', 'g', 'defs', 'marker', 'use', 'symbol'],
attributes: {
'*': ['className', 'style', 'id', 'width', 'height', 'x', 'y', 'viewBox', 'xmlns', 'd', 'fill', 'stroke', 'stroke-width', 'transform', 'xlink:href']
}
})
.process(content.trim());
return String(file);
}; 这段代码添加了 |
我希望lobe-chat输出能支持SVG |
I hope the lobe-chat output supports SVG |
good job |
This issue is closed, If you have any questions, you can comment and reply. |
🎉 This issue has been resolved in version 1.19.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
有些模型不支持Function Call, lobe不支持使用Artifacts,但也能生成正确的svg,可是却没法渲染,看看大佬怎么解决下 |
Some models do not support Function Call, lobe does not support using Artifacts, but can also generate correct svg, but cannot render. See how the big guy solves it. |
🥰 需求描述
可以通过提示词引导AI输出SVG代码,并通过markdown进行渲染,这样,AI将具备更多可视化的玩法。想法来源于@李继刚的”汉语新解“prompt
🧐 解决方案
不太懂这方面的技术,只知道typora支持实时渲染。可以参考typora的实现方式
📝 补充信息
No response
The text was updated successfully, but these errors were encountered: