Skip to content

Commit

Permalink
feat: limit to 3 retries in a row
Browse files Browse the repository at this point in the history
  • Loading branch information
PeronGH committed Jan 7, 2024
1 parent 0ac734a commit 537d3bb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,12 @@ class Controller extends GetxController {
await _submit(userPrompt);

// handle message revoke
while (messages.last.type == Message.typeError &&
messages.last.content == Message.messageRevoke) {
for (var retries = 0;
retries < 3 &&
messages.isNotEmpty &&
messages.last.type == Message.typeError &&
messages.last.content == Message.messageRevoke;
retries++) {
await _submit(Message.continueFromRevokeMessage);
}

Expand Down

0 comments on commit 537d3bb

Please sign in to comment.