TestSlashModelSwitchesActive: /models sets Active and rebuilds the llm client's base URL / token / model to the new profile's values.
(t *testing.T)
| 591 | // TestSlashModelSwitchesActive: /models <name> sets Active and rebuilds the |
| 592 | // llm client's base URL / token / model to the new profile's values. |
| 593 | func TestSlashModelSwitchesActive(t *testing.T) { |
| 594 | m := newTestModel(t, func(http.ResponseWriter, *http.Request) {}) |
| 595 | m.cfg.Models["remote"] = &config.Profile{ |
| 596 | LLM: "cloud-model", URL: "http://remote:9000", Key: "sk-r", ContextSize: 200000, |
| 597 | } |
| 598 | if err := m.cfg.Save(); err != nil { |
| 599 | t.Fatal(err) |
| 600 | } |
| 601 | m2, _ := m.runSlash("/models remote") |
| 602 | final := m2.(Model) |
| 603 | if final.cfg.Active != "remote" { |
| 604 | t.Fatalf("Active should be 'remote', got %q", final.cfg.Active) |
| 605 | } |
| 606 | if final.cli.BaseURL != "http://remote:9000" { |
| 607 | t.Fatalf("client.BaseURL not rebuilt: %q", final.cli.BaseURL) |
| 608 | } |
| 609 | if final.cli.Model != "cloud-model" { |
| 610 | t.Fatalf("client.Model not rebuilt: %q", final.cli.Model) |
| 611 | } |
| 612 | if final.cli.Token != "sk-r" { |
| 613 | t.Fatalf("client.Token not rebuilt: %q", final.cli.Token) |
| 614 | } |
| 615 | } |
| 616 | |
| 617 | // TestRedactSlashHidesHamrpassKey: with `logging: true`, every prompt (including |
| 618 | // `/hamrpass <key>`) is written to .codehamr/log.txt. The log is meant to be |
nothing calls this directly
no test coverage detected