fix gemini

This commit is contained in:
Andrew Pareles 2025-01-22 03:25:27 -08:00
parent fd4f3c3ab6
commit 387be4db76
2 changed files with 4 additions and 7 deletions

View file

@ -3,7 +3,7 @@
* Licensed under the Apache License, Version 2.0. See LICENSE.txt for more information.
*--------------------------------------------------------------------------------------*/
import { Content, GoogleGenerativeAI, GoogleGenerativeAIFetchError } from '@google/generative-ai';
import { Content, GoogleGenerativeAI } from '@google/generative-ai';
import { _InternalSendLLMMessageFnType } from '../../common/llmMessageTypes.js';
// Gemini
@ -43,11 +43,6 @@ export const sendGeminiMsg: _InternalSendLLMMessageFnType = async ({ messages, o
onFinalMessage({ fullText });
})
.catch((error) => {
if (error instanceof GoogleGenerativeAIFetchError && error.status === 400) {
onError({ message: 'Invalid API key.', fullError: null });
}
else {
onError({ message: error + '', fullError: error });
}
onError({ message: error + '', fullError: error })
})
}

View file

@ -277,7 +277,9 @@ Please finish writing the new file by applying the diff to the original file. Re
// this should probably be longer
export const ctrlKStream_systemMessage = `\
You are an AI assistant tasked with filling in the middle.
`