diff --git a/public/img/01ai.svg b/public/img/01ai.svg new file mode 100644 index 000000000..317a5da59 --- /dev/null +++ b/public/img/01ai.svg @@ -0,0 +1,59 @@ + + + + + + + + + diff --git a/public/index.html b/public/index.html index c38e7b76d..2f9bee085 100644 --- a/public/index.html +++ b/public/index.html @@ -423,7 +423,7 @@ -
+
Temperature
@@ -488,7 +488,7 @@
-
+
Top P
@@ -2360,6 +2360,7 @@ + @@ -2890,6 +2891,23 @@ +
+

+ + 01.AI API Key + +

+
+ + +
+
+ For privacy reasons, your API key will be hidden after you reload the page. +
+

01.AI Model

+ +
diff --git a/public/script.js b/public/script.js index 499f5cc6f..8d5da9ae5 100644 --- a/public/script.js +++ b/public/script.js @@ -8289,6 +8289,11 @@ const CONNECT_API_MAP = { button: '#api_button_openai', source: chat_completion_sources.GROQ, }, + '01ai': { + selected: 'openai', + button: '#api_button_openai', + source: chat_completion_sources.ZEROONEAI, + }, 'infermaticai': { selected: 'textgenerationwebui', button: '#api_button_textgenerationwebui', diff --git a/public/scripts/RossAscends-mods.js b/public/scripts/RossAscends-mods.js index 3348a9e71..3a2761fd3 100644 --- a/public/scripts/RossAscends-mods.js +++ b/public/scripts/RossAscends-mods.js @@ -379,6 +379,7 @@ function RA_autoconnect(PrevApi) { || (secret_state[SECRET_KEYS.COHERE] && oai_settings.chat_completion_source == chat_completion_sources.COHERE) || (secret_state[SECRET_KEYS.PERPLEXITY] && oai_settings.chat_completion_source == chat_completion_sources.PERPLEXITY) || (secret_state[SECRET_KEYS.GROQ] && oai_settings.chat_completion_source == chat_completion_sources.GROQ) + || (secret_state[SECRET_KEYS.ZEROONEAI] && oai_settings.chat_completion_source == chat_completion_sources.ZEROONEAI) || (isValidUrl(oai_settings.custom_url) && oai_settings.chat_completion_source == chat_completion_sources.CUSTOM) ) { $('#api_button_openai').trigger('click'); @@ -476,8 +477,8 @@ export function dragElement(elmnt) { } const style = getComputedStyle(target); - height = parseInt(style.height) - width = parseInt(style.width) + height = parseInt(style.height); + width = parseInt(style.width); top = parseInt(style.top); left = parseInt(style.left); right = parseInt(style.right); diff --git a/public/scripts/openai.js b/public/scripts/openai.js index 37551dd34..440a37f04 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -181,6 +181,7 @@ export const chat_completion_sources = { COHERE: 'cohere', PERPLEXITY: 'perplexity', GROQ: 'groq', + ZEROONEAI: '01ai', }; const character_names_behavior = { @@ -251,6 +252,7 @@ const default_settings = { cohere_model: 'command-r', perplexity_model: 'llama-3-70b-instruct', groq_model: 'llama3-70b-8192', + zerooneai_model: 'yi-large', custom_model: '', custom_url: '', custom_include_body: '', @@ -329,6 +331,7 @@ const oai_settings = { cohere_model: 'command-r', perplexity_model: 'llama-3-70b-instruct', groq_model: 'llama3-70b-8192', + zerooneai_model: 'yi-large', custom_model: '', custom_url: '', custom_include_body: '', @@ -1470,6 +1473,8 @@ function getChatCompletionModel() { return oai_settings.perplexity_model; case chat_completion_sources.GROQ: return oai_settings.groq_model; + case chat_completion_sources.ZEROONEAI: + return oai_settings.zerooneai_model; default: throw new Error(`Unknown chat completion source: ${oai_settings.chat_completion_source}`); } @@ -1566,6 +1571,23 @@ function saveModelList(data) { $('#model_custom_select').val(model_list[0].id).trigger('change'); } } + + if (oai_settings.chat_completion_source == chat_completion_sources.ZEROONEAI) { + $('#model_01ai_select').empty(); + model_list.forEach((model) => { + $('#model_01ai_select').append( + $('