fix: removing contextLimit test and removing token management in translations

This commit is contained in:
Ton Hoang Nguyen (Bill) 2025-07-08 00:46:35 +01:00
parent 7e5a59d4ae
commit edb96c62b1
3 changed files with 2 additions and 52 deletions

View file

@ -1,26 +1,8 @@
import { describe, it, expect, vi } from "vitest"
import { GeminiHandler } from "../gemini"
import type { ApiHandlerOptions } from "../../../shared/api"
import type { Anthropic } from "@anthropic-ai/sdk"
describe("GeminiHandler backend support", () => {
it("slices messages when contextLimit is set", async () => {
const options = { apiProvider: "gemini", contextLimit: 1 } as ApiHandlerOptions
const handler = new GeminiHandler(options)
const stub = vi.fn().mockReturnValue((async function* () {})())
// @ts-ignore access private client
handler["client"].models.generateContentStream = stub
const messages = [
{ role: "user", content: [{ type: "text", text: "first" }] },
{ role: "assistant", content: [{ type: "text", text: "second" }] },
] as Anthropic.Messages.MessageParam[]
for await (const _ of handler.createMessage("instr", messages)) {
}
expect(stub).toHaveBeenCalledOnce()
const params = stub.mock.calls[0][0]
expect(params.contents).toHaveLength(1)
})
it("passes maxOutputTokens, topP, topK, and tools for URL context and grounding in config", async () => {
const options = {
apiProvider: "gemini",

View file

@ -250,23 +250,7 @@
},
"geminiSections": {
"modelParameters": "Paràmetres del model",
"advancedFeatures": "Funcions avançades",
"geminiTokentManagement": "Gestió de tokens"
},
"geminiTokentManagement": {
"useCustomContextWindow": "Use custom context window limit",
"description": "Override the model's default context window.",
"modelDefault": "Model's default context window",
"condensingThreshold": {
"tokens": "tokens",
"title": "Context Condensing Threshold",
"description": "Set the percentage of context window usage that triggers automatic condensing. Note: If the calculated token limit (after reserving space for output and safety buffers) is lower than this percentage, the token limit will trigger condensing instead.",
"condensingtriggerAt": "Condensing will trigger at",
"tokenLimitTriggered": "due to token limit, not percentage",
"availableContext": "Available context window",
"tokenLimitTrigger": "Token limit trigger (after reserving output tokens and safety buffer)",
"actualTrigger": "Actual trigger (minimum of percentage and token limit)"
}
"advancedFeatures": "Funcions avançades"
},
"googleCloudSetup": {
"title": "Per utilitzar Google Cloud Vertex AI, necessiteu:",
@ -366,21 +350,6 @@
"pathLabel": "Ruta del Codi Claude",
"description": "Ruta opcional al teu CLI de Claude Code. Per defecte, 'claude' si no s'estableix.",
"placeholder": "Per defecte: claude"
},
"geminiContextManagement": {
"useCustomContextWindow": "Use custom context window limit",
"description": "Override the model's default context window.",
"modelDefault": "Model's default context window",
"condensingThreshold": {
"tokens": "tokens",
"title": "Context Condensing Threshold",
"description": "Set the percentage of context window usage that triggers automatic condensing. Note: If the calculated token limit (after reserving space for output and safety buffers) is lower than this percentage, the token limit will trigger condensing instead.",
"condensingtriggerAt": "Condensing will trigger at",
"tokenLimitTriggered": "due to token limit, not percentage",
"availableContext": "Available context window",
"tokenLimitTrigger": "Token limit trigger (after reserving output tokens and safety buffer)",
"actualTrigger": "Actual trigger (minimum of percentage and token limit)"
}
}
},
"browser": {

View file

@ -224,8 +224,7 @@
"vscodeLmWarning": "Note: This is a very experimental integration and provider support will vary. If you get an error about a model not being supported, that's an issue on the provider's end.",
"geminiSections": {
"modelParameters": "Model Parameters",
"advancedFeatures": "Advanced Features",
"geminiTokentManagement": "Token Management"
"advancedFeatures": "Advanced Features"
},
"geminiParameters": {
"topK": {