Fix gemini message conversion

This commit is contained in:
Saoud Rizwan
2024-09-12 11:49:32 -04:00
parent fbb7620fa1
commit 3b004aed37
5 changed files with 121 additions and 49 deletions

View File

@@ -70,6 +70,27 @@ export class OpenRouterHandler implements ApiHandler {
const anthropicMessage = convertToAnthropicMessage(completion)
// Check if the model is Gemini Flash and remove extra escapes in tool result args
// switch (this.getModel().id) {
// case "google/gemini-pro-1.5":
// case "google/gemini-flash-1.5":
// const content = anthropicMessage.content
// for (const block of content) {
// if (
// block.type === "tool_use" &&
// typeof block.input === "object" &&
// block.input !== null &&
// "content" in block.input &&
// typeof block.input.content === "string"
// ) {
// block.input.content = unescapeGeminiContent(block.input.content)
// }
// }
// break
// default:
// break
// }
return { message: anthropicMessage }
}