|
379 | 379 | @click="messageStore.sendMessage" icon="mdi-arrow-up"> |
380 | 380 | </v-btn> |
381 | 381 | <v-btn v-else-if="messageStore.generating" size="small" color="primary" variant="elevated" |
382 | | - @click="messageStore.stop" |
383 | | - icon="mdi-stop"></v-btn> |
| 382 | + @click="messageStore.stop" icon="mdi-stop"></v-btn> |
384 | 383 | <v-btn v-else-if="messageStore.conversation.length > 0" size="small" color="primary" |
385 | 384 | variant="elevated" @click="messageStore.resendMessage" icon="mdi-autorenew"></v-btn> |
386 | 385 | <v-btn v-else size="small" color="grey" variant="elevated" icon="mdi-arrow-up"> |
@@ -764,18 +763,13 @@ <h5 class="font-weight-bold">{{ column.key }}</h5> |
764 | 763 | </v-avatar> |
765 | 764 | <tuui-chat-card :index="index" :messages="messages" :show-content="true"> |
766 | 765 | <template v-slot:default="{ showcontent }"> |
767 | | - <div v-if="showcontent"> |
768 | | - <v-card-text class="md-preview pt-1"> |
769 | | - <v-textarea class="conversation-area" variant="plain" density='compact' |
770 | | - auto-grow hide-details rows="1" readonly |
771 | | - v-model="message.content"></v-textarea> |
772 | | - </v-card-text> |
773 | | - </div> |
774 | | - <div v-else> |
775 | | - <md-preview :model-value="message.content" class="md-preview" |
776 | | - :language="language == 'zhHans' ? 'zh-CN' : 'en-US'" :code-foldable="true" |
777 | | - auto-fold-threshold="Infinity"></md-preview> |
778 | | - </div> |
| 766 | + <v-card-text v-if="showcontent" class="md-preview pt-1"> |
| 767 | + <v-textarea class="conversation-area" variant="plain" density='compact' auto-grow |
| 768 | + hide-details rows="1" readonly v-model="message.content"></v-textarea> |
| 769 | + </v-card-text> |
| 770 | + <md-preview v-else :model-value="message.content" class="md-preview" |
| 771 | + :language="language == 'zhHans' ? 'zh-CN' : 'en-US'" :code-foldable="true" |
| 772 | + auto-fold-threshold="Infinity"></md-preview> |
779 | 773 | </template> |
780 | 774 | </tuui-chat-card> |
781 | 775 | </div> |
@@ -1176,7 +1170,7 @@ <h5 class="font-weight-bold">{{ column.key }}</h5> |
1176 | 1170 | } |
1177 | 1171 | }, |
1178 | 1172 | stop() { |
1179 | | - this.generating = false, |
| 1173 | + this.generating = false; |
1180 | 1174 | snackbarStore.showInfoMessage('$vuetify.dataIterator.snackbar.stopped') |
1181 | 1175 | }, |
1182 | 1176 | clear() { |
@@ -1409,7 +1403,7 @@ <h5 class="font-weight-bold">{{ column.key }}</h5> |
1409 | 1403 | }); |
1410 | 1404 |
|
1411 | 1405 | const chatbotStore = useChatbotStore(); |
1412 | | - |
| 1406 | + |
1413 | 1407 | const settingStore = useSettingStore(); |
1414 | 1408 | const agentStore = useAgentStore(); |
1415 | 1409 | const messageStore = useMessageStore(); |
@@ -1486,9 +1480,11 @@ <h5 class="font-weight-bold">{{ column.key }}</h5> |
1486 | 1480 | let buffer = '' |
1487 | 1481 |
|
1488 | 1482 | // Read the stream |
1489 | | - read(reader, messageStore.conversation[messageStore.conversation.length - 1], buffer, chatbotStore.stream); |
| 1483 | + await read(reader, messageStore.conversation[messageStore.conversation.length - 1], buffer, chatbotStore.stream); |
1490 | 1484 | } catch (error) { |
1491 | 1485 | snackbarStore.showErrorMessage(error.message); |
| 1486 | + } finally { |
| 1487 | + messageStore.generating = false |
1492 | 1488 | } |
1493 | 1489 | }; |
1494 | 1490 |
|
@@ -1585,9 +1581,9 @@ <h5 class="font-weight-bold">{{ column.key }}</h5> |
1585 | 1581 | } |
1586 | 1582 | }; |
1587 | 1583 |
|
1588 | | - watch(computed(() => messageStore.conversation), |
| 1584 | + watch(computed(() => messageStore.conversation[messageStore.conversation.length - 1]?.content), |
1589 | 1585 | (newValue, oldValue) => { |
1590 | | - if (newValue[newValue.length - 1] !== oldValue[oldValue.length - 1]) { |
| 1586 | + if (newValue !== oldValue) { |
1591 | 1587 | asyncScrollToBottom(); |
1592 | 1588 | } |
1593 | 1589 | }, { deep: true }); |
|
0 commit comments