From c11d54b789a7cc150b7831eb40e15418704d0e00 Mon Sep 17 00:00:00 2001 From: johnd0e <1838643+johnd0e@users.noreply.github.com> Date: Sun, 4 Aug 2024 14:07:59 +0200 Subject: [PATCH] fixup! Allow specifying arbitrary "gemini-*" model --- src/worker.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/worker.mjs b/src/worker.mjs index 038abcb..5988ae6 100644 --- a/src/worker.mjs +++ b/src/worker.mjs @@ -45,7 +45,7 @@ const API_VERSION = "v1beta"; // https://github.com/google/generative-ai-js/blob/0931d2ce051215db72785d76fe3ae4e0bc3b5475/packages/main/src/requests/request.ts#L67 const API_CLIENT = "genai-js/0.16.0"; // npm view @google/generative-ai version async function handleRequest(req, apiKey) { - const model = req?.model.startsWith("gemini-") ? req.model : DEFAULT_MODEL; + const model = req.model?.startsWith("gemini-") ? req.model : DEFAULT_MODEL; const TASK = req.stream ? "streamGenerateContent" : "generateContent"; let url = `${BASE_URL}/${API_VERSION}/models/${model}:${TASK}`; if (req.stream) { url += "?alt=sse"; }