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
- 输入内容不少于 {{ MAX_AI_ANSWER_LENGTH }} 个字符
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
- return inputText.value.length > 0 && inputText.value.trim().length < MAX_AI_ANSWER_LENGTH;
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);
@@ -8,6 +8,10 @@
8
8
  & + pre
9
9
  margin-top 8px
10
10
 
11
+ code
12
+ font-size 14px
13
+ color #24292e
14
+
11
15
  pre, code
12
16
  white-space pre-wrap
13
17
  word-break break-word
@@ -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
- return this.searchValue.trim().length >= MAX_AI_ANSWER_LENGTH || this.aiMessage.msg.trim().length > 0
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.enableAI && this.searchValue.trim().length) {
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.enableAI && this.curPage === 1 && this.showAIMessage) {
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.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-expandable-row": "^1.0.10",
50
- "vuepress-plugin-noscript-code": "^1.0.2"
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",