vuepress-theme-uniapp-official 1.6.3 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/DcloudSearchPage/ai-result.styl +8 -1
- package/components/DcloudSearchPage/components/AIChat/index.vue +5 -2
- package/components/DcloudSearchPage/components/AIChat/markdown-loader.js +22 -19
- package/components/DcloudSearchPage/components/Skeleton.vue +7 -7
- package/components/DcloudSearchPage/index.vue +1 -1
- package/package.json +1 -1
|
@@ -12,11 +12,18 @@
|
|
|
12
12
|
box-shadow 0 4px 14px rgba(0,0,0,0.08)
|
|
13
13
|
transform translateY(-1px)
|
|
14
14
|
/* 重置部分元素样式,防止样式冲突 */
|
|
15
|
+
pre
|
|
16
|
+
margin: 0
|
|
17
|
+
padding: 5px
|
|
18
|
+
border-radius 10px
|
|
19
|
+
background #f6f8fa
|
|
20
|
+
& + pre
|
|
21
|
+
margin-top 8px
|
|
15
22
|
pre, code
|
|
16
23
|
white-space: pre-wrap; /* 允许换行 */
|
|
17
24
|
word-wrap: break-word; /* 允许长行断开 */
|
|
18
25
|
word-break: break-word;
|
|
19
|
-
h1, h2, h3, h4, h5, h6, p, ul, ol, dl, figure, blockquote
|
|
26
|
+
h1, h2, h3, h4, h5, h6, p, ul, ol, dl, figure, blockquote
|
|
20
27
|
line-height: normal
|
|
21
28
|
margin: 0
|
|
22
29
|
padding: 0
|
|
@@ -197,7 +197,7 @@ async function send() {
|
|
|
197
197
|
if (res.errorCode === 0) {
|
|
198
198
|
fakeReply = res.chunk
|
|
199
199
|
} else {
|
|
200
|
-
fakeReply = `抱歉,AI 助手出错了:${res.
|
|
200
|
+
fakeReply = `抱歉,AI 助手出错了:${res.errorMsg || '未知错误'}`
|
|
201
201
|
}
|
|
202
202
|
} catch (error) {
|
|
203
203
|
fakeReply = `抱歉,AI 助手出错了:${error.message || '未知错误'}`
|
|
@@ -214,6 +214,7 @@ async function send() {
|
|
|
214
214
|
isTyping: false,
|
|
215
215
|
like: 0
|
|
216
216
|
}
|
|
217
|
+
|
|
217
218
|
messages.value.push(aiMsg)
|
|
218
219
|
|
|
219
220
|
// 动态打字
|
|
@@ -290,6 +291,8 @@ window.addEventListener('resize', scrollToBottom)
|
|
|
290
291
|
word-break break-word
|
|
291
292
|
box-shadow 0 1px 3px rgba(0,0,0,0.08)
|
|
292
293
|
pre
|
|
294
|
+
margin: 0
|
|
295
|
+
padding: 5px
|
|
293
296
|
border-radius 10px
|
|
294
297
|
& + pre
|
|
295
298
|
margin-top 8px
|
|
@@ -297,7 +300,7 @@ window.addEventListener('resize', scrollToBottom)
|
|
|
297
300
|
white-space: pre-wrap; /* 允许换行 */
|
|
298
301
|
word-wrap: break-word; /* 允许长行断开 */
|
|
299
302
|
word-break: break-word;
|
|
300
|
-
h1, h2, h3, h4, h5, h6, p, ul, ol, dl, figure, blockquote
|
|
303
|
+
h1, h2, h3, h4, h5, h6, p, ul, ol, dl, figure, blockquote
|
|
301
304
|
margin: 0
|
|
302
305
|
padding: 0
|
|
303
306
|
ul, ol
|
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
// markdown-loader.js
|
|
2
2
|
let markedInstance = null;
|
|
3
|
-
let hljsInstance = null;
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
// `1.` 转义为 `1、`,防止 marked 解析失败
|
|
5
|
+
function escapeMD(str) {
|
|
6
|
+
return str
|
|
7
|
+
.replace(/(\s*\b)(\d+)\./g, '$1$2、')
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function getLangCodeFromExtension(extension) {
|
|
11
|
+
const extensionMap = {
|
|
12
|
+
vue: 'markup',
|
|
13
|
+
html: 'markup',
|
|
14
|
+
md: 'markdown',
|
|
15
|
+
rb: 'ruby',
|
|
16
|
+
ts: 'typescript',
|
|
17
|
+
py: 'python',
|
|
18
|
+
sh: 'bash',
|
|
19
|
+
yml: 'yaml',
|
|
20
|
+
styl: 'stylus',
|
|
21
|
+
kt: 'kotlin',
|
|
22
|
+
rs: 'rust',
|
|
18
23
|
uts: 'typescript',
|
|
19
24
|
json5: 'json',
|
|
20
|
-
|
|
25
|
+
};
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
return extensionMap[extension] || extension;
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
export async function renderMarkdown(md) {
|
|
@@ -39,8 +44,6 @@ export async function renderMarkdown(md) {
|
|
|
39
44
|
});
|
|
40
45
|
|
|
41
46
|
markedInstance = marked;
|
|
42
|
-
hljsInstance = hljs;
|
|
43
47
|
}
|
|
44
|
-
|
|
45
|
-
return markedInstance.parse(md || '');
|
|
48
|
+
return markedInstance.parse(escapeMD(md || ''));
|
|
46
49
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="chat-skeleton chat-skeleton-left">
|
|
3
|
-
<div class="
|
|
4
|
-
<div class="
|
|
5
|
-
<div class="
|
|
6
|
-
<div class="
|
|
3
|
+
<div class="chat-skeleton_content">
|
|
4
|
+
<div class="chat-skeleton_content_line"></div>
|
|
5
|
+
<div class="chat-skeleton_content_line"></div>
|
|
6
|
+
<div class="chat-skeleton_content_line short"></div>
|
|
7
7
|
</div>
|
|
8
8
|
</div>
|
|
9
9
|
</template>
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
gap: 12px
|
|
30
30
|
padding: 12px 0
|
|
31
31
|
|
|
32
|
-
.chat-skeleton .
|
|
32
|
+
.chat-skeleton .chat-skeleton_content_line
|
|
33
33
|
height: 14px
|
|
34
34
|
border-radius: 6px
|
|
35
35
|
@extend .skeleton
|
|
36
36
|
|
|
37
|
-
.chat-skeleton .
|
|
37
|
+
.chat-skeleton .chat-skeleton_content_line.short
|
|
38
38
|
width: 40%
|
|
39
39
|
|
|
40
40
|
/* 左侧消息骨架(AI) */
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
display: flex
|
|
43
43
|
flex-direction: row
|
|
44
44
|
gap: 10px
|
|
45
|
-
.
|
|
45
|
+
.chat-skeleton_content
|
|
46
46
|
flex: 1
|
|
47
47
|
display: flex
|
|
48
48
|
flex-direction: column
|