MCPcopy Create free account
hub / github.com/diillson/chatcli / readRuntimeModelState

Function readRuntimeModelState

cli/gateway_runtime_model.go:74–84  ·  view source on GitHub ↗

readRuntimeModelState loads the persisted snapshot. ok=false when the file is absent or malformed (no override → caller keeps its current model).

()

Source from the content-addressed store, hash-verified

72// readRuntimeModelState loads the persisted snapshot. ok=false when the file is
73// absent or malformed (no override → caller keeps its current model).
74func readRuntimeModelState() (runtimeModelState, bool) {
75 data, err := os.ReadFile(runtimeModelStatePath()) // #nosec G304 -- daemon-scoped state dir
76 if err != nil {
77 return runtimeModelState{}, false
78 }
79 var s runtimeModelState
80 if err := json.Unmarshal(data, &s); err != nil || s.Provider == "" || s.Model == "" {
81 return runtimeModelState{}, false
82 }
83 return s, true
84}
85
86// refreshGatewayModel re-reads the shared runtime-model state and rebuilds the
87// LLM client when the interactive session has switched models since the daemon

Callers 1

refreshGatewayModelMethod · 0.85

Calls 1

runtimeModelStatePathFunction · 0.85

Tested by

no test coverage detected