mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-05 00:33:47 +08:00
fix: 修复 markdown 换行符不解析的 Bug,修复新发布的模型 token 统计失败错误
This commit is contained in:
@@ -26,7 +26,7 @@ import {httpGet} from "@/utils/http";
|
||||
export default defineComponent({
|
||||
name: 'ChatPrompt',
|
||||
components: {Clock},
|
||||
methods: {dateFormat},
|
||||
methods: {},
|
||||
props: {
|
||||
content: {
|
||||
type: String,
|
||||
|
||||
@@ -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") {
|
||||
|
||||
@@ -237,6 +237,7 @@ $fontSize = 16px;
|
||||
font-size $fontSize
|
||||
|
||||
.van-image {
|
||||
min-width 32px
|
||||
width 32px
|
||||
height 32px
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ const onLoad = () => {
|
||||
finished.value = true;
|
||||
const data = res.data
|
||||
if (data && data.length > 0) {
|
||||
const md = require('markdown-it')();
|
||||
const md = require('markdown-it')({breaks: true});
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
if (data[i].type === "prompt") {
|
||||
chatData.value.push(data[i]);
|
||||
@@ -228,7 +228,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);
|
||||
|
||||
Reference in New Issue
Block a user