fix: abort model retries immediately on user cancellation
This commit is contained in:
@@ -100,6 +100,9 @@ export class NativeAgent {
|
||||
|
||||
async process(userMessage: string, attachments?: Attachment[]): Promise<string> {
|
||||
this._cancelRequested = false;
|
||||
if ('clearAbort' in this.modelClient && typeof this.modelClient.clearAbort === 'function') {
|
||||
this.modelClient.clearAbort();
|
||||
}
|
||||
this._runInProgress = true;
|
||||
|
||||
// Detect and strip !!think prefix for per-message thinking mode
|
||||
@@ -541,6 +544,9 @@ export class NativeAgent {
|
||||
cancel(): void {
|
||||
if (this._runInProgress) {
|
||||
this._cancelRequested = true;
|
||||
if ('requestAbort' in this.modelClient && typeof this.modelClient.requestAbort === 'function') {
|
||||
this.modelClient.requestAbort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user