ai-chat-bot-interface 1.2.1 → 1.2.3

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.2.1",
4
+ "version": "1.2.3",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "description": "A AI chat bot interface. (private)",
package/src/App.vue CHANGED
@@ -4,7 +4,7 @@ import ChatUi from './ChatUi.vue';
4
4
 
5
5
  <template>
6
6
  <div style="width: 100vw; height: 100vh">
7
- <chat-ui bot-id="000" token="pat_8888" uid="262598" :show-header="true" />
7
+ <chat-ui bot-id="000" token="pat_88888" uid="262598" :show-header="true" />
8
8
  </div>
9
9
  </template>
10
10
  <style></style>
package/src/ChatUi.vue CHANGED
@@ -77,6 +77,7 @@
77
77
  <dishes-list
78
78
  v-if="comp.showType === 'card'"
79
79
  :sku-list="comp.skuList"
80
+ :is-mini="!showHeader"
80
81
  @select="(data) => handleCardTap(data, comp)"
81
82
  />
82
83
  <plan-card
@@ -576,8 +577,15 @@ const handleCardTap = ({ type }, info) => {
576
577
  }
577
578
  };
578
579
  const handleCall = (data) => {
579
- console.log(data);
580
- Emits('call', data);
580
+ switch (data.type) {
581
+ case 'new_chat':
582
+ createConv();
583
+ break;
584
+ default:
585
+ Emits('call', data);
586
+
587
+ break;
588
+ }
581
589
  };
582
590
 
583
591
  const handlePlanParse = (list) => {
@@ -20,7 +20,12 @@
20
20
  </div>
21
21
  </div>
22
22
  </template>
23
- <div class="btn_group">
23
+ <div v-if="isMini" class="btn_group">
24
+ <div class="btn btn_2" @click.stop="handleBtn('ship_order')">
25
+ <span class="name">立即下单</span>
26
+ </div>
27
+ </div>
28
+ <div v-else class="btn_group">
24
29
  <div class="btn btn_1" @click.stop="handleBtn('ship_order')">
25
30
  <span class="name">配送下單</span>
26
31
  <span class="sub">(直送到府)</span>
@@ -42,6 +47,10 @@ const props = defineProps({
42
47
  required: true,
43
48
  default: () => [],
44
49
  },
50
+ isMini: {
51
+ type: Boolean,
52
+ default: false,
53
+ },
45
54
  });
46
55
  const Emits = defineEmits(['select']);
47
56
 
@@ -103,9 +112,8 @@ const handleBtn = (type) => {
103
112
  background-color: @primary-color;
104
113
  }
105
114
  &_group {
106
- display: grid;
107
- grid-template-columns: 1fr 1fr;
108
- grid-column-gap: 10px;
115
+ .flexrbc();
116
+ gap: 10px;
109
117
  margin-top: 20px;
110
118
  }
111
119
  }
@@ -12,7 +12,7 @@
12
12
  </div>
13
13
  </div>
14
14
  <div class="om_operate_box">
15
- <div v-if="newChat" class="new_chat">
15
+ <div v-if="newChat" class="new_chat" @click.stop="newChatFunc">
16
16
  <new-chat />
17
17
  </div>
18
18
  <div class="om_operate_wrap">
@@ -196,6 +196,7 @@ const sendMsg = () => {
196
196
  ) {
197
197
  Emits('call', {
198
198
  message: '文件正在上傳,請稍候...',
199
+ reason: 'is_uploading',
199
200
  value: 'toast',
200
201
  type: 'call',
201
202
  });
@@ -301,6 +302,12 @@ const clearFile = (idx) => {
301
302
  uploadInput.value ? (uploadInput.value.value = '') : '';
302
303
  };
303
304
 
305
+ const newChatFunc = () => {
306
+ Emits('call', {
307
+ type: 'new_chat',
308
+ });
309
+ };
310
+
304
311
  const resizeTextarea = () => {
305
312
  nextTick(() => {
306
313
  if (txtEle.value) {