MCPcopy Index your code
hub / github.com/codehamr/codehamr / rebuildClient

Method rebuildClient

internal/tui/slash.go:187–196  ·  view source on GitHub ↗

rebuildClient swaps in a fresh llm.Client for the now-active profile. Replacing the pointer (not mutating fields) drops the prior Client's sticky state (noReasoningEffort, keep-alive pool tied to the old URL): new endpoint, fresh slate.

()

Source from the content-addressed store, hash-verified

185// rebuildClient swaps in a fresh llm.Client for the now-active profile.
186// Replacing the pointer (not mutating fields) drops the prior Client's sticky
187// state (noReasoningEffort, keep-alive pool tied to the old URL): new
188// endpoint, fresh slate.
189func (m *Model) rebuildClient() {
190 p := m.cfg.ActiveProfile()
191 m.cli = llm.New(m.cfg.ActiveURL(), p.LLM, p.ResolvedKey())
192 // Drop the prior profile's cached BudgetStatus. m.budget has no profile
193 // association, so without this reset the footer keeps rendering the old
194 // "88% pass" segment after switching to a local profile that emits no
195 // X-Budget-* headers (nothing would overwrite it). A fresh BudgetStatus{}
196 // hides the segment until the new backend reports its own.
197 m.budget = cloud.BudgetStatus{}
198}
199

Callers 3

reloadConfigFromDiskMethod · 0.95
cmdModelMethod · 0.95
activateHamrpassMethod · 0.95

Calls 4

NewFunction · 0.92
ActiveProfileMethod · 0.80
ActiveURLMethod · 0.80
ResolvedKeyMethod · 0.80

Tested by

no test coverage detected