Skip to content

Commit 6a93ccd

Browse files
committed
Remove ollama num_ctx configuration option
1 parent 33da2bd commit 6a93ccd

File tree

20 files changed

+74
-58
lines changed

20 files changed

+74
-58
lines changed

src/api/providers/__tests__/native-ollama.spec.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ vitest.mock("../fetchers/ollama", () => ({
2323
supportsImages: false,
2424
supportsPromptCache: false,
2525
},
26-
"deepseek-r1": {
27-
contextWindow: 32768,
28-
maxTokens: 32768,
29-
supportsImages: false,
30-
supportsPromptCache: false,
31-
},
3226
}),
3327
}))
3428

@@ -78,34 +72,6 @@ describe("NativeOllamaHandler", () => {
7872
expect(results[1]).toEqual({ type: "text", text: " world" })
7973
expect(results[2]).toEqual({ type: "usage", inputTokens: 10, outputTokens: 2 })
8074
})
81-
82-
it("should handle DeepSeek R1 models with reasoning detection", async () => {
83-
const options: ApiHandlerOptions = {
84-
apiModelId: "deepseek-r1",
85-
ollamaModelId: "deepseek-r1",
86-
ollamaBaseUrl: "http://localhost:11434",
87-
}
88-
89-
handler = new NativeOllamaHandler(options)
90-
91-
// Mock response with thinking tags
92-
mockChat.mockImplementation(async function* () {
93-
yield { message: { content: "<think>Let me think" } }
94-
yield { message: { content: " about this</think>" } }
95-
yield { message: { content: "The answer is 42" } }
96-
})
97-
98-
const stream = handler.createMessage("System", [{ role: "user" as const, content: "Question?" }])
99-
const results = []
100-
101-
for await (const chunk of stream) {
102-
results.push(chunk)
103-
}
104-
105-
// Should detect reasoning vs regular text
106-
expect(results.some((r) => r.type === "reasoning")).toBe(true)
107-
expect(results.some((r) => r.type === "text")).toBe(true)
108-
})
10975
})
11076

11177
describe("completePrompt", () => {

src/api/providers/native-ollama.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type { ApiHandlerOptions } from "../../shared/api"
77
import { getOllamaModels } from "./fetchers/ollama"
88
import { XmlMatcher } from "../../utils/xml-matcher"
99
import type { SingleCompletionHandler, ApiHandlerCreateMessageMetadata } from "../index"
10-
import { t } from "../../i18n"
1110

1211
const TOKEN_ESTIMATION_FACTOR = 4 // Industry standard technique for estimating token counts without actually implementing a parser/tokenizer
1312

@@ -297,11 +296,8 @@ export class NativeOllamaHandler extends BaseProvider implements SingleCompletio
297296
const availableModels = Object.keys(this.models)
298297
const errorMessage =
299298
availableModels.length > 0
300-
? t("common:errors.ollama.modelNotFoundWithAvailable", {
301-
modelId,
302-
availableModels: availableModels.join(", "),
303-
})
304-
: t("common:errors.ollama.modelNotFoundNoModels", { modelId })
299+
? `Model ${modelId} not found. Available models: ${availableModels.join(", ")}`
300+
: `Model ${modelId} not found. No models available. Please pull the model first with: ollama pull ${modelId}`
305301
throw new Error(errorMessage)
306302
}
307303

src/i18n/locales/ca/common.json

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/de/common.json

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/en/common.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@
110110
"modelNotFound": "Model {{modelId}} not found in Ollama. Please pull the model first with: ollama pull {{modelId}}",
111111
"modelNotFoundWithAvailable": "Model {{modelId}} not found. Available models: {{availableModels}}",
112112
"modelNotFoundNoModels": "Model {{modelId}} not found. No models available. Please pull the model first with: ollama pull {{modelId}}",
113-
"completionError": "Ollama completion error: {{error}}"
113+
"completionError": "Ollama completion error: {{error}}",
114+
"clientCreationError": "Error creating Ollama client: {{error}}",
115+
"streamProcessingError": "Ollama stream processing error: {{error}}",
116+
"unknownError": "Unknown error"
114117
}
115118
},
116119
"warnings": {

src/i18n/locales/es/common.json

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/fr/common.json

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/hi/common.json

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/id/common.json

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/it/common.json

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)