ai-chat-bot-interface 1.6.25 → 1.6.27

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.25",
4
+ "version": "1.6.27",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "description": "A AI chat bot interface. (private)",
package/src/ChatUi.vue CHANGED
@@ -181,7 +181,7 @@
181
181
  </template>
182
182
 
183
183
  <script setup>
184
- import { computed, nextTick, onMounted, ref } from 'vue';
184
+ import { computed, nextTick, onMounted, provide, ref } from 'vue';
185
185
  import ClearIcon from './components/icons/ClearIcon.vue';
186
186
  import CloseIcon from './components/icons/CloseIcon.vue';
187
187
  import NewSessionIcon from './components/icons/NewSessionIcon.vue';
@@ -903,6 +903,8 @@ const scrollToEnd = () => {
903
903
  }, 100);
904
904
  };
905
905
 
906
+ provide('triggerScrollToEnd', scrollToEnd);
907
+
906
908
  const handleTextNeedBtn = (str) => {
907
909
  const regExp = /#全日總熱量:(\d*?)kcal/g;
908
910
  return regExp.test(str);
@@ -943,6 +945,11 @@ const simulateChat = (info) => {
943
945
  status: 'ended',
944
946
  extra: [...resInfo.extra],
945
947
  });
948
+ turns.value += 1;
949
+ Emits('log', {
950
+ turns: turns.value,
951
+ info: historyList.value[historyList.value.length - 1],
952
+ });
946
953
  scrollToEnd();
947
954
  };
948
955
  </script>
@@ -75,8 +75,8 @@
75
75
  {{ materialText }}
76
76
  </div>
77
77
  <div class="title">制作工艺</div>
78
- <div v-if="info.skuVideo">
79
- <video :src="info.skuVideo" width="100%" controls="true" />
78
+ <div v-if="makeCraft.makeVideosUrl">
79
+ <video :src="makeCraft.makeVideosUrl" width="100%" controls="true" />
80
80
  </div>
81
81
  <div
82
82
  v-for="(item, index) in makeCraft.makeCraftList"
@@ -103,7 +103,7 @@
103
103
  </template>
104
104
 
105
105
  <script setup>
106
- import { computed, nextTick, onMounted, ref } from 'vue';
106
+ import { computed, inject, nextTick, onMounted, ref } from 'vue';
107
107
  import { api as viewerApi } from 'v-viewer';
108
108
  import 'viewerjs/dist/viewer.css';
109
109
  import ArrowRight from './icons/ArrowRight.vue';
@@ -131,12 +131,17 @@ const makeCraft = ref([]);
131
131
  onMounted(async () => {
132
132
  if (isOpen.value) {
133
133
  await querySkuMakeCraft();
134
- getContentHeight();
134
+ await getContentHeight();
135
+ setTimeout(() => {
136
+ scrollToEnd();
137
+ }, 200);
135
138
  }
136
139
  });
137
140
 
141
+ const scrollToEnd = inject('triggerScrollToEnd');
138
142
  const getContentHeight = () => {
139
- nextTick(async () => {
143
+ return new Promise(async (resolve) => {
144
+ await nextTick();
140
145
  const imgList = [];
141
146
  if (makeCraft.value.hasOwnProperty('makeCraftList')) {
142
147
  makeCraft.value?.makeCraftList.forEach((item) => {
@@ -147,6 +152,7 @@ const getContentHeight = () => {
147
152
  await preloadImages(imgList);
148
153
  contentHeight.value = hasDetails.value ? contentRef.value.scrollHeight : 0;
149
154
  isOpen.value = true;
155
+ resolve();
150
156
  });
151
157
  };
152
158