Skip to content

Commit

Permalink
fix: content duplicate when retry #16
Browse files Browse the repository at this point in the history
  • Loading branch information
OrenZhang committed Feb 4, 2024
1 parent 8999ac8 commit 7a5276a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/ChatInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,20 @@ const reGenerate = () => {
if (!props.localMessages.length) {
return;
}
const willingLength = props.localMessages.slice(0, props.localMessages.length - 2).length;
emits('setChatLoading', true);
emits('replaceMessages', props.localMessages.slice(0, props.localMessages.length - 2));
promptForm.value.content = props.localMessages[props.localMessages.length -2].content;
doChat();
checkForRegenerate(willingLength);
};
const checkForRegenerate = (willingLength) => {
setTimeout(() => {
if (props.localMessages.length === willingLength) {
doChat();
} else {
checkForRegenerate();
}
}, 500 );
};
// auto submit
Expand Down

0 comments on commit 7a5276a

Please sign in to comment.