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

Commit a0a32c2

Browse files
committed
fix: type error
1 parent 4eae5a3 commit a0a32c2

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
@@ -185,50 +185,6 @@ export class GeminiHandler extends BaseProvider implements SingleCompletionHandl
185185
}
186186
}
187187

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

0 commit comments

Comments
 (0)