Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit 19f67fd

Browse files
committed
fix: type error
1 parent 5f3733e commit 19f67fd

1 file changed

Lines changed: 0 additions & 44 deletions

File tree

src/api/providers/gemini.ts

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -184,50 +184,6 @@ export class GeminiHandler extends BaseProvider implements SingleCompletionHandl
184184
}
185185
}
186186

187-
// Check if the model is a Gemma 3 model
188-
const isGemma3 = model.includes("gemma-3")
189-
190-
// Prepend system instruction to the first user message if it's a Gemma 3 model,
191-
// as they don't support the system instruction parameter.
192-
if (isGemma3 && systemInstruction) {
193-
if (contents.length > 0 && contents[0].role === "user") {
194-
const firstMessage = contents[0]
195-
// Create a new text part for the system instruction
196-
const systemPart = { text: systemInstruction }
197-
// Prepend it to the existing parts
198-
firstMessage.parts = [systemPart, ...(firstMessage.parts || [])]
199-
} else {
200-
// If no messages or first message is not user (e.g. starts with model),
201-
// prepend a new user message with the system instruction.
202-
contents.unshift({
203-
role: "user",
204-
parts: [{ text: systemInstruction }],
205-
})
206-
}
207-
}
208-
209-
// Check if the model is a Gemma 3 model
210-
const isGemma3 = model.includes("gemma-3")
211-
212-
// Prepend system instruction to the first user message if it's a Gemma 3 model,
213-
// as they don't support the system instruction parameter.
214-
if (isGemma3 && systemInstruction) {
215-
if (contents.length > 0 && contents[0].role === "user") {
216-
const firstMessage = contents[0]
217-
// Create a new text part for the system instruction
218-
const systemPart = { text: systemInstruction }
219-
// Prepend it to the existing parts
220-
firstMessage.parts = [systemPart, ...(firstMessage.parts || [])]
221-
} else {
222-
// If no messages or first message is not user (e.g. starts with model),
223-
// prepend a new user message with the system instruction.
224-
contents.unshift({
225-
role: "user",
226-
parts: [{ text: systemInstruction }],
227-
})
228-
}
229-
}
230-
231187
const config: GenerateContentConfig = {
232188
...(isGemma3 ? {} : { systemInstruction }),
233189
httpOptions: this.options.googleGeminiBaseUrl ? { baseUrl: this.options.googleGeminiBaseUrl } : undefined,

0 commit comments

Comments
 (0)