Compare commits

...

3 Commits

Author SHA1 Message Date
0xtoshii 4dd6f852b0 user message included 2025-05-05 16:46:46 -07:00
0xtoshii 62581547c8 changeset 2025-05-05 16:04:21 -07:00
0xtoshii 35fce9c64b breakpoint just in system prompt 2025-05-05 16:01:02 -07:00
2 changed files with 30 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"claude-dev": minor
---
breakpoint just in system prompt for gemini for OR and cline provider
+25 -2
View File
@@ -88,7 +88,30 @@ export async function createOpenRouterStream(
],
}
const GEMINI_CACHE_USER_MESSAGE_INTERVAL = 4 // add new breakpoint every 4 turns
// for safety, but this should always be the case
if (openAiMessages.length >= 2) {
const msg = openAiMessages[1]
if (msg) {
if (typeof msg.content === "string") {
msg.content = [{ type: "text", text: msg.content }]
}
if (Array.isArray(msg.content)) {
// NOTE: this is fine since env details will always be added at the end. but if it weren't there, and the user added a image_url type message, it would pop a text part before it and then move it after to the end.
let lastTextPart = msg.content.filter((part) => part.type === "text").pop()
if (!lastTextPart) {
lastTextPart = { type: "text", text: "..." }
msg.content.push(lastTextPart)
}
// @ts-ignore-next-line
lastTextPart["cache_control"] = { type: "ephemeral" }
}
}
}
// it doesn't make sense to alter breakpoints at all with the gemini cache implementation at this time
/*const GEMINI_CACHE_USER_MESSAGE_INTERVAL = 4 // add new breakpoint every 4 turns
const userMessages = openAiMessages.filter((msg) => msg.role === "user")
const userMessageCount = userMessages.length
@@ -115,7 +138,7 @@ export async function createOpenRouterStream(
lastTextPart["cache_control"] = { type: "ephemeral" }
}
}
}
}*/
break
default:
break