Skip to content
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

自定义大语言模型的content显示Markdown内容格式问题 #57

Open
itroc opened this issue Aug 5, 2024 · 0 comments
Open

自定义大语言模型的content显示Markdown内容格式问题 #57

itroc opened this issue Aug 5, 2024 · 0 comments

Comments

@itroc
Copy link

itroc commented Aug 5, 2024

AI大模型服务端返回内容是Markdown格式,在目前的版本显示会丢失格式(如列表、加粗等),当尝试手动转换Markdown格式为html时浏览器会html源码,因服务器是异步响应,目前这里手动转换也不是一个好办法,可能存在不应该换行的被换行的问题,如姓名是一起显示的,因是异步二次响应的原因被拆成两行显示了,建议是在整体显示模式上处理。

微信图片_20240805112110
微信图片_20240805112143

配置项:parseMessage如下

ai: {
        models: {
            custom: {
              ...
                parseMessage: (message: string) => {
                    return {
                        role: "assistant",
                        // message转为html格式
                        content: md.render(message),
                    }
                },
            }
        }
    },
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

No branches or pull requests

1 participant