style(styles): 优化聊天界面用户体验

This commit is contained in:
ronger 2024-05-29 10:26:38 +08:00
parent 1dd347582e
commit 373c2d5bd0

View File

@ -197,6 +197,7 @@ export default {
return a.dataId - b.dataId;
});
_ts.contentEditor.setValue('')
_ts.scrollToBottom();
_ts.$axios.$post('/api/openai/new-chat', _ts.messages).then(async res => {
const html = await Vue.Vditor.md2html(_ts.message, {
cdn: apiConfig.VDITOR
@ -213,6 +214,7 @@ export default {
return a.dataId - b.dataId;
});
_ts.message = '';
_ts.scrollToBottom();
});
},
close() {
@ -243,14 +245,23 @@ export default {
},
//message
handleMessage(res) {
let _ts = this;
if (typeof res !== "undefined") {
this.message += res;
_ts.message += res;
_ts.scrollToBottom();
}
},
//handleCustomEvents
handleCustomEvents(res) {
let {data} = res;
this.customEvents = data;
},
scrollToBottom() {
setTimeout(() => {
// DOM
let container = document.getElementById("messagesContent");
container.scrollTop = container.scrollHeight;
}, 100);
}
},
async mounted() {