Fix gemini bug adding empty code block at end of text blocks

This commit is contained in:
Saoud Rizwan committed 2024-12-21 20:56:33 -08:00
1 parent 8974a9ce69
commit bfed826033
1 file changed
+9
+9
View File
@@ -934,6 +934,15 @@ export class Cline {
}
}
}
if (!block.partial) {
// gemini models add this artifact to the end of text content:
const TOOL_CODE_SUFFIX = "```tool_code"
if (content?.trimEnd().endsWith(TOOL_CODE_SUFFIX)) {
content = content.trimEnd().slice(0, -TOOL_CODE_SUFFIX.length)
}
}
await this.say("text", content, undefined, block.partial)
break
}