|
1 | 1 | import { afterEach, describe, expect, it, vi } from "vitest"; |
2 | 2 | import { CONTEXT_WINDOW_HARD_MIN_TOKENS } from "../agents/context-window-guard.js"; |
| 3 | +import { OLLAMA_DEFAULT_BASE_URL } from "../agents/ollama-models.js"; |
3 | 4 | import type { OpenClawConfig } from "../config/config.js"; |
4 | 5 | import { defaultRuntime } from "../runtime.js"; |
5 | 6 | import { |
@@ -133,6 +134,23 @@ describe("promptCustomApiConfig", () => { |
133 | 134 | expect(result.config.agents?.defaults?.models?.["custom/llama3"]?.alias).toBe("local"); |
134 | 135 | }); |
135 | 136 |
|
| 137 | + it("defaults custom onboarding to the native Ollama base URL", async () => { |
| 138 | + const prompter = createTestPrompter({ |
| 139 | + text: ["http://localhost:11434", "", "llama3", "custom", ""], |
| 140 | + select: ["plaintext", "openai"], |
| 141 | + }); |
| 142 | + stubFetchSequence([{ ok: true }]); |
| 143 | + |
| 144 | + await runPromptCustomApi(prompter); |
| 145 | + |
| 146 | + expect(prompter.text).toHaveBeenCalledWith( |
| 147 | + expect.objectContaining({ |
| 148 | + message: "API Base URL", |
| 149 | + initialValue: OLLAMA_DEFAULT_BASE_URL, |
| 150 | + }), |
| 151 | + ); |
| 152 | + }); |
| 153 | + |
136 | 154 | it("retries when verification fails", async () => { |
137 | 155 | const prompter = createTestPrompter({ |
138 | 156 | text: ["http://localhost:11434/v1", "", "bad-model", "good-model", "custom", ""], |
|
0 commit comments