Show recorded OpenCode models in the chat list

This commit is contained in:
2026-11-05 13:42:01 +00:00
parent f5bf8ada8a
commit af178b83a1
7 changed files with 433 additions and 5 deletions
+10 -5
View File
@@ -42,11 +42,13 @@ type Chat struct {
// operation and status on the shared connection, so two calls must not
// overlap; the permission poller runs alongside the read loop's
// prompt/interrupt/reply calls.
mu sync.Mutex
usageMu sync.Mutex
usageModels map[string]usageModelCache
modeMu sync.Mutex
agents map[string]string
mu sync.Mutex
usageMu sync.Mutex
usageModels map[string]usageModelCache
modeMu sync.Mutex
agents map[string]string
modelMu sync.Mutex
sessionModels map[string]sessionModelCache
}
// NewChat brokers chat for one owned OpenCode endpoint. The connection must be
@@ -234,6 +236,9 @@ func (c *Chat) SwitchModel(ctx context.Context, id, provider, model string) erro
}
return err
}
c.modelMu.Lock()
delete(c.sessionModels, id)
c.modelMu.Unlock()
return nil
}