lobehub / lobe-chat

🤯 Lobe Chat - an open-source, modern-design LLMs/AI chat framework. Supports Multi AI Providers( OpenAI / Claude 3 / Gemini / Ollama / Bedrock / Azure / Mistral / Perplexity ), Multi-Modals (Vision/TTS) and plugin system. One-click FREE deployment of your private ChatGPT chat application.
https://chat-preview.lobehub.com
Other
34.86k stars 8.19k forks source link

[Bug] 对markdown语法的处理办法存在bug,包括输入,展示,复制等 #2819

Open hlc1209 opened 4 weeks ago

hlc1209 commented 4 weeks ago

📦 部署环境

📌 软件版本

0.162.20

💻 系统环境

🌐 浏览器

🐛 问题描述

当前的做法,默认开启markdown语法,其在显示和复制时的处理有非常大的bug 如果用户在输入框键入3*4(任何基本的数学式),那么聊天气泡中就会变成3 4。用户从聊天气泡中复制后的文字就会变成34

在对AI返回的文字的显示上也有bug,见https://github.com/lobehub/lobe-chat/issues/2819#issuecomment-2156223674

另外 默认对用户输入开启markdown语法并非最佳做法 对于广大群众,markdown闻所未闻。应默认多数用户不知道markdown语法(这是合理的假设,也是openai chatgpt网页端的默认行为) 不过鉴于修改的难度。可以先默认开启markdown语法,但是要把我上面说的显示和复制bug改掉。

📷 复现步骤

No response

🚦 期望结果

在这件事情上,作者可参考openai chatgpt网页端的默认行为。openai在这方面行为细节的处理是极为优秀的。照抄即可。 两个例子 https://github.com/lobehub/lobe-chat/issues/2819#issuecomment-2156222993 https://github.com/lobehub/lobe-chat/issues/2819#issuecomment-2156223674

📝 补充信息

No response

lobehubbot commented 4 weeks ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


📦 Deployment environment

📌 Software version

0.162.11

💻 System environment

🌐 Browser

-[X]Chrome

🐛 Problem description

The current approach is to enable markdown syntax by default, which has very big bugs in its display and copy processing. If the user types 3*4 (any basic mathematical formula) in the input box, the chat bubble will become 3 4. The text copied by the user from the chat bubble will become 34

in addition Turning on markdown syntax by default is not a best practice For the masses, markdown is unheard of. It should be assumed that most users do not know markdown syntax (this is a reasonable assumption and is also the default behavior of the openai chatgpt web page) However, given the difficulty of modification. You can first enable markdown syntax by default, but you need to correct the two bugs I mentioned above.

📷 Steps to reproduce

No response

🚦 Expected results

Then when they type , \, etc. symbols, it should not be represented as markdown syntax in the dialogue bubble. At the same time, when copying the text in the speech bubble, symbols such as \ should also be restored

In this matter, the author can refer to the default behavior of the openai chatgpt web page. OpenAI's handling of behavioral details in this area is extremely excellent. Just copy it.

📝 Supplementary information

No response

lobehubbot commented 4 weeks ago

👀 @hlc1209

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.\ 非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

hlc1209 commented 4 weeks ago

image 给一个openai chatgpt网页端的处理方式,供参考。

hlc1209 commented 4 weeks ago

image

image

对比chatgpt网页端和lobechat

lobehubbot commented 4 weeks ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


image

image

Compare chatgpt web client and lobechat

BrandonStudio commented 4 weeks ago

我的建议是,响应还是按markdown显示,提示可以给一个选项是否启用markdown渲染

不知道好不好做?

lobehubbot commented 4 weeks ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


My suggestion is that the response should still be displayed in markdown, and the prompt can give an option whether to enable markdown rendering.

Don't know if it's easy to do?

BrandonStudio commented 4 weeks ago

你图片里的显示应该是模型输出的问题,而不是渲染问题,你可以点击消息旁边的编辑看一下,他写的是 *3*4*5* 还是 *3\*4\*5*,前者说明是模型输出错误

lobehubbot commented 4 weeks ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The display in your picture should be a problem with the model output, not a rendering problem. You can click the edit next to the message to see if it says *3*4*5* or *3\*4\*5 *, the former indicates that the model output is wrong

hlc1209 commented 3 weeks ago

你图片里的显示应该是模型输出的问题,而不是渲染问题,你可以点击消息旁边的编辑看一下,他写的是 *3*4*5* 还是 *3\*4\*5*,前者说明是模型输出错误

确实是模型输出错误。

我的建议是,响应还是按markdown显示,提示可以给一个选项是否启用markdown渲染

这个建议我感觉很好

lobehubbot commented 3 weeks ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The display in your picture should be a problem with the model output, not a rendering problem. You can click on the edit next to the message to see if he wrote *3*4*5* or *3\*4\* 5*, the former indicates that the model output is wrong

It is indeed a model output error.

My suggestion is that the response should still be displayed in markdown, and the prompt can give an option whether to enable markdown rendering.

I feel good about this suggestion