Merge pull request #2973 from honey-tree/gemini-fix-electric-boogaloo

Remove a trailing slash from the Gemini API URL in case it gets added in by URL.toString
This commit is contained in:
Cohee 2024-10-10 21:16:28 +03:00 committed by GitHub
commit dcd3f13e62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -337,7 +337,7 @@ async function sendMakerSuiteRequest(request, response) {
? (stream ? 'streamGenerateContent' : 'generateContent')
: (isText ? 'generateText' : 'generateMessage');
const generateResponse = await fetch(`${apiUrl}/${apiVersion}/models/${model}:${responseType}?key=${apiKey}${stream ? '&alt=sse' : ''}`, {
const generateResponse = await fetch(`${apiUrl.toString().replace(/\/$/, '')}/${apiVersion}/models/${model}:${responseType}?key=${apiKey}${stream ? '&alt=sse' : ''}`, {
body: JSON.stringify(body),
method: 'POST',
headers: {