






















@@ -288,6 +288,78 @@ describe("promptAuthConfig", () => {
288288);
289289});
290290291+it("keeps the selected provider scope when existing config has another provider", async () => {
292+vi.clearAllMocks();
293+mocks.promptAuthChoiceGrouped.mockResolvedValue("github-copilot");
294+mocks.resolvePreferredProviderForAuthChoice.mockResolvedValue("github-copilot");
295+const existingConfig = {
296+agents: {
297+defaults: {
298+model: { primary: "ollama/deepseek-v4-pro" },
299+},
300+},
301+models: {
302+providers: {
303+ollama: {
304+baseUrl: "https://ollama.com",
305+api: "ollama",
306+models: [{ id: "deepseek-v4-pro", name: "deepseek-v4-pro" }],
307+},
308+},
309+},
310+};
311+mocks.applyAuthChoice.mockResolvedValue({ config: existingConfig });
312+mocks.promptModelAllowlist.mockResolvedValue({ models: undefined });
313+mocks.resolveProviderPluginChoice.mockReturnValue(null);
314+315+await promptAuthConfig(existingConfig, makeRuntime(), noopPrompter);
316+317+expect(mocks.promptModelAllowlist).toHaveBeenCalledWith(
318+expect.objectContaining({
319+preferredProvider: "github-copilot",
320+}),
321+);
322+});
323+324+it("loads the selected provider catalog after auth enables that plugin", async () => {
325+vi.clearAllMocks();
326+mocks.promptAuthChoiceGrouped.mockResolvedValue("github-copilot");
327+mocks.resolvePreferredProviderForAuthChoice.mockResolvedValue("github-copilot");
328+const existingConfig = {
329+agents: { defaults: { model: { primary: "ollama/deepseek-v4-pro" } } },
330+models: {
331+providers: {
332+ollama: {
333+baseUrl: "https://ollama.com",
334+api: "ollama",
335+models: [{ id: "deepseek-v4-pro", name: "deepseek-v4-pro" }],
336+},
337+},
338+},
339+};
340+mocks.applyAuthChoice.mockResolvedValue({
341+config: {
342+ ...existingConfig,
343+plugins: { entries: { "github-copilot": { enabled: true } } },
344+},
345+});
346+mocks.loadStaticManifestCatalogRowsForList.mockReturnValueOnce([
347+{
348+ref: "github-copilot/claude-opus-4.7",
349+provider: "github-copilot",
350+id: "claude-opus-4.7",
351+name: "Claude Opus 4.7",
352+},
353+]);
354+mocks.promptModelAllowlist.mockResolvedValue({ models: undefined });
355+mocks.resolveProviderPluginChoice.mockReturnValue(null);
356+357+await promptAuthConfig(existingConfig, makeRuntime(), noopPrompter);
358+359+expect(mocks.promptModelAllowlist.mock.calls[0]?.[0]?.preferredProvider).toBe("github-copilot");
360+expect(mocks.promptModelAllowlist.mock.calls[0]?.[0]?.loadCatalog).toBe(true);
361+});
362+291363it("loads configured provider models after Ollama Cloud + Local and Cloud only setup", async () => {
292364vi.clearAllMocks();
293365mocks.promptAuthChoiceGrouped.mockResolvedValue("ollama");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。