feat: improve error handling and cancellation behavior in AI assistant

- Display error (include exception) in current window
- Improve cancellation behavior to preserve current `IsGenerating` state for proper UI updates

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo
2026-03-25 15:24:49 +08:00
parent 446c806246
commit e6bfff81c2

View File

@@ -57,11 +57,16 @@ namespace SourceGit.ViewModels
}
catch (OperationCanceledException)
{
// Do nothing
// Do nothing and leave `IsGenerating` to current (may already changed), so that the UI can update accordingly.
return;
}
catch (Exception e)
{
App.RaiseException(_repo, e.Message);
builder
.AppendLine()
.AppendLine("[ERROR]")
.Append(e.Message);
Text = builder.ToString();
}
IsGenerating = false;