【代码优化】AI:markdown 组件,增加相关的注释

pull/491/MERGE
YunaiV 2024-07-29 21:24:03 +08:00
parent cb02377706
commit a805ceb534
4 changed files with 1223 additions and 1957 deletions

View File

@ -27,6 +27,9 @@ const include = [
'echarts-wordcloud', 'echarts-wordcloud',
'@wangeditor/editor', '@wangeditor/editor',
'@wangeditor/editor-for-vue', '@wangeditor/editor-for-vue',
'@microsoft/fetch-event-source',
'markdown-it',
'highlight.js',
'element-plus', 'element-plus',
'element-plus/es', 'element-plus/es',
'element-plus/es/locale/lang/zh-cn', 'element-plus/es/locale/lang/zh-cn',
@ -104,7 +107,11 @@ const include = [
'element-plus/es/components/collapse/style/css', 'element-plus/es/components/collapse/style/css',
'element-plus/es/components/collapse-item/style/css', 'element-plus/es/components/collapse-item/style/css',
'element-plus/es/components/button-group/style/css', 'element-plus/es/components/button-group/style/css',
'element-plus/es/components/text/style/css' 'element-plus/es/components/text/style/css',
'element-plus/es/components/segmented/style/css',
'@element-plus/icons-vue',
'element-plus/es/components/footer/style/css',
'element-plus/es/components/empty/style/css'
] ]
const exclude = ['@iconify/json'] const exclude = ['@iconify/json']

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,9 @@
<template> <template>
<!-- <div ref="contentRef" class="markdown-view" v-html="contentHtml"></div>-->
<div ref="contentRef" class="markdown-view" v-html="renderedMarkdown"></div> <div ref="contentRef" class="markdown-view" v-html="renderedMarkdown"></div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {useClipboard} from '@vueuse/core' import { useClipboard } from '@vueuse/core'
import MarkdownIt from 'markdown-it' import MarkdownIt from 'markdown-it'
import 'highlight.js/styles/vs2015.min.css' import 'highlight.js/styles/vs2015.min.css'
import hljs from 'highlight.js' import hljs from 'highlight.js'
@ -20,7 +19,6 @@ const props = defineProps({
const message = useMessage() // const message = useMessage() //
const { copy } = useClipboard() // copy const { copy } = useClipboard() // copy
const contentRef = ref() const contentRef = ref()
const { content } = toRefs(props) // props
const md = new MarkdownIt({ const md = new MarkdownIt({
highlight: function (str, lang) { highlight: function (str, lang) {
@ -32,11 +30,12 @@ const md = new MarkdownIt({
} }
return `` return ``
} }
}); })
/** 渲染 markdown */
const renderedMarkdown = computed(() => { const renderedMarkdown = computed(() => {
return md.render(props.content); return md.render(props.content)
}); })
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {

View File

@ -4,10 +4,10 @@
<ConversationList <ConversationList
:active-id="activeConversationId" :active-id="activeConversationId"
ref="conversationListRef" ref="conversationListRef"
@onConversationCreate="handleConversationCreateSuccess" @on-conversation-create="handleConversationCreateSuccess"
@onConversationClick="handleConversationClick" @on-conversation-click="handleConversationClick"
@onConversationClear="handleConversationClear" @on-conversation-clear="handleConversationClear"
@onConversationDelete="handlerConversationDelete" @on-conversation-delete="handlerConversationDelete"
/> />
<!-- 右侧对话详情 --> <!-- 右侧对话详情 -->
<el-container class="detail-container"> <el-container class="detail-container">