ai-chat-bot-interface 1.0.4 → 1.0.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.0.4",
4
+ "version": "1.0.6",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "description": "A AI chat bot interface. (private)",
package/src/App.vue CHANGED
@@ -4,12 +4,9 @@ import ChatUi from './ChatUi.vue'
4
4
 
5
5
  <template>
6
6
  <div style="width: 100vw; height: 100vh;">
7
- <chat-ui
8
- name="Nutribite智能營養師"
9
- bot-id="7471093458661720104"
10
- token="pat_2yVcSFJUZB6c9Kdcv9iktIVFeGRuzyK3bAJY6GcqKrdGxTdjKMd1iDB09ipJ6YX8"
11
- logo="https://prodstatic.weis1606.cn/api/smartFood/Nutribite/icons/nutribite_logo.png"
12
- uid="9396"
7
+ <chat-ui bot-id="123132132"
8
+ token="pat_123"
9
+ uid="5555"
13
10
  />
14
11
  </div>
15
12
  </template>
package/src/ChatUi.vue CHANGED
@@ -44,8 +44,8 @@
44
44
  <p class="text" v-html="conv.content"></p>
45
45
  <div v-if="conv.extra.length && !isAnswering">
46
46
  <template v-for="(comp, idx) in conv.extra" :key="idx">
47
- <dishes-list v-if="comp.showType === 'card'" :sku-list="comp.skuList" @select="handleCardTap"/>
48
- <plan-card v-if="comp.showType === 'plan'" @select="handleCardTap({ type: 'match'})" />
47
+ <dishes-list v-if="comp.showType === 'card'" :sku-list="comp.skuList" @select="(data) => handleCardTap(data, comp)"/>
48
+ <plan-card v-if="comp.showType === 'plan'" @select="handleCardTap({ type: 'match'}, comp)" />
49
49
  </template>
50
50
  </div>
51
51
  </div>
@@ -61,7 +61,7 @@
61
61
  <img class="avatar" :src="avatar" alt="avatar">
62
62
  </div>
63
63
  </template>
64
- <div ref="endTarget" style="height: 100px;"/>
64
+
65
65
  </div>
66
66
  <div class="cui_operate">
67
67
  <button class="btn" @click.stop="createConv">
@@ -135,7 +135,7 @@ const props = defineProps({
135
135
 
136
136
  const Emits = defineEmits(['call']);
137
137
 
138
- const endTarget = ref(null);
138
+ // const endTarget = ref(null);
139
139
  const inputText = ref('');
140
140
  const botInfo = ref({});
141
141
 
@@ -386,7 +386,7 @@ const handleText = (str) => {
386
386
  return str.replaceAll(/\[([^\]]+)\]\((https?:\/\/[^)]+)\)/ig, '<a href="$2" target="_blank">[$1]</a>');
387
387
  };
388
388
 
389
- const handleCardTap = ({type}) => {
389
+ const handleCardTap = ({ type }, info) => {
390
390
  switch (type) {
391
391
  case 'change':
392
392
  chatConv({code: '換一套菜品', text: '換一套菜品'});
@@ -395,14 +395,14 @@ const handleCardTap = ({type}) => {
395
395
  chatConv({code: '請用以上方案為我配餐', text: '請用以上方案為我配餐'});
396
396
  break;
397
397
  default:
398
- Emits('call', { type });
398
+ Emits('call', { type, info });
399
399
  }
400
400
  };
401
401
 
402
402
  const scrollToEnd = () => {
403
- nextTick(() => {
404
- endTarget.value.scrollIntoView();
405
- });
403
+ // nextTick(() => {
404
+ // endTarget.value.scrollIntoView();
405
+ // });
406
406
  };
407
407
  </script>
408
408