reloadConfigFromDisk re-runs config.Bootstrap and replaces m.cfg so hand-edits to config.yaml between slash commands take effect immediately. URLOverride (from CODEHAMR_URL) is carried across the swap so the env var keeps applying. Returns the Bootstrap error verbatim; callers decide whether to sur
()
| 105 | // Rebuilds the llm.Client when the active profile's resolved (URL, model, key) |
| 106 | // triple changed: covers both within-profile edits and a moved active. |
| 107 | func (m *Model) reloadConfigFromDisk() error { |
| 108 | projectRoot := filepath.Dir(m.cfg.Dir) |
| 109 | fresh, _, err := config.Bootstrap(projectRoot) |
| 110 | if err != nil { |
| 111 | return err |
| 112 | } |
| 113 | fresh.URLOverride = m.cfg.URLOverride |
| 114 | |
| 115 | prevURL := m.cfg.ActiveURL() |
| 116 | prevProfile := m.cfg.ActiveProfile() |
| 117 | prevLLM, prevKey := prevProfile.LLM, prevProfile.ResolvedKey() |
| 118 | |
| 119 | m.cfg = fresh |
| 120 | |
| 121 | newProfile := m.cfg.ActiveProfile() |
| 122 | if prevURL != m.cfg.ActiveURL() || prevLLM != newProfile.LLM || prevKey != newProfile.ResolvedKey() { |
| 123 | m.rebuildClient() |
| 124 | } |
| 125 | return nil |
| 126 | } |
| 127 | |
| 128 | // PrintHelp writes the canonical human-readable command list. Used by --help. |
| 129 | func PrintHelp(out io.Writer) { |
no test coverage detected