ai-chat-bot-interface 1.6.17 → 1.6.19

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ai-chat-bot-interface",
3
3
  "private": false,
4
- "version": "1.6.17",
4
+ "version": "1.6.19",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "description": "A AI chat bot interface. (private)",
package/src/App.vue CHANGED
@@ -24,7 +24,7 @@ const handleLog = (log) => {
24
24
  ]"
25
25
  :need-log="true"
26
26
  content-type="markdown"
27
- first-msg="你好"
27
+ first-msg="减脂减重"
28
28
  @log="handleLog"
29
29
  />
30
30
  </div>
package/src/ChatUi.vue CHANGED
@@ -123,6 +123,7 @@
123
123
  finalCardList.personalForm &&
124
124
  comp.showType === 'personalForm'
125
125
  "
126
+ :query="firstMsg"
126
127
  @submit="chatConv"
127
128
  />
128
129
  </template>
@@ -381,6 +382,13 @@ onMounted(async () => {
381
382
  ],
382
383
  },
383
384
  ];
385
+ if (props.needLog) {
386
+ Emits('log', {
387
+ turns: turns.value,
388
+ info: historyList.value[historyList.value.length - 1],
389
+ });
390
+ turns.value += 1;
391
+ }
384
392
  }
385
393
  }
386
394
  scrollToEnd();
@@ -498,12 +506,12 @@ const chatConv = async (data) => {
498
506
  });
499
507
  historyList.value.push(uObj);
500
508
  isReq.value = '02';
501
- turns.value += 1;
502
509
  if (props.needLog) {
503
510
  Emits('log', {
504
511
  turns: turns.value,
505
512
  info: uObj,
506
513
  });
514
+ turns.value += 1;
507
515
  }
508
516
  const res = await fetch(
509
517
  `https://api.coze.cn/v3/chat?conversation_id=${conversationId.value}`,
@@ -585,6 +593,7 @@ const chatConv = async (data) => {
585
593
  turns: turns.value,
586
594
  info: historyList.value[idx],
587
595
  });
596
+ turns.value += 1;
588
597
  }
589
598
  scrollToEnd();
590
599
  break;
@@ -6,6 +6,12 @@ import { showToast } from 'vant';
6
6
  import { Field } from 'vant';
7
7
 
8
8
  const showPopup = ref(false);
9
+ const props = defineProps({
10
+ query: {
11
+ type: String,
12
+ default: '',
13
+ },
14
+ });
9
15
 
10
16
  const dialogInfo = ref({
11
17
  key: 'sex',
@@ -275,7 +281,8 @@ const handleSubmit = () => {
275
281
  }
276
282
 
277
283
  localStorage.setItem('personalInfo', JSON.stringify(pfForm.value));
278
- const msg = `性别:${pfForm.value.find((item) => item.key === 'sex').value};
284
+ const msg = `${props.query};
285
+ 性别:${pfForm.value.find((item) => item.key === 'sex').value};
279
286
  年龄:${pfForm.value[ageIdx].value}${pfForm.value[ageIdx].unit || ''};
280
287
  身高:${pfForm.value[heightIdx].value}${pfForm.value[heightIdx].unit || ''};
281
288
  体重:${pfForm.value[weightIdx].value}${pfForm.value[weightIdx].unit || ''};