fix: 修复 markdown 换行符不解析的 Bug,修复新发布的模型 token 统计失败错误

This commit is contained in:
RockYang
2023-06-27 14:18:20 +08:00
parent a08981f876
commit 3f91f37aff
6 changed files with 316 additions and 113 deletions

View File

@@ -503,7 +503,7 @@ const connect = function (chat_id, role_id) {
} else {
lineBuffer.value += data.content;
let md = require('markdown-it')();
const md = require('markdown-it')({breaks: true});
const reply = chatData.value[chatData.value.length - 1]
reply['orgContent'] = lineBuffer.value;
reply['content'] = md.render(lineBuffer.value);
@@ -641,7 +641,7 @@ const loadChatHistory = function (chatId) {
return
}
const md = require('markdown-it')();
const md = require('markdown-it')({breaks: true});
// md.use(require('markdown-it-copy')); // 代码复制功能
for (let i = 0; i < data.length; i++) {
if (data[i].type === "prompt") {