Skip to content

Commit 92cbf31

Browse files
authored
Fix waylaidwanderer#527, Also, specific message types can now be handled in onProgress.
1 parent a424398 commit 92cbf31

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/BingAIClient.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,15 +458,16 @@ export default class BingAIClient {
458458
return;
459459
}
460460
// get the difference between the current text and the previous text
461-
const difference = updatedText.substring(replySoFar.length);
462-
onProgress(difference);
461+
const difference = messages[0].messageType ? updatedText : updatedText.substring(replySoFar.length);
462+
onProgress(difference, messages[0].messageType);
463463
if (updatedText.trim().endsWith(stopToken)) {
464464
stopTokenFound = true;
465465
// remove stop token from updated text
466466
replySoFar = updatedText.replace(stopToken, '').trim();
467467
return;
468468
}
469-
replySoFar = updatedText;
469+
if(!messages[0].messageType)
470+
replySoFar = updatedText;
470471
return;
471472
}
472473
case 2: {

0 commit comments

Comments
 (0)