Skip to content

Commit 4437591

Browse files
committed
fix
1 parent b1c67f9 commit 4437591

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

service/events/llm.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ async function useGeminiResponse([messages, callback, params]: Parameters<
8181
let genAI = new GoogleGenerativeAI(
8282
params.geminiApiKey || process.env["GEMINI_API_KEY"]
8383
);
84-
const model = genAI.getGenerativeModel({ model: "gemini-pro-vision" });
8584
const generationConfig = {
8685
temperature: 0,
8786
topK: 32,
@@ -90,7 +89,14 @@ async function useGeminiResponse([messages, callback, params]: Parameters<
9089
};
9190

9291
const contents = transformData(messages);
93-
console.log('************', contents);
92+
const parts = contents[0].parts;
93+
let modelType = 'gemini-pro'
94+
if (parts && parts[1] && parts[1].inlineData) {
95+
modelType = "gemini-pro-vision"
96+
}
97+
98+
const model = genAI.getGenerativeModel({ model: modelType});
99+
94100
const result = await model.generateContentStream({
95101
contents: contents,
96102
generationConfig,

0 commit comments

Comments
 (0)