Remove model name check in convertGooglePrompt

This commit is contained in:
Cohee
2025-04-26 00:34:21 +03:00
parent 3fd12b28dc
commit e621f0d967

View File

@ -362,22 +362,12 @@ export function convertCohereMessages(messages, names) {
/** /**
* Convert a prompt from the ChatML objects to the format used by Google MakerSuite models. * Convert a prompt from the ChatML objects to the format used by Google MakerSuite models.
* @param {object[]} messages Array of messages * @param {object[]} messages Array of messages
* @param {string} model Model name * @param {string} _model Model name
* @param {boolean} useSysPrompt Use system prompt * @param {boolean} useSysPrompt Use system prompt
* @param {PromptNames} names Prompt names * @param {PromptNames} names Prompt names
* @returns {{contents: *[], system_instruction: {parts: {text: string}[]}}} Prompt for Google MakerSuite models * @returns {{contents: *[], system_instruction: {parts: {text: string}[]}}} Prompt for Google MakerSuite models
*/ */
export function convertGooglePrompt(messages, model, useSysPrompt, names) { export function convertGooglePrompt(messages, _model, useSysPrompt, names) {
const visionSupportedModelPrefix = [
'gemini-1.5',
'gemini-2.0',
'gemini-2.5',
'gemini-exp-1114',
'gemini-exp-1121',
'gemini-exp-1206',
];
const isMultimodal = visionSupportedModelPrefix.some(prefix => model.startsWith(prefix));
const sysPrompt = []; const sysPrompt = [];
if (useSysPrompt) { if (useSysPrompt) {
@ -477,7 +467,7 @@ export function convertGooglePrompt(messages, model, useSysPrompt, names) {
toolNameMap[toolCall.id] = toolCall.function.name; toolNameMap[toolCall.id] = toolCall.function.name;
}); });
} else if (part.type === 'image_url' && isMultimodal) { } else if (part.type === 'image_url') {
const mimeType = part.image_url.url.split(';')[0].split(':')[1]; const mimeType = part.image_url.url.split(';')[0].split(':')[1];
const base64Data = part.image_url.url.split(',')[1]; const base64Data = part.image_url.url.split(',')[1];
parts.push({ parts.push({