ai-chat-bot-interface 1.6.26 → 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 +1 -1
- package/src/ChatUi.vue +8 -1
- package/src/components/DishesCard.vue +9 -3
package/package.json
CHANGED
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>
|
|
@@ -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
|
-
|
|
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
|
|