Skip to content

Commit dfef9dc

Browse files
committed
fix repeated prompt when completing an answer and clicking the retry button (#400)
1 parent fc93ccc commit dfef9dc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/components/ConversationCard/index.jsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,15 @@ function ConversationCard(props) {
211211
updateAnswer(`<p class="gpt-loading">${t('Waiting for response...')}</p>`, false, 'answer')
212212
setIsReady(false)
213213

214+
if (session.conversationRecords.length > 0) {
215+
const lastRecord = session.conversationRecords[session.conversationRecords.length - 1]
216+
if (
217+
conversationItemData[conversationItemData.length - 1].done &&
218+
lastRecord.question === conversationItemData[conversationItemData.length - 2].content
219+
) {
220+
session.conversationRecords.pop()
221+
}
222+
}
214223
const newSession = { ...session, isRetry: true }
215224
setSession(newSession)
216225
try {

0 commit comments

Comments
 (0)