Fix conversation issue (#29)
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"type": "patch",
|
||||
"comment": "fix conversation display issue",
|
||||
"packageName": "@acedatacloud/hub",
|
||||
"email": "cqc@cuiqingcai.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -125,6 +125,8 @@ export const getConversations = async ({
|
||||
resolve(conversations);
|
||||
})
|
||||
.catch((error) => {
|
||||
state.status.getConversations = Status.Error;
|
||||
commit('setConversations', []);
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user