fix(tui): update welcome banner model name on model_changed event
The welcome banner (WelcomeComponent) captures the session's active model name at init time but never receives updates when the model changes. Its setModel() method already existed but was never called after construction. This wires the model_changed agent session event to a new #updateWelcomeModel() method in InteractiveMode, mirroring the existing #updateWelcomeLspServers() pattern. The banner now reflects the live model after: - delayed config/modelRoles load (the startup race where an alphabetically-first provider is picked before config resolves) - explicit /model switches - retry-fallback model swaps
This commit is contained in:
@@ -62,3 +62,21 @@ describe("WelcomeComponent tips", () => {
|
||||
expect(pickWeightedTip([], 0.5)).toBe("");
|
||||
});
|
||||
});
|
||||
|
||||
describe("WelcomeComponent model name", () => {
|
||||
beforeAll(async () => {
|
||||
await Settings.init({ inMemory: true });
|
||||
await initTheme(false);
|
||||
});
|
||||
|
||||
it("updates the rendered model name after setModel()", () => {
|
||||
const welcome = new WelcomeComponent("1.0.0", "DeepSeek V4 Pro", "deepseek");
|
||||
const before = welcome.render(100).join("\n");
|
||||
expect(before).toContain("DeepSeek V4 Pro");
|
||||
|
||||
welcome.setModel("GLM-5.2", "zhipu-coding-plan");
|
||||
const after = welcome.render(100).join("\n");
|
||||
expect(after).toContain("GLM-5.2");
|
||||
expect(after).not.toContain("DeepSeek V4 Pro");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user