返回 DeepSeek-Reasonix
model_application_actions.go
根目录 / desktop / model_application_actions.go
1 package main
2
3 import (
4 "reasonix/internal/control"
5 )
6
7 // CancelModelApplicationBlockers is a fenced recovery operation, not a generic
8 // kill-all command. The subsequent apply still waits for actual task exit.
9 func (a *App) CancelModelApplicationBlockers(tabID string, choice control.ModelApplicationChoice, ids []string) error {
10 if a.isRemoteTab(tabID) {
11 if err := a.validateRemoteModelConfirmation(tabID, choice); err != nil {
12 return err
13 }
14 return a.remoteTabPost(tabID, "/model-settings/cancel-blockers", map[string]any{"choice": choice, "ids": ids})
15 }
16 a.runtimeRebuildMu.Lock()
17 defer a.runtimeRebuildMu.Unlock()
18 a.mu.RLock()
19 tab := a.tabByEventSinkIDLocked(tabID)
20 a.mu.RUnlock()
21 if tab == nil {
22 return control.ErrModelChoiceStale
23 }
24 if a.tabIsReadOnly(tab) {
25 return readOnlyChannelErr()
26 }
27 tab.turnStartMu.Lock()
28 defer tab.turnStartMu.Unlock()
29 c, ok := a.controllerForTab(tab).(*control.Controller)
30 if !ok {
31 return control.ErrModelChoiceStale
32 }
33 if err := c.ValidateModelApplicationIdentity(choice); err != nil {
34 return newModelApplicationError(c, err)
35 }
36 c.CancelModelApplicationBlockers(ids)
37 return nil
38 }
39
39 lines GO