Skip to content

Commit

Permalink
Fix waylaidwanderer#527, Also, specific message types can now be hand…
Browse files Browse the repository at this point in the history
…led in onProgress.
  • Loading branch information
somanchiu committed Jan 27, 2024
1 parent a424398 commit 92cbf31
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/BingAIClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,15 +458,16 @@ export default class BingAIClient {
return;
}
// get the difference between the current text and the previous text
const difference = updatedText.substring(replySoFar.length);
onProgress(difference);
const difference = messages[0].messageType ? updatedText : updatedText.substring(replySoFar.length);
onProgress(difference, messages[0].messageType);
if (updatedText.trim().endsWith(stopToken)) {
stopTokenFound = true;
// remove stop token from updated text
replySoFar = updatedText.replace(stopToken, '').trim();
return;
}
replySoFar = updatedText;
if(!messages[0].messageType)
replySoFar = updatedText;
return;
}
case 2: {
Expand Down

0 comments on commit 92cbf31

Please sign in to comment.