feat: 新增markdown渲染

This commit is contained in:
Gsh
2025-07-07 21:01:59 +08:00
parent 826d529997
commit 6f1eb1f4b9
3 changed files with 716 additions and 851 deletions

View File

@@ -47,7 +47,7 @@
"radash": "^12.1.0",
"reset-css": "^5.0.2",
"vue": "^3.5.16",
"vue-element-plus-x": "1.2.0",
"vue-element-plus-x": "1.2.26-beta",
"vue-router": "4"
},
"devDependencies": {

1554
Yi.Ai.Vue3/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -8,6 +8,7 @@ import type { FilesCardProps } from 'vue-element-plus-x/types/FilesCard';
import type { ThinkingStatus } from 'vue-element-plus-x/types/Thinking';
import { ElMessage } from 'element-plus';
import { useHookFetch } from 'hook-fetch/vue';
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { send } from '@/api';
import FilesSelect from '@/components/FilesSelect/index.vue';
@@ -81,7 +82,6 @@ watch(
await chatStore.requestChatList(`${_id_}`);
// 请求聊天记录后,赋值回显,并滚动到底部
bubbleItems.value = chatStore.chatMap[`${_id_}`] as MessageItem[];
// 滚动到底部
setTimeout(() => {
bubbleListRef.value!.scrollToBottom();
@@ -265,6 +265,11 @@ watch(
}
},
);
function markdownContent(item: any) {
console.log('item---', item);
return item.content;
}
</script>
<template>
@@ -277,6 +282,10 @@ watch(
:status="item.thinkingStatus" class="thinking-chain-warp" @change="handleChange"
/>
</template>
<!-- 自定义气泡内容 -->
<template #content="{ item }">
<XMarkdown :markdown="markdownContent(item)" />
</template>
</BubbleList>
<Sender