pi-web icon indicating copy to clipboard operation
pi-web copied to clipboard

fix: reload ModelRuntime config before set_model to pick up newly added providers

Open kerwin2046 opened this issue 4 months ago • 0 comments

Bug: When switching models in the same session, the cached AgentSessionWrapper's ModelRuntime never re-reads ~/.pi/agent/models.json. If a custom provider was added after session creation, getModel() returns undefined → "Model not found" error. Fix: Call modelRuntime.reloadConfig() before getModel() in the set_model handler so the config is reloaded from disk on every model switch. Added reloadConfig/refresh to the AgentSessionLike type to pass typecheck.

kerwin2046 avatar Jul 24 '26 07:07 kerwin2046