From 5115a384e4d76a9183a493569d12ae0578d2101f Mon Sep 17 00:00:00 2001 From: ParvinEyvazov Date: Wed, 31 Jul 2024 15:32:28 +0400 Subject: [PATCH] feat: new gpt versions adde --- package.json | 2 +- src/core/translator.ts | 50 +- src/modules/functions.ts | 20 + src/modules/languages.ts | 1097 ++++++++++++++++++++++++++++++++++---- src/modules/modules.ts | 32 +- 5 files changed, 1077 insertions(+), 124 deletions(-) diff --git a/package.json b/package.json index 1df9487..7ef9501 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "3.0.2", + "version": "3.1.0", "license": "MIT", "main": "dist/index.js", "description": "Translate your JSON file or object into another languages with Google Translate API", diff --git a/src/core/translator.ts b/src/core/translator.ts index f83a866..452da5b 100644 --- a/src/core/translator.ts +++ b/src/core/translator.ts @@ -51,13 +51,23 @@ export async function plaintranslate( clonedSkipModuleKeys.push(clonedTranslationConfig.moduleKey); - const { newModuleKey, newFrom, newTo } = newTranslationModule( + const { + newModuleKey, + newFrom, + newTo, + skippedModuleKeys, + } = newTranslationModule( clonedTranslationConfig.moduleKey, clonedSkipModuleKeys, from, to ); + // add skippedModuleKeys to general skipModuleKeys + skippedModuleKeys.forEach(skippedModuleKey => { + clonedSkipModuleKeys.push(skippedModuleKey); + }); + let stop: boolean = !clonedTranslationConfig.fallback || newModuleKey === undefined; @@ -101,31 +111,41 @@ function newTranslationModule( newModuleKey: undefined, newFrom: undefined, newTo: undefined, + skippedModuleKeys: [], }; + const skippedModuleKeys: string[] = []; const allModuleKeys: string[] = translationModuleKeys(); - const result: string[] = allModuleKeys.filter( item => !skipModuleKeys.includes(item) ); - let newModuleKey = result[0]; - - if (!newModuleKey) { - return default_data; // default + if (result.length == 0) { + return default_data; } - let newFrom = getLanguageVariant(sourceModuleKeys, from, newModuleKey); - let newTo = getLanguageVariant(sourceModuleKeys, to, newModuleKey); + for (let i = 0; i < result.length; i++) { + let newModuleKey = result[i]; + + let newFrom = getLanguageVariant(sourceModuleKeys, from, newModuleKey); + let newTo = getLanguageVariant(sourceModuleKeys, to, newModuleKey); - if (!newFrom || !newTo) { - return default_data; // default + // if found valid newFrom & newTo, return + if (newFrom && newTo) { + return { + newModuleKey, + newFrom, + newTo, + skippedModuleKeys, + }; + } + // otherwise skip to next module, add key to skippedModuleKeys + else { + skippedModuleKeys.push(newModuleKey); + } } // has valid newModuleKey & from & to - return { - newModuleKey, - newFrom, - newTo, - }; + default_data.skippedModuleKeys = skippedModuleKeys as any; + return default_data; } diff --git a/src/modules/functions.ts b/src/modules/functions.ts index 6a87caa..6c63f9e 100644 --- a/src/modules/functions.ts +++ b/src/modules/functions.ts @@ -178,6 +178,18 @@ export async function translateWithGoogle2( return response.text; } +export async function translateWithGPT35Turbo( + str: string, + from: string, + to: string +) { + return translateWithGPT('gpt-3.5-turbo', str, from, to); +} + +export async function translateWithGPT4(str: string, from: string, to: string) { + return translateWithGPT('gpt-4', str, from, to); +} + export async function translateWithGPT4o( str: string, from: string, @@ -186,6 +198,14 @@ export async function translateWithGPT4o( return translateWithGPT('gpt-4o', str, from, to); } +export async function translateWithGPT4oMini( + str: string, + from: string, + to: string +) { + return translateWithGPT('gpt-4o-mini', str, from, to); +} + export async function translateWithGPT( model: string, str: string, diff --git a/src/modules/languages.ts b/src/modules/languages.ts index c4b2cee..7184ba1 100644 --- a/src/modules/languages.ts +++ b/src/modules/languages.ts @@ -523,24 +523,147 @@ export const GTPTranslateLanguages: Record = { }; export const LanguageMapping: Record> = { - Automatic: ['google', 'google2', 'libre', 'argos', 'bing', 'gpt4o'], - Afrikaans: ['google', 'google2', 'bing', 'gpt4o'], - Albanian: ['google', 'google2', 'bing', 'gpt4o'], - Amharic: ['google', 'google2', 'bing', 'gpt4o'], - Arabic: ['google', 'google2', 'libre', 'argos', 'bing', 'gpt4o'], + Automatic: [ + 'google', + 'google2', + 'libre', + 'argos', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Afrikaans: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Albanian: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Amharic: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Arabic: [ + 'google', + 'google2', + 'libre', + 'argos', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], Assamese: ['bing'], - Armenian: ['google', 'google2', 'bing', 'gpt4o'], - Azerbaijani: ['google', 'google2', 'libre', 'bing', 'gpt4o'], + Armenian: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Azerbaijani: [ + 'google', + 'google2', + 'libre', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], Bashkir: ['bing'], - Basque: ['google', 'google2', 'bing', 'gpt4o'], - Belarusian: ['google', 'google2', 'gpt4o'], - Bengali: ['google', 'google2', 'bing', 'gpt4o'], - Bosnian: ['google', 'google2', 'bing', 'gpt4o'], - Bulgarian: ['google', 'google2', 'bing', 'deepl', 'gpt4o'], + Basque: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Belarusian: [ + 'google', + 'google2', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Bengali: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Bosnian: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Bulgarian: [ + 'google', + 'google2', + 'bing', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], Cantonese_Traditional: ['bing'], - Catalan: ['google', 'google2', 'bing', 'gpt4o'], - Cebuano: ['google', 'google2', 'gpt4o'], - Chichewa: ['google', 'google2', 'gpt4o'], + Catalan: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Cebuano: [ + 'google', + 'google2', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Chichewa: [ + 'google', + 'google2', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], Chinese_Literary: ['bing'], Chinese_Simplified: [ 'google', @@ -549,119 +672,883 @@ export const LanguageMapping: Record> = { 'libre', 'argos', 'deepl', - 'gpt4o', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Chinese_Traditional: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Corsican: [ + 'google', + 'google2', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Croatian: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Czech: [ + 'google', + 'google2', + 'bing', + 'libre', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Danish: [ + 'google', + 'google2', + 'bing', + 'libre', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', ], - Chinese_Traditional: ['google', 'google2', 'bing', 'gpt4o'], - Corsican: ['google', 'google2', 'gpt4o'], - Croatian: ['google', 'google2', 'bing', 'gpt4o'], - Czech: ['google', 'google2', 'bing', 'libre', 'deepl', 'gpt4o'], - Danish: ['google', 'google2', 'bing', 'libre', 'deepl', 'gpt4o'], Dari: ['bing'], Divehi: ['bing'], - Dutch: ['google', 'google2', 'bing', 'libre', 'deepl', 'gpt4o'], - English: ['google', 'google2', 'bing', 'libre', 'argos', 'deepl', 'gpt4o'], - Esperanto: ['google', 'google2', 'libre', 'gpt4o'], - Estonian: ['google', 'google2', 'bing', 'deepl', 'gpt4o'], + Dutch: [ + 'google', + 'google2', + 'bing', + 'libre', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + English: [ + 'google', + 'google2', + 'bing', + 'libre', + 'argos', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Esperanto: [ + 'google', + 'google2', + 'libre', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Estonian: [ + 'google', + 'google2', + 'bing', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], Faroese: ['bing'], Fijian: ['bing'], - Filipino: ['google', 'google2', 'bing', 'gpt4o'], - Finnish: ['google', 'google2', 'bing', 'libre', 'deepl', 'gpt4o'], - French: ['google', 'google2', 'bing', 'libre', 'argos', 'deepl', 'gpt4o'], + Filipino: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Finnish: [ + 'google', + 'google2', + 'bing', + 'libre', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + French: [ + 'google', + 'google2', + 'bing', + 'libre', + 'argos', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], French_Canada: ['bing'], - Frisian: ['google', 'google2', 'gpt4o'], - Galician: ['google', 'google2', 'bing', 'gpt4o'], - Georgian: ['google', 'google2', 'bing', 'gpt4o'], - German: ['google', 'google2', 'bing', 'libre', 'argos', 'deepl', 'gpt4o'], - Greek: ['google', 'google2', 'bing', 'libre', 'deepl', 'gpt4o'], - Gujarati: ['google', 'google2', 'bing', 'gpt4o'], - Haitian_Creole: ['google', 'google2', 'bing', 'gpt4o'], - Hausa: ['google', 'google2', 'gpt4o'], - Hawaiian: ['google', 'google2', 'gpt4o'], - Hebrew: ['google', 'google2', 'bing', 'libre', 'gpt4o'], - Hindi: ['google', 'google2', 'bing', 'libre', 'argos', 'gpt4o'], - Hmong: ['google', 'google2', 'bing', 'gpt4o'], - Hungarian: ['google', 'google2', 'bing', 'libre', 'deepl', 'gpt4o'], - Icelandic: ['google', 'google2', 'bing', 'gpt4o'], - Igbo: ['google', 'google2', 'gpt4o'], - Indonesian: ['google', 'google2', 'bing', 'libre', 'argos', 'deepl', 'gpt4o'], + Frisian: [ + 'google', + 'google2', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Galician: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Georgian: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + German: [ + 'google', + 'google2', + 'bing', + 'libre', + 'argos', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Greek: [ + 'google', + 'google2', + 'bing', + 'libre', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Gujarati: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Haitian_Creole: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Hausa: [ + 'google', + 'google2', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Hawaiian: [ + 'google', + 'google2', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Hebrew: [ + 'google', + 'google2', + 'bing', + 'libre', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Hindi: [ + 'google', + 'google2', + 'bing', + 'libre', + 'argos', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Hmong: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Hungarian: [ + 'google', + 'google2', + 'bing', + 'libre', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Icelandic: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Igbo: [ + 'google', + 'google2', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Indonesian: [ + 'google', + 'google2', + 'bing', + 'libre', + 'argos', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], Inuinnaqtun: ['bing'], Inuktitut: ['bing'], Inuktitut_Latin: ['bing'], - Irish: ['google', 'google2', 'bing', 'libre', 'argos', 'gpt4o'], - Italian: ['google', 'google2', 'bing', 'libre', 'argos', 'deepl', 'gpt4o'], - Japanese: ['google', 'google2', 'bing', 'libre', 'argos', 'deepl', 'gpt4o'], - Javanese: ['google', 'google2', 'gpt4o'], - Kannada: ['google', 'google2', 'bing', 'gpt4o'], - Kazakh: ['google', 'google2', 'bing', 'gpt4o'], - Khmer: ['google', 'google2', 'bing', 'gpt4o'], + Irish: [ + 'google', + 'google2', + 'bing', + 'libre', + 'argos', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Italian: [ + 'google', + 'google2', + 'bing', + 'libre', + 'argos', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Japanese: [ + 'google', + 'google2', + 'bing', + 'libre', + 'argos', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Javanese: [ + 'google', + 'google2', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Kannada: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Kazakh: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Khmer: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], Klingon_Latin: ['bing'], - Korean: ['google', 'google2', 'bing', 'libre', 'argos', 'deepl', 'gpt4o'], - Kurdish_Kurmanji: ['google', 'google2', 'bing', 'gpt4o'], + Korean: [ + 'google', + 'google2', + 'bing', + 'libre', + 'argos', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Kurdish_Kurmanji: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], Kurdish_Northern: ['bing'], - Kyrgyz: ['google', 'google2', 'bing', 'gpt4o'], - Lao: ['google', 'google2', 'bing', 'gpt4o'], - Latin: ['google', 'google2', 'gpt4o'], - Latvian: ['google', 'google2', 'bing', 'deepl', 'gpt4o'], - Lithuanian: ['google', 'google2', 'bing', 'deepl', 'gpt4o'], - Luxembourgish: ['google', 'google2', 'gpt4o'], - Macedonian: ['google', 'google2', 'bing', 'gpt4o'], - Malagasy: ['google', 'google2', 'bing', 'gpt4o'], - Malay: ['google', 'google2', 'bing', 'gpt4o'], - Malayalam: ['google', 'google2', 'bing', 'gpt4o'], - Maltese: ['google', 'google2', 'bing', 'gpt4o'], - Maori: ['google', 'google2', 'bing', 'gpt4o'], - Marathi: ['google', 'google2', 'bing', 'gpt4o'], - Mongolian: ['google', 'google2', 'bing', 'gpt4o'], + Kyrgyz: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Lao: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Latin: [ + 'google', + 'google2', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Latvian: [ + 'google', + 'google2', + 'bing', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Lithuanian: [ + 'google', + 'google2', + 'bing', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Luxembourgish: [ + 'google', + 'google2', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Macedonian: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Malagasy: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Malay: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Malayalam: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Maltese: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Maori: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Marathi: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Mongolian: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], Mongolian_Cyrillic: ['bing'], - Myanmar_Burmese: ['google', 'google2', 'bing', 'gpt4o'], - Nepali: ['google', 'google2', 'bing', 'gpt4o'], - Norwegian: ['google', 'google2', 'bing', 'deepl', 'gpt4o'], + Myanmar_Burmese: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Nepali: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Norwegian: [ + 'google', + 'google2', + 'bing', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], Odia: ['bing'], - Pashto: ['google', 'google2', 'bing', 'gpt4o'], - Persian: ['google', 'google2', 'bing', 'libre', 'gpt4o'], - Polish: ['google', 'google2', 'bing', 'libre', 'argos', 'deepl', 'gpt4o'], - Portuguese: ['google', 'google2', 'bing', 'libre', 'argos', 'deepl', 'gpt4o'], + Pashto: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Persian: [ + 'google', + 'google2', + 'bing', + 'libre', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Polish: [ + 'google', + 'google2', + 'bing', + 'libre', + 'argos', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Portuguese: [ + 'google', + 'google2', + 'bing', + 'libre', + 'argos', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], Portuguese_Brazil: ['bing'], - Punjabi: ['google', 'google2', 'bing', 'gpt4o'], + Punjabi: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], Querétaro_Otomi: ['bing'], - Romanian: ['google', 'google2', 'bing', 'deepl', 'gpt4o'], - Russian: ['google', 'google2', 'bing', 'libre', 'argos', 'deepl', 'gpt4o'], - Samoan: ['google', 'google2', 'bing', 'gpt4o'], - Scots_Gaelic: ['google', 'google2', 'gpt4o'], - Serbian: ['google', 'google2', 'bing', 'gpt4o'], + Romanian: [ + 'google', + 'google2', + 'bing', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Russian: [ + 'google', + 'google2', + 'bing', + 'libre', + 'argos', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Samoan: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Scots_Gaelic: [ + 'google', + 'google2', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Serbian: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], Serbian_Cyrillic: ['bing'], - Sesotho: ['google', 'google2', 'gpt4o'], - Shona: ['google', 'google2', 'gpt4o'], - Sindhi: ['google', 'google2', 'gpt4o'], - Sinhala: ['google', 'google2', 'gpt4o'], - Slovak: ['google', 'google2', 'bing', 'libre', 'deepl', 'gpt4o'], - Slovenian: ['google', 'google2', 'bing', 'deepl', 'gpt4o'], - Somali: ['google', 'google2', 'bing', 'gpt4o'], - Spanish: ['google', 'google2', 'bing', 'libre', 'argos', 'deepl', 'gpt4o'], - Sundanese: ['google', 'google2', 'gpt4o'], - Swahili: ['google', 'google2', 'bing', 'gpt4o'], - Swedish: ['google', 'google2', 'bing', 'libre', 'deepl', 'gpt4o'], + Sesotho: [ + 'google', + 'google2', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Shona: [ + 'google', + 'google2', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Sindhi: [ + 'google', + 'google2', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Sinhala: [ + 'google', + 'google2', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Slovak: [ + 'google', + 'google2', + 'bing', + 'libre', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Slovenian: [ + 'google', + 'google2', + 'bing', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Somali: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Spanish: [ + 'google', + 'google2', + 'bing', + 'libre', + 'argos', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Sundanese: [ + 'google', + 'google2', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Swahili: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Swedish: [ + 'google', + 'google2', + 'bing', + 'libre', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], Tahitian: ['bing'], - Tajik: ['google', 'google2', 'gpt4o'], - Tamil: ['google', 'google2', 'bing', 'gpt4o'], + Tajik: [ + 'google', + 'google2', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Tamil: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], Tatar: ['bing'], - Telugu: ['google', 'google2', 'bing', 'gpt4o'], - Thai: ['google', 'google2', 'bing', 'gpt4o'], + Telugu: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Thai: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], Tibetan: ['bing'], Tigrinya: ['bing'], Tongan: ['bing'], - Turkish: ['google', 'google2', 'bing', 'libre', 'argos', 'deepl', 'gpt4o'], + Turkish: [ + 'google', + 'google2', + 'bing', + 'libre', + 'argos', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], Turkmen: ['bing'], - Ukrainian: ['google', 'google2', 'bing', 'libre', 'deepl', 'gpt4o'], + Ukrainian: [ + 'google', + 'google2', + 'bing', + 'libre', + 'deepl', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], Upper_Sorbian: ['bing'], - Urdu: ['google', 'google2', 'bing', 'gpt4o'], + Urdu: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], Uyghur: ['bing'], - Uzbek: ['google', 'google2', 'bing', 'gpt4o'], - Vietnamese: ['google', 'google2', 'bing', 'argos', 'gpt4o'], - Welsh: ['google', 'google2', 'bing', 'gpt4o'], - Xhosa: ['google', 'google2', 'gpt4o'], - Yiddish: ['google', 'google2', 'gpt4o'], - Yoruba: ['google', 'google2', 'gpt4o'], + Uzbek: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Vietnamese: [ + 'google', + 'google2', + 'bing', + 'argos', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Welsh: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Xhosa: [ + 'google', + 'google2', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Yiddish: [ + 'google', + 'google2', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], + Yoruba: [ + 'google', + 'google2', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], Yucatec_Maya: ['bing'], - Zulu: ['google', 'google2', 'bing', 'gpt4o'], + Zulu: [ + 'google', + 'google2', + 'bing', + 'gpt-4o', + 'gpt-3.5-turbo', + 'gpt-4', + 'gpt-4o-mini', + ], }; diff --git a/src/modules/modules.ts b/src/modules/modules.ts index be88f26..99c2ae6 100644 --- a/src/modules/modules.ts +++ b/src/modules/modules.ts @@ -5,7 +5,10 @@ import { translateWithArgos, translateWithDeepL, translateWithGoogle2, + translateWithGPT35Turbo, translateWithGPT4o, + translateWithGPT4, + translateWithGPT4oMini, } from './functions'; import { GoogleTranslateLanguages, @@ -76,11 +79,34 @@ export const TranslationModules: TranslationModules = { languages: DeepLTranslateLanguages, translate: translateWithDeepL, }, - gpt4o: { - name: 'AI model: gpt-4o model', - altName: '\x1b[33m**NEW**\x1b[0m AI model: gpt-4o model (104 languages)', + 'gpt-4o': { + name: 'gpt-4o model', + altName: 'AI model: gpt-4o model (104 languages)', requirements: ['"OPENAI_API_KEY" as env'], languages: GTPTranslateLanguages, translate: translateWithGPT4o, }, + 'gpt-3.5-turbo': { + name: 'gpt-3.5-turbo model', + altName: + '\x1b[33m**NEW**\x1b[0m AI model: gpt-3.5-turbo model (104 languages)', + requirements: ['"OPENAI_API_KEY" as env'], + languages: GTPTranslateLanguages, + translate: translateWithGPT35Turbo, + }, + 'gpt-4': { + name: 'gpt-4 model', + altName: '\x1b[33m**NEW**\x1b[0m AI model: gpt-4 model (104 languages)', + requirements: ['"OPENAI_API_KEY" as env'], + languages: GTPTranslateLanguages, + translate: translateWithGPT4, + }, + 'gpt-4o-mini': { + name: 'gpt-4o-mini model', + altName: + '\x1b[33m**NEW**\x1b[0m AI model: gpt-4o-mini model (104 languages)', + requirements: ['"OPENAI_API_KEY" as env'], + languages: GTPTranslateLanguages, + translate: translateWithGPT4oMini, + }, };