Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e54fdc8d
authored
Jul 29, 2024
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【代码优化】AI:markdown 组件,增加相关的注释
parent
a4a376b1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
11 deletions
+17
-11
build/vite/optimize.ts
+8
-1
pnpm-lock.yaml
+0
-0
src/components/MarkdownView/index.vue
+5
-6
src/views/ai/chat/index/index.vue
+4
-4
No files found.
build/vite/optimize.ts
View file @
e54fdc8d
...
...
@@ -27,6 +27,9 @@ const include = [
'echarts-wordcloud'
,
'@wangeditor/editor'
,
'@wangeditor/editor-for-vue'
,
'@microsoft/fetch-event-source'
,
'markdown-it'
,
'highlight.js'
,
'element-plus'
,
'element-plus/es'
,
'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-item/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'
]
...
...
pnpm-lock.yaml
View file @
e54fdc8d
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/components/MarkdownView/index.vue
View file @
e54fdc8d
<
template
>
<!--
<div
ref=
"contentRef"
class=
"markdown-view"
v-html=
"contentHtml"
></div>
-->
<div
ref=
"contentRef"
class=
"markdown-view"
v-html=
"renderedMarkdown"
></div>
</
template
>
<
script
setup
lang=
"ts"
>
import
{
useClipboard
}
from
'@vueuse/core'
import
{
useClipboard
}
from
'@vueuse/core'
import
MarkdownIt
from
'markdown-it'
import
'highlight.js/styles/vs2015.min.css'
import
hljs
from
'highlight.js'
...
...
@@ -20,7 +19,6 @@ const props = defineProps({
const
message
=
useMessage
()
// 消息弹窗
const
{
copy
}
=
useClipboard
()
// 初始化 copy 到粘贴板
const
contentRef
=
ref
()
const
{
content
}
=
toRefs
(
props
)
// 将 props 变为引用类型
const
md
=
new
MarkdownIt
({
highlight
:
function
(
str
,
lang
)
{
...
...
@@ -32,11 +30,12 @@ const md = new MarkdownIt({
}
return
``
}
})
;
})
/** 渲染 markdown */
const
renderedMarkdown
=
computed
(()
=>
{
return
md
.
render
(
props
.
content
)
;
})
;
return
md
.
render
(
props
.
content
)
})
/** 初始化 **/
onMounted
(
async
()
=>
{
...
...
src/views/ai/chat/index/index.vue
View file @
e54fdc8d
...
...
@@ -4,10 +4,10 @@
<ConversationList
:active-id=
"activeConversationId"
ref=
"conversationListRef"
@
on
ConversationC
reate=
"handleConversationCreateSuccess"
@
on
ConversationC
lick=
"handleConversationClick"
@
on
ConversationC
lear=
"handleConversationClear"
@
on
ConversationD
elete=
"handlerConversationDelete"
@
on
-conversation-c
reate=
"handleConversationCreateSuccess"
@
on
-conversation-c
lick=
"handleConversationClick"
@
on
-conversation-c
lear=
"handleConversationClear"
@
on
-conversation-d
elete=
"handlerConversationDelete"
/>
<!-- 右侧:对话详情 -->
<el-container
class=
"detail-container"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment