vuepress-theme-uniapp-official 1.6.6 → 1.6.8
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.
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
</div>
|
|
41
41
|
<div class="footer-toolbar_right">
|
|
42
42
|
<span v-if="inputError" class="error-tips">
|
|
43
|
-
|
|
43
|
+
不少于 {{ MAX_AI_ANSWER_LENGTH }} 个字符且包含中文
|
|
44
44
|
</span>
|
|
45
45
|
<span class="tips">
|
|
46
46
|
↵ 发送 / shift + ↵ 换行
|
|
@@ -91,7 +91,8 @@ const footer = ref(null)
|
|
|
91
91
|
|
|
92
92
|
const hasMessage = computed(() => messages.value.length > 0)
|
|
93
93
|
const inputError = computed(() => {
|
|
94
|
-
|
|
94
|
+
const inputTextTrimmed = inputText.value.trim();
|
|
95
|
+
return inputTextTrimmed.length > 0 && inputTextTrimmed.length < MAX_AI_ANSWER_LENGTH && !/[\u4e00-\u9fa5]/.test(inputTextTrimmed);
|
|
95
96
|
})
|
|
96
97
|
|
|
97
98
|
const notSupportBackdrop = ref(false);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const DEFAULT_ENABLE_AI = true; // 默认启用 AI 助手
|
|
2
|
-
export const MAX_AI_ANSWER_LENGTH = 6; // AI
|
|
2
|
+
export const MAX_AI_ANSWER_LENGTH = 6; // AI 消息最小长度
|
|
@@ -245,7 +245,11 @@ export default {
|
|
|
245
245
|
}
|
|
246
246
|
},
|
|
247
247
|
showAIMessage() {
|
|
248
|
-
|
|
248
|
+
const searchText = this.searchValue.trim()
|
|
249
|
+
const hasAIMessageHistory = this.aiMessage.msg.trim().length > 0
|
|
250
|
+
const wordLimitExceeded = searchText.length >= MAX_AI_ANSWER_LENGTH
|
|
251
|
+
const hasChineseCharacters = /[\u4e00-\u9fa5]/.test(searchText)
|
|
252
|
+
return this.enableAI && ((wordLimitExceeded && hasChineseCharacters) || hasAIMessageHistory)
|
|
249
253
|
}
|
|
250
254
|
},
|
|
251
255
|
|
|
@@ -356,7 +360,7 @@ export default {
|
|
|
356
360
|
}
|
|
357
361
|
this.aiMessage.msg = ''
|
|
358
362
|
this.searchAIResult = null
|
|
359
|
-
if (this.
|
|
363
|
+
if (this.showAIMessage) {
|
|
360
364
|
this.searchByAI()
|
|
361
365
|
}
|
|
362
366
|
},
|
|
@@ -389,7 +393,7 @@ export default {
|
|
|
389
393
|
this.totalPage = nbPages;
|
|
390
394
|
this.curPage = page + 1;
|
|
391
395
|
|
|
392
|
-
if (this.
|
|
396
|
+
if (this.curPage === 1 && this.showAIMessage) {
|
|
393
397
|
this.resultList.splice(1, 0, this.aiMessage);
|
|
394
398
|
}
|
|
395
399
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vuepress-theme-uniapp-official",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.8",
|
|
4
4
|
"description": "uni-app official website theme for vuepress",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"vuepress-plugin-named-chunks": "^1.1.4",
|
|
47
47
|
"vuepress-plugin-zooming": "^1.1.8",
|
|
48
48
|
"vuepress-plugin-check-md2": "^1.0.5",
|
|
49
|
-
"vuepress-plugin-
|
|
50
|
-
"vuepress-plugin-
|
|
49
|
+
"vuepress-plugin-noscript-code": "^1.0.2",
|
|
50
|
+
"vuepress-plugin-expandable-row": "^1.0.10"
|
|
51
51
|
},
|
|
52
52
|
"resolutions": {
|
|
53
53
|
"terser-webpack-plugin": "1.4.6",
|