File tree Expand file tree Collapse file tree 2 files changed +40
-18
lines changed
Expand file tree Collapse file tree 2 files changed +40
-18
lines changed Original file line number Diff line number Diff line change @@ -95,16 +95,27 @@ struct BashQuickView: View {
9595 . glassEffect ( in: . rect( cornerRadius: 20 ) )
9696 . disabled ( viewModel. isRunning)
9797
98- Button {
99- isInputFocused = false
100- viewModel. send ( apiClient: apiClient)
101- } label: {
102- Image ( systemName: " arrow.up.circle.fill " )
103- . font ( . title2)
98+ if viewModel. isRunning {
99+ Button {
100+ viewModel. cancel ( apiClient: apiClient)
101+ } label: {
102+ Image ( systemName: " stop.circle.fill " )
103+ . font ( . title2)
104+ }
105+ . tint ( . red)
106+ . buttonStyle ( . glass)
107+ } else {
108+ Button {
109+ isInputFocused = false
110+ viewModel. send ( apiClient: apiClient)
111+ } label: {
112+ Image ( systemName: " arrow.up.circle.fill " )
113+ . font ( . title2)
114+ }
115+ . tint ( viewModel. command. trimmingCharacters ( in: . whitespacesAndNewlines) . isEmpty ? . gray : Color ( " AccentColor " ) )
116+ . disabled ( viewModel. command. trimmingCharacters ( in: . whitespacesAndNewlines) . isEmpty)
117+ . buttonStyle ( . glass)
104118 }
105- . tint ( viewModel. command. trimmingCharacters ( in: . whitespacesAndNewlines) . isEmpty ? . gray : Color ( " AccentColor " ) )
106- . disabled ( viewModel. command. trimmingCharacters ( in: . whitespacesAndNewlines) . isEmpty || viewModel. isRunning)
107- . buttonStyle ( . glass)
108119 }
109120 . padding ( . horizontal)
110121 . padding ( . vertical, 8 )
Original file line number Diff line number Diff line change @@ -60,16 +60,27 @@ struct QuickChatView: View {
6060 . glassEffect ( in: . rect( cornerRadius: 20 ) )
6161 . disabled ( viewModel. isStreaming)
6262
63- Button {
64- isInputFocused = false
65- viewModel. send ( apiClient: apiClient)
66- } label: {
67- Image ( systemName: " arrow.up.circle.fill " )
68- . font ( . title2)
63+ if viewModel. isStreaming {
64+ Button {
65+ viewModel. cancel ( apiClient: apiClient)
66+ } label: {
67+ Image ( systemName: " stop.circle.fill " )
68+ . font ( . title2)
69+ }
70+ . tint ( . red)
71+ . buttonStyle ( . glass)
72+ } else {
73+ Button {
74+ isInputFocused = false
75+ viewModel. send ( apiClient: apiClient)
76+ } label: {
77+ Image ( systemName: " arrow.up.circle.fill " )
78+ . font ( . title2)
79+ }
80+ . tint ( viewModel. question. trimmingCharacters ( in: . whitespacesAndNewlines) . isEmpty ? . gray : Color ( " AccentColor " ) )
81+ . disabled ( viewModel. question. trimmingCharacters ( in: . whitespacesAndNewlines) . isEmpty)
82+ . buttonStyle ( . glass)
6983 }
70- . tint ( viewModel. question. trimmingCharacters ( in: . whitespacesAndNewlines) . isEmpty ? . gray : Color ( " AccentColor " ) )
71- . disabled ( viewModel. question. trimmingCharacters ( in: . whitespacesAndNewlines) . isEmpty || viewModel. isStreaming)
72- . buttonStyle ( . glass)
7384 }
7485 . padding ( . horizontal)
7586 . padding ( . vertical, 8 )
You can’t perform that action at this time.
0 commit comments