diff --git a/.changeset/three-rings-approve.md b/.changeset/three-rings-approve.md new file mode 100644 index 0000000000..b928b40da0 --- /dev/null +++ b/.changeset/three-rings-approve.md @@ -0,0 +1,5 @@ +--- +"roo-cline": patch +--- + +Enable Gemini prompt caching by default diff --git a/evals/packages/types/src/roo-code.ts b/evals/packages/types/src/roo-code.ts index 693192f915..f75f64e6fd 100644 --- a/evals/packages/types/src/roo-code.ts +++ b/evals/packages/types/src/roo-code.ts @@ -418,7 +418,7 @@ export const providerSettingsSchema = z.object({ // Generic includeMaxTokens: z.boolean().optional(), reasoningEffort: reasoningEffortsSchema.optional(), - promptCachingEnabled: z.boolean().optional(), + promptCachingDisabled: z.boolean().optional(), diffEnabled: z.boolean().optional(), fuzzyMatchThreshold: z.number().optional(), modelTemperature: z.number().nullish(), @@ -507,7 +507,7 @@ const providerSettingsRecord: ProviderSettingsRecord = { // Generic includeMaxTokens: undefined, reasoningEffort: undefined, - promptCachingEnabled: undefined, + promptCachingDisabled: undefined, diffEnabled: undefined, fuzzyMatchThreshold: undefined, modelTemperature: undefined, diff --git a/src/api/providers/__tests__/gemini.test.ts b/src/api/providers/__tests__/gemini.test.ts index e994bf0edf..ba7501f2a2 100644 --- a/src/api/providers/__tests__/gemini.test.ts +++ b/src/api/providers/__tests__/gemini.test.ts @@ -291,7 +291,7 @@ describe("Caching Logic", () => { apiKey: "test-key", apiModelId: "gemini-1.5-flash-latest", // Use a model that supports caching geminiApiKey: "test-key", - promptCachingEnabled: true, // Enable caching for these tests + promptCachingDisabled: false, }) handlerWithCache["client"] = { @@ -309,8 +309,8 @@ describe("Caching Logic", () => { } as any }) - it("should not use cache if promptCachingEnabled is false", async () => { - handlerWithCache["options"].promptCachingEnabled = false + it("should not use cache if promptCachingDisabled is true", async () => { + handlerWithCache["options"].promptCachingDisabled = true const stream = handlerWithCache.createMessage(systemPrompt, mockMessagesLong, cacheKey) for await (const _ of stream) { diff --git a/src/api/providers/gemini.ts b/src/api/providers/gemini.ts index 38347fc903..e4547df91a 100644 --- a/src/api/providers/gemini.ts +++ b/src/api/providers/gemini.ts @@ -93,7 +93,7 @@ export class GeminiHandler extends BaseProvider implements SingleCompletionHandl // https://ai.google.dev/gemini-api/docs/tokens?lang=node const isCacheAvailable = info.supportsPromptCache && - this.options.promptCachingEnabled && + !this.options.promptCachingDisabled && cacheKey && contentsLength > 4 * CONTEXT_CACHE_TOKEN_MINIMUM diff --git a/src/api/providers/openrouter.ts b/src/api/providers/openrouter.ts index e1104f4f9a..5c92fee89b 100644 --- a/src/api/providers/openrouter.ts +++ b/src/api/providers/openrouter.ts @@ -94,7 +94,7 @@ export class OpenRouterHandler extends BaseProvider implements SingleCompletionH openAiMessages = convertToR1Format([{ role: "user", content: systemPrompt }, ...messages]) } - const isCacheAvailable = promptCache.supported && (!promptCache.optional || this.options.promptCachingEnabled) + const isCacheAvailable = promptCache.supported && (!promptCache.optional || !this.options.promptCachingDisabled) // https://openrouter.ai/docs/features/prompt-caching if (isCacheAvailable) { diff --git a/src/exports/roo-code.d.ts b/src/exports/roo-code.d.ts index 0f2250f6c2..2c9aae3b96 100644 --- a/src/exports/roo-code.d.ts +++ b/src/exports/roo-code.d.ts @@ -127,7 +127,7 @@ type ProviderSettings = { modelMaxThinkingTokens?: number | undefined includeMaxTokens?: boolean | undefined reasoningEffort?: ("low" | "medium" | "high") | undefined - promptCachingEnabled?: boolean | undefined + promptCachingDisabled?: boolean | undefined diffEnabled?: boolean | undefined fuzzyMatchThreshold?: number | undefined modelTemperature?: (number | null) | undefined diff --git a/src/exports/types.ts b/src/exports/types.ts index 1cb395156e..28a3bea891 100644 --- a/src/exports/types.ts +++ b/src/exports/types.ts @@ -128,7 +128,7 @@ type ProviderSettings = { modelMaxThinkingTokens?: number | undefined includeMaxTokens?: boolean | undefined reasoningEffort?: ("low" | "medium" | "high") | undefined - promptCachingEnabled?: boolean | undefined + promptCachingDisabled?: boolean | undefined diffEnabled?: boolean | undefined fuzzyMatchThreshold?: number | undefined modelTemperature?: (number | null) | undefined diff --git a/src/schemas/index.ts b/src/schemas/index.ts index 0a59e5f13c..0a6ba118d4 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -434,7 +434,7 @@ export const providerSettingsSchema = z.object({ // Generic includeMaxTokens: z.boolean().optional(), reasoningEffort: reasoningEffortsSchema.optional(), - promptCachingEnabled: z.boolean().optional(), + promptCachingDisabled: z.boolean().optional(), diffEnabled: z.boolean().optional(), fuzzyMatchThreshold: z.number().optional(), modelTemperature: z.number().nullish(), @@ -524,7 +524,7 @@ const providerSettingsRecord: ProviderSettingsRecord = { // Generic includeMaxTokens: undefined, reasoningEffort: undefined, - promptCachingEnabled: undefined, + promptCachingDisabled: undefined, diffEnabled: undefined, fuzzyMatchThreshold: undefined, modelTemperature: undefined, diff --git a/webview-ui/src/components/settings/PromptCachingControl.tsx b/webview-ui/src/components/settings/PromptCachingControl.tsx index ad68d8d8a9..e7600915ec 100644 --- a/webview-ui/src/components/settings/PromptCachingControl.tsx +++ b/webview-ui/src/components/settings/PromptCachingControl.tsx @@ -16,8 +16,8 @@ export const PromptCachingControl = ({ apiConfiguration, setApiConfigurationFiel <>
setApiConfigurationField("promptCachingEnabled", e.target.checked)}> + checked={apiConfiguration.promptCachingDisabled} + onChange={(e: any) => setApiConfigurationField("promptCachingDisabled", e.target.checked)}>
diff --git a/webview-ui/src/i18n/locales/ca/settings.json b/webview-ui/src/i18n/locales/ca/settings.json index 23ecd84612..34f4359fcb 100644 --- a/webview-ui/src/i18n/locales/ca/settings.json +++ b/webview-ui/src/i18n/locales/ca/settings.json @@ -416,8 +416,8 @@ } }, "promptCaching": { - "label": "Habilitar emmagatzematge en caché de prompts", - "description": "Quan està habilitat, Roo utilitzarà aquest model amb la memòria cau de prompts activada per reduir costos." + "label": "Desactivar la memòria cau de prompts", + "description": "Quan està marcat, Roo no utilitzarà la memòria cau de prompts per a aquest model." }, "temperature": { "useCustom": "Utilitzar temperatura personalitzada", diff --git a/webview-ui/src/i18n/locales/de/settings.json b/webview-ui/src/i18n/locales/de/settings.json index 7d421651f5..4d6eea4c86 100644 --- a/webview-ui/src/i18n/locales/de/settings.json +++ b/webview-ui/src/i18n/locales/de/settings.json @@ -416,8 +416,8 @@ } }, "promptCaching": { - "label": "Prompt-Caching aktivieren", - "description": "Wenn aktiviert, wird Roo dieses Modell mit aktiviertem Prompt-Caching verwenden, um Kosten zu reduzieren." + "label": "Prompt-Caching deaktivieren", + "description": "Wenn aktiviert, wird Roo für dieses Modell kein Prompt-Caching verwenden." }, "temperature": { "useCustom": "Benutzerdefinierte Temperatur verwenden", diff --git a/webview-ui/src/i18n/locales/en/settings.json b/webview-ui/src/i18n/locales/en/settings.json index 00e7b022be..9c4535007f 100644 --- a/webview-ui/src/i18n/locales/en/settings.json +++ b/webview-ui/src/i18n/locales/en/settings.json @@ -416,8 +416,8 @@ } }, "promptCaching": { - "label": "Enable prompt caching", - "description": "When enabled, Roo will use this model with prompt caching turned on in order to reduce costs." + "label": "Disable prompt caching", + "description": "When checked, Roo will not use prompt caching for this model." }, "temperature": { "useCustom": "Use custom temperature", diff --git a/webview-ui/src/i18n/locales/es/settings.json b/webview-ui/src/i18n/locales/es/settings.json index a0e791b6ea..824ea905b0 100644 --- a/webview-ui/src/i18n/locales/es/settings.json +++ b/webview-ui/src/i18n/locales/es/settings.json @@ -416,8 +416,8 @@ } }, "promptCaching": { - "label": "Habilitar caché de prompts", - "description": "Cuando está habilitado, Roo usará este modelo con el caché de prompts activado para reducir costos." + "label": "Desactivar caché de prompts", + "description": "Cuando está marcado, Roo no utilizará el caché de prompts para este modelo." }, "temperature": { "useCustom": "Usar temperatura personalizada", diff --git a/webview-ui/src/i18n/locales/fr/settings.json b/webview-ui/src/i18n/locales/fr/settings.json index 7e99603438..e37caa3e96 100644 --- a/webview-ui/src/i18n/locales/fr/settings.json +++ b/webview-ui/src/i18n/locales/fr/settings.json @@ -416,8 +416,8 @@ } }, "promptCaching": { - "label": "Activer la mise en cache des prompts", - "description": "Lorsque cette option est activée, Roo utilisera ce modèle avec la mise en cache des prompts activée afin de réduire les coûts." + "label": "Désactiver la mise en cache des prompts", + "description": "Lorsque cette option est cochée, Roo n'utilisera pas la mise en cache des prompts pour ce modèle." }, "temperature": { "useCustom": "Utiliser une température personnalisée", diff --git a/webview-ui/src/i18n/locales/hi/settings.json b/webview-ui/src/i18n/locales/hi/settings.json index 066645d4c5..31aa6bf2a1 100644 --- a/webview-ui/src/i18n/locales/hi/settings.json +++ b/webview-ui/src/i18n/locales/hi/settings.json @@ -416,8 +416,8 @@ } }, "promptCaching": { - "label": "प्रॉम्प्ट कैशिंग सक्षम करें", - "description": "जब सक्षम किया जाता है, तो Roo लागत को कम करने के लिए प्रॉम्प्ट कैशिंग चालू के साथ इस मॉडल का उपयोग करेगा।" + "label": "प्रॉम्प्ट कैशिंग अक्षम करें", + "description": "जब चेक किया जाता है, तो Roo इस मॉडल के लिए प्रॉम्प्ट कैशिंग का उपयोग नहीं करेगा।" }, "temperature": { "useCustom": "कस्टम तापमान का उपयोग करें", diff --git a/webview-ui/src/i18n/locales/it/settings.json b/webview-ui/src/i18n/locales/it/settings.json index d1cbfdb5ab..3a42483cd0 100644 --- a/webview-ui/src/i18n/locales/it/settings.json +++ b/webview-ui/src/i18n/locales/it/settings.json @@ -416,8 +416,8 @@ } }, "promptCaching": { - "label": "Abilita cache dei prompt", - "description": "Quando abilitato, Roo utilizzerà questo modello con la cache dei prompt attivata per ridurre i costi." + "label": "Disattiva la cache dei prompt", + "description": "Quando selezionato, Roo non utilizzerà la cache dei prompt per questo modello." }, "temperature": { "useCustom": "Usa temperatura personalizzata", diff --git a/webview-ui/src/i18n/locales/ja/settings.json b/webview-ui/src/i18n/locales/ja/settings.json index f82b9413c8..88e2af752a 100644 --- a/webview-ui/src/i18n/locales/ja/settings.json +++ b/webview-ui/src/i18n/locales/ja/settings.json @@ -416,8 +416,8 @@ } }, "promptCaching": { - "label": "プロンプトキャッシングを有効化", - "description": "有効にすると、Rooはコスト削減のためにプロンプトキャッシングを有効にしてこのモデルを使用します。" + "label": "プロンプトキャッシュを無効化", + "description": "チェックすると、Rooはこのモデルに対してプロンプトキャッシュを使用しません。" }, "temperature": { "useCustom": "カスタム温度を使用", diff --git a/webview-ui/src/i18n/locales/ko/settings.json b/webview-ui/src/i18n/locales/ko/settings.json index 1cb7aef9ed..f1d956f7af 100644 --- a/webview-ui/src/i18n/locales/ko/settings.json +++ b/webview-ui/src/i18n/locales/ko/settings.json @@ -416,8 +416,8 @@ } }, "promptCaching": { - "label": "프롬프트 캐싱 활성화", - "description": "활성화하면 Roo는 비용 절감을 위해 프롬프트 캐싱을 켠 상태로 이 모델을 사용합니다." + "label": "프롬프트 캐싱 비활성화", + "description": "체크하면 Roo가 이 모델에 대해 프롬프트 캐싱을 사용하지 않습니다." }, "temperature": { "useCustom": "사용자 정의 온도 사용", diff --git a/webview-ui/src/i18n/locales/pl/settings.json b/webview-ui/src/i18n/locales/pl/settings.json index 8dad5cb140..f4327c3435 100644 --- a/webview-ui/src/i18n/locales/pl/settings.json +++ b/webview-ui/src/i18n/locales/pl/settings.json @@ -416,8 +416,8 @@ } }, "promptCaching": { - "label": "Włącz buforowanie podpowiedzi", - "description": "Po włączeniu, Roo będzie używać tego modelu z włączonym buforowaniem promptów w celu zmniejszenia kosztów." + "label": "Wyłącz buforowanie promptów", + "description": "Po zaznaczeniu, Roo nie będzie używać buforowania promptów dla tego modelu." }, "temperature": { "useCustom": "Użyj niestandardowej temperatury", diff --git a/webview-ui/src/i18n/locales/pt-BR/settings.json b/webview-ui/src/i18n/locales/pt-BR/settings.json index e245ab3027..5a7209e2a4 100644 --- a/webview-ui/src/i18n/locales/pt-BR/settings.json +++ b/webview-ui/src/i18n/locales/pt-BR/settings.json @@ -416,8 +416,8 @@ } }, "promptCaching": { - "label": "Ativar cache de prompts", - "description": "Quando ativado, o Roo usará este modelo com o cache de prompts ativado para reduzir custos." + "label": "Desativar cache de prompts", + "description": "Quando marcado, o Roo não usará o cache de prompts para este modelo." }, "temperature": { "useCustom": "Usar temperatura personalizada", diff --git a/webview-ui/src/i18n/locales/ru/settings.json b/webview-ui/src/i18n/locales/ru/settings.json index 0c283b198a..7b49672098 100644 --- a/webview-ui/src/i18n/locales/ru/settings.json +++ b/webview-ui/src/i18n/locales/ru/settings.json @@ -416,8 +416,8 @@ } }, "promptCaching": { - "label": "Включить кэширование подсказок", - "description": "Если включено, Roo будет использовать эту модель с включенным кэшированием подсказок для снижения затрат." + "label": "Отключить кэширование промптов", + "description": "Если отмечено, Roo не будет использовать кэширование промптов для этой модели." }, "temperature": { "useCustom": "Использовать пользовательскую температуру", diff --git a/webview-ui/src/i18n/locales/tr/settings.json b/webview-ui/src/i18n/locales/tr/settings.json index 5ee3eb89d4..170963f89b 100644 --- a/webview-ui/src/i18n/locales/tr/settings.json +++ b/webview-ui/src/i18n/locales/tr/settings.json @@ -416,8 +416,8 @@ } }, "promptCaching": { - "label": "Prompt önbelleğini etkinleştir", - "description": "Etkinleştirildiğinde, Roo maliyetleri azaltmak için prompt önbelleği açık olan bu modeli kullanacaktır." + "label": "Prompt önbelleğini devre dışı bırak", + "description": "İşaretlendiğinde, Roo bu model için prompt önbelleğini kullanmayacaktır." }, "temperature": { "useCustom": "Özel sıcaklık kullan", diff --git a/webview-ui/src/i18n/locales/vi/settings.json b/webview-ui/src/i18n/locales/vi/settings.json index 41226b81bf..a1a3200de5 100644 --- a/webview-ui/src/i18n/locales/vi/settings.json +++ b/webview-ui/src/i18n/locales/vi/settings.json @@ -416,8 +416,8 @@ } }, "promptCaching": { - "label": "Bật bộ nhớ đệm prompt", - "description": "Khi được bật, Roo sẽ sử dụng mô hình này với bộ nhớ đệm prompt được bật để giảm chi phí." + "label": "Tắt bộ nhớ đệm prompt", + "description": "Khi được chọn, Roo sẽ không sử dụng bộ nhớ đệm prompt cho mô hình này." }, "temperature": { "useCustom": "Sử dụng nhiệt độ tùy chỉnh", diff --git a/webview-ui/src/i18n/locales/zh-CN/settings.json b/webview-ui/src/i18n/locales/zh-CN/settings.json index aa84e6b96b..42a813a5d4 100644 --- a/webview-ui/src/i18n/locales/zh-CN/settings.json +++ b/webview-ui/src/i18n/locales/zh-CN/settings.json @@ -416,8 +416,8 @@ } }, "promptCaching": { - "label": "启用提示词缓存", - "description": "启用后 Roo 将使用提示词缓存功能以降低成本。" + "label": "禁用提示词缓存", + "description": "选中后,Roo 将不会为此模型使用提示词缓存。" }, "temperature": { "useCustom": "使用自定义温度", diff --git a/webview-ui/src/i18n/locales/zh-TW/settings.json b/webview-ui/src/i18n/locales/zh-TW/settings.json index 1877135fcb..9728b67d0e 100644 --- a/webview-ui/src/i18n/locales/zh-TW/settings.json +++ b/webview-ui/src/i18n/locales/zh-TW/settings.json @@ -416,8 +416,8 @@ } }, "promptCaching": { - "label": "啟用提示快取", - "description": "啟用後,Roo 將使用提示快取功能以降低成本。" + "label": "停用提示詞快取", + "description": "勾選後,Roo 將不會為此模型使用提示詞快取。" }, "temperature": { "useCustom": "使用自訂溫度",