pi-web
pi-web copied to clipboard
fix: reload ModelRuntime config before set_model to pick up newly added providers
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.