Merge pull request #354 from charmbracelet/prevent_model_switch

Kujtim Hoxha created

chore: prevent switching the model while agent is working

Change summary

internal/tui/tui.go | 3 +++
1 file changed, 3 insertions(+)

Detailed changes

internal/tui/tui.go 🔗

@@ -180,6 +180,9 @@ func (a *appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 		return a, a.handleWindowResize(a.wWidth, a.wHeight)
 	// Model Switch
 	case models.ModelSelectedMsg:
+		if a.app.CoderAgent.IsBusy() {
+			return a, util.ReportWarn("Agent is busy, please wait...")
+		}
 		config.Get().UpdatePreferredModel(msg.ModelType, msg.Model)
 
 		// Update the agent with the new model/provider configuration