From 5021e7e6b7295930681c0f7161c169fb572dbc21 Mon Sep 17 00:00:00 2001 From: Mic Date: Tue, 22 Oct 2024 21:55:32 +0200 Subject: [PATCH] added getGPTWebModelString method --- js/mzta-utils.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/js/mzta-utils.js b/js/mzta-utils.js index ef604ba0..4c8bd8a9 100644 --- a/js/mzta-utils.js +++ b/js/mzta-utils.js @@ -112,6 +112,24 @@ export function sanitizeHtml(input) { return input.replace(/<(?!br\s*\/?)[^>]+>/gi, ''); } +export function getGPTWebModelString(model) { + model = model.toLowerCase().trim(); + switch (model) { + case 'GTP-4o': + return '4o'; + case 'o1-preview': + return 'o1-preview'; + case 'o1-mini': + return 'o1-mini'; + case 'gpt-4': + return '4'; + case 'gpt-4o-mini': + return '4o mini'; + default: + return '4o'; + } +} + export function i18nConditionalGet(str) { // if we are getting a string that starts with '__MSG_' and ends with '__' we return the translated string // using the browser.i18n API