From edb96c62b18c60a2dff04da2ad906206f2f0d5ee Mon Sep 17 00:00:00 2001 From: "Ton Hoang Nguyen (Bill)" <32552798+HahaBill@users.noreply.github.com> Date: Tue, 8 Jul 2025 00:46:35 +0100 Subject: [PATCH] fix: removing `contextLimit` test and removing token management in translations --- .../__tests__/gemini-handler.spec.ts | 18 ---------- webview-ui/src/i18n/locales/ca/settings.json | 33 +------------------ webview-ui/src/i18n/locales/en/settings.json | 3 +- 3 files changed, 2 insertions(+), 52 deletions(-) diff --git a/src/api/providers/__tests__/gemini-handler.spec.ts b/src/api/providers/__tests__/gemini-handler.spec.ts index 2805593ca5..5f9e088ff2 100644 --- a/src/api/providers/__tests__/gemini-handler.spec.ts +++ b/src/api/providers/__tests__/gemini-handler.spec.ts @@ -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", diff --git a/webview-ui/src/i18n/locales/ca/settings.json b/webview-ui/src/i18n/locales/ca/settings.json index 6e9d1da760..674094f425 100644 --- a/webview-ui/src/i18n/locales/ca/settings.json +++ b/webview-ui/src/i18n/locales/ca/settings.json @@ -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": { diff --git a/webview-ui/src/i18n/locales/en/settings.json b/webview-ui/src/i18n/locales/en/settings.json index 555231ab29..577caf6987 100644 --- a/webview-ui/src/i18n/locales/en/settings.json +++ b/webview-ui/src/i18n/locales/en/settings.json @@ -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": {