diff --git a/src/Capacitor.App/ViewModels/ChatTabViewModel.cs b/src/Capacitor.App/ViewModels/ChatTabViewModel.cs index 1b00521591..66baf3f245 100644 --- a/src/Capacitor.App/ViewModels/ChatTabViewModel.cs +++ b/src/Capacitor.App/ViewModels/ChatTabViewModel.cs @@ -394,6 +394,9 @@ public IReadOnlyList TerminalMenuChoices { /// hides them and leaves the hint — a greyed empty box is the wrong affordance. public bool ShowsComposer => _showsComposer.Value; + readonly ObservableAsPropertyHelper _showsInterrupt; + public bool ShowsInterrupt => _showsInterrupt.Value; + string _vendor = ""; IReadOnlyList _options = HostedHarnessCatalog.Build(null); @@ -670,6 +673,18 @@ public ChatTabViewModel( }) .DisposeWith(_disposables); + _showsInterrupt = Observable.CombineLatest( + _input.WhenAnyValue(i => i.CanInterrupt), + this.WhenAnyValue(x => x.IsReadOnlyParticipant), + this.WhenAnyValue(x => x.HasTerminalMenu), + this.WhenAnyValue(x => x.AgentStatus), + (can, readOnly, menu, status) => can && !readOnly && !menu + && (status.Kind == AgentStatusKind.Working || status.IsRunningUnknownTurn)) + .ToProperty(this, x => x.ShowsInterrupt, + initialValue: _input.CanInterrupt && !IsReadOnlyParticipant && !HasTerminalMenu + && (AgentStatus.Kind == AgentStatusKind.Working || AgentStatus.IsRunningUnknownTurn)) + .DisposeWith(_disposables); + // The banner carries the read-only explanation for a flow participant, so the hint // goes blank there instead of offering a reply that can never be sent. _composerHint = Observable.CombineLatest( @@ -783,11 +798,8 @@ public ChatTabViewModel( }); _disposables.Add(SendQueuedCommand); - var canInterrupt = Observable.CombineLatest( - _input.WhenAnyValue(i => i.CanInterrupt), - this.WhenAnyValue(x => x.IsReadOnlyParticipant), - (can, readOnly) => can && !readOnly); - InterruptCommand = ReactiveCommand.CreateFromTask(() => _input.InterruptAsync(_lifetimeToken), canInterrupt); + InterruptCommand = ReactiveCommand.CreateFromTask( + () => _input.InterruptAsync(_lifetimeToken), this.WhenAnyValue(x => x.ShowsInterrupt)); _disposables.Add(InterruptCommand); OpenLinkCommand = ReactiveCommand.Create(url => LinkPolicy.Open(_opener, url)); diff --git a/src/Capacitor.App/Views/ChatTabView.axaml b/src/Capacitor.App/Views/ChatTabView.axaml index 6aba036fb6..b01442766f 100644 --- a/src/Capacitor.App/Views/ChatTabView.axaml +++ b/src/Capacitor.App/Views/ChatTabView.axaml @@ -433,7 +433,7 @@ - +