Fix conversation issue (#29)

This commit is contained in:
AceDataCloud
2024-04-20 17:26:50 +00:00
parent 623ecbece2
commit ba14947376
3 changed files with 13 additions and 3 deletions
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix conversation display issue",
"packageName": "@acedatacloud/hub",
"email": "cqc@cuiqingcai.com",
"dependentChangeType": "patch"
}
+4 -3
View File
@@ -184,7 +184,7 @@ export default defineComponent({
const token = this.credential?.token;
const question = this.question;
const references = this.references;
log(this.onFetchAnswer, 'validated', question, references);
console.debug('validated', question, references);
// reset question and references
this.question = '';
this.references = [];
@@ -205,7 +205,7 @@ export default defineComponent({
role: ROLE_ASSISTANT,
state: IChatMessageState.PENDING
});
log(this.onFetchAnswer, 'start to get answer', this.messages);
console.debug('start to get answer', this.messages);
this.onScrollDown();
// request server to get answer
this.answering = true;
@@ -221,6 +221,7 @@ export default defineComponent({
{
token,
stream: (response: IChatConversationResponse) => {
console.debug('stream response', response);
this.messages[this.messages.length - 1] = {
role: ROLE_ASSISTANT,
content: response.answer,
@@ -232,7 +233,7 @@ export default defineComponent({
}
)
.then(async () => {
log(this.onFetchAnswer, 'finished fetch answer');
console.debug('finished fetch answer', this.messages);
this.messages[this.messages.length - 1].state = IChatMessageState.FINISHED;
await this.$store.dispatch('chat/setConversation', {
id: conversationId,
+2
View File
@@ -125,6 +125,8 @@ export const getConversations = async ({
resolve(conversations);
})
.catch((error) => {
state.status.getConversations = Status.Error;
commit('setConversations', []);
reject(error);
});
});