ai-chat-bot-interface 1.6.3 → 1.6.6

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.3",
4
+ "version": "1.6.6",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "description": "A AI chat bot interface. (private)",
package/src/App.vue CHANGED
@@ -1,17 +1,30 @@
1
1
  <script setup>
2
2
  import ChatUi from './ChatUi.vue';
3
+ const handleLog = (log) => {
4
+ console.log('== message log ==', log);
5
+ };
3
6
  </script>
4
7
 
5
8
  <template>
6
9
  <div style="width: 100vw; height: 100vh">
7
10
  <chat-ui
8
- bot-id="7572460298389962778"
9
- token="sat_cSmj7ZyuePbkEpOKR7F259YuIfp2fjX9rJ3Om2O0gB9JzrGjAk8pSL269rbu8kzr"
11
+ bot-id="555"
12
+ token="2222"
10
13
  uid="262598"
11
14
  :def-msg="{ placeholder: '发消息...' }"
12
- :show-header="true"
13
- :card-list="{dishes: false}"
14
- content-tye="markdown"
15
+ :show-header="false"
16
+ :card-list="{ dishes: true, personalForm: true }"
17
+ :tag-list="[
18
+ {
19
+ name: '用户信息',
20
+ value: 'personalForm',
21
+ type: 'chat',
22
+ msg: '请为我生成一份个性化的健康的食谱。',
23
+ },
24
+ ]"
25
+ :need-log="true"
26
+ content-type="markdown"
27
+ @log="handleLog"
15
28
  />
16
29
  </div>
17
30
  </template>
package/src/ChatUi.vue CHANGED
@@ -308,6 +308,10 @@ const props = defineProps({
308
308
  type: Boolean,
309
309
  default: false,
310
310
  },
311
+ firstMsg: {
312
+ type: String,
313
+ default: '',
314
+ },
311
315
  });
312
316
 
313
317
  const Emits = defineEmits(['call', 'log']);
@@ -350,6 +354,9 @@ onMounted(async () => {
350
354
  isFirst.value = false;
351
355
  } else {
352
356
  await createConv();
357
+ if (props.firstMsg) {
358
+ await chatConv([{ content: props.firstMsg, text: props.firstMsg }]);
359
+ }
353
360
  }
354
361
  scrollToEnd();
355
362
  });
@@ -527,9 +534,14 @@ const chatConv = async (data) => {
527
534
  const handlePersonalForm = () => {
528
535
  console.log('======= End ======', historyList.value, isFirst.value);
529
536
  if (isFirst.value) {
530
- historyList.value[idx].extra.push({ showType: 'personalForm' });
537
+ if (
538
+ historyList.value[idx].extra.findIndex(
539
+ (item) => item.showType === 'personalForm',
540
+ ) === -1
541
+ ) {
542
+ historyList.value[idx].extra.push({ showType: 'personalForm' });
543
+ }
531
544
  isFirst.value = false;
532
-
533
545
  console.log('===============', historyList.value[idx]);
534
546
  }
535
547
  };
@@ -351,7 +351,7 @@ const selectTag = (item, type) => {
351
351
  justify-content: space-between;
352
352
  border-bottom: 1px solid #dadada;
353
353
  height: 54px;
354
- line-height: 54px;
354
+ line-height: 24px;
355
355
 
356
356
  &:last-child {
357
357
  border-bottom: none;