Elffuss BraidHub

kikocis/continue public

support both cacheBehavior and completionOptions.promptCaching
Changesetcb8ecd666f0f20deb3c81b4a763e7b4a15f2c748f8283b55216d7fe04ea01d66
Authorferenci84 <ferenci84@gmail.com> · 2025-09-22 13:38 +02:00
Committerferenci84 <ferenci84@gmail.com> · 2025-09-22 13:38 +02:00
Parents26d9a21964a3

Browse the files at this changeset

1 file changed

modified core/llm/llms/OpenRouter.ts +11 −6
@@ -22,9 +22,7 @@
2222 private isAnthropicModel(model?: string): boolean {
2323 if (!model) return false;
2424 const modelLower = model.toLowerCase();
25- return (
26- modelLower.includes("claude") || modelLower.includes("anthropic/claude")
27- );
25+ return modelLower.includes("claude");
2826 }
2927
3028 /**
@@ -69,12 +67,19 @@
6967 body = super.modifyChatBody(body);
7068
7169 // Check if we should apply Anthropic caching
72- if (!this.isAnthropicModel(body.model) || !this.cacheBehavior) {
70+ if (
71+ !this.isAnthropicModel(body.model) ||
72+ (!this.cacheBehavior && !this.completionOptions.promptCaching)
73+ ) {
7374 return body;
7475 }
7576
76- const shouldCacheConversation = this.cacheBehavior.cacheConversation;
77- const shouldCacheSystemMessage = this.cacheBehavior.cacheSystemMessage;
77+ const shouldCacheConversation =
78+ this.cacheBehavior?.cacheConversation ||
79+ this.completionOptions.promptCaching;
80+ const shouldCacheSystemMessage =
81+ this.cacheBehavior?.cacheSystemMessage ||
82+ this.completionOptions.promptCaching;
7883
7984 if (!shouldCacheConversation && !shouldCacheSystemMessage) {
8085 return body;