retry method
Resends the prompt from the last send call that failed.
A safe no-op — completes immediately without sending anything — when there is nothing to retry: no prompt has been attempted yet, the last attempt did not fail (error is null, so there is nothing to redo), or a turn is already streaming. This mirrors send's own style of quietly ignoring a call that does not apply rather than throwing, so a "Retry" button wired straight to this method never needs a guard of its own around whether retrying currently makes sense.
This exists because a failed turn leaves nothing in messages to retry from: ChatGptSession.send unwinds the user turn it staged out of history on failure (so a caller resending the same text after a failure never duplicates it), which means the prompt itself does not survive the failure anywhere the controller could read it back from. retry resends the prompt this controller itself remembered from the original send call.
Implementation
Future<void> retry() async {
final prompt = _lastPrompt;
if (prompt == null || _error == null || _isStreaming) return;
return send(prompt);
}