From 22e6af860daded3b1fd9a431e27fa927a50c99cc Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Mon, 22 Dec 2025 15:18:30 +0900 Subject: [PATCH 1/3] [Update] UI: Add Groq and OpenRouter components. --- .../config_page_setter/ui_config_setter.js | 56 ++++++++ src-ui/logics/ui_configs.js | 2 + .../setting_box/translation/Translation.jsx | 126 ++++++++++++++++++ 3 files changed, 184 insertions(+) diff --git a/src-ui/logics/configs/config_page_setter/ui_config_setter.js b/src-ui/logics/configs/config_page_setter/ui_config_setter.js index f3790a6c..0ffb7a89 100644 --- a/src-ui/logics/configs/config_page_setter/ui_config_setter.js +++ b/src-ui/logics/configs/config_page_setter/ui_config_setter.js @@ -314,6 +314,62 @@ export const SETTINGS_ARRAY = [ add_endpoint_run_array: ["from_backend"], base_endpoint_name: "selected_openai_model", }, + // Groq + { + Category: "Translation", + Base_Name: "GroqAuthKey", + default_value: "", + ui_template_id: "input", + logics_template_id: "get_set_delete", + base_endpoint_name: "groq_auth_key", + }, + { + Category: "Translation", + Base_Name: "SelectableGroqModelList", + default_value: [], + ui_template_id: "list", + logics_template_id: "get_set", + add_endpoint_run_array: ["from_backend"], + base_endpoint_name: "selectable_groq_model_list", + response_transform: "arrayToObject", + }, + { + Category: "Translation", + Base_Name: "SelectedGroqModel", + default_value: "", + ui_template_id: "select", + logics_template_id: "get_set", + add_endpoint_run_array: ["from_backend"], + base_endpoint_name: "selected_groq_model", + }, + // Open Router + { + Category: "Translation", + Base_Name: "OpenRouterAuthKey", + default_value: "", + ui_template_id: "input", + logics_template_id: "get_set_delete", + base_endpoint_name: "openrouter_auth_key", + }, + { + Category: "Translation", + Base_Name: "SelectableOpenRouterModelList", + default_value: [], + ui_template_id: "list", + logics_template_id: "get_set", + add_endpoint_run_array: ["from_backend"], + base_endpoint_name: "selectable_openrouter_model_list", + response_transform: "arrayToObject", + }, + { + Category: "Translation", + Base_Name: "SelectedOpenRouterModel", + default_value: "", + ui_template_id: "select", + logics_template_id: "get_set", + add_endpoint_run_array: ["from_backend"], + base_endpoint_name: "selected_openrouter_model", + }, // LM Studio { Category: "Translation", diff --git a/src-ui/logics/ui_configs.js b/src-ui/logics/ui_configs.js index 49b4239f..be6eb194 100644 --- a/src-ui/logics/ui_configs.js +++ b/src-ui/logics/ui_configs.js @@ -110,6 +110,8 @@ export const translator_status = [ { id: "Plamo_API", label: `Plamo API`, is_available: false }, { id: "Gemini_API", label: `Gemini API`, is_available: false }, { id: "OpenAI_API", label: `OpenAI API`, is_available: false }, + { id: "Groq_API", label: `Groq API`, is_available: false }, + { id: "OpenRouter_API", label: `OpenRouter API`, is_available: false }, { id: "LMStudio", label: `LMStudio`, is_available: false }, { id: "Ollama", label: `Ollama`, is_available: false }, ]; diff --git a/src-ui/views/app/config_page/setting_section/setting_box/translation/Translation.jsx b/src-ui/views/app/config_page/setting_section/setting_box/translation/Translation.jsx index c4bef2fb..b7e3b91e 100644 --- a/src-ui/views/app/config_page/setting_section/setting_box/translation/Translation.jsx +++ b/src-ui/views/app/config_page/setting_section/setting_box/translation/Translation.jsx @@ -49,6 +49,12 @@ export const Translation = () => { + + + + + + @@ -444,6 +450,126 @@ const OpenAIModelContainer = () => { }; +const GroqAuthKey_Box = () => { + const { t } = useI18n(); + const { currentGroqAuthKey, setGroqAuthKey, deleteGroqAuthKey } = useTranslation(); + + const { variable, onChangeFunction, saveFunction } = useSaveButtonLogic({ + variable: currentGroqAuthKey.data, + state: currentGroqAuthKey.state, + setFunction: setGroqAuthKey, + deleteFunction: deleteGroqAuthKey, + }); + + return ( + <> + + + ); +}; +const GroqModelContainer = () => { + const { t } = useI18n(); + const { + currentSelectableGroqModelList, + + currentSelectedGroqModel, + setSelectedGroqModel, + + currentGroqAuthKey, + } = useTranslation(); + + + const selectFunction = (selected_data) => { + setSelectedGroqModel(selected_data.selected_id); + }; + + let selected_label = (!currentGroqAuthKey.data && !currentSelectedGroqModel.data) + ? t("config_page.common.correct_auth_key_required") + : currentSelectedGroqModel.data; + + return ( + + ); +}; + + +const OpenRouterAuthKey_Box = () => { + const { t } = useI18n(); + const { currentOpenRouterAuthKey, setOpenRouterAuthKey, deleteOpenRouterAuthKey } = useTranslation(); + + const { variable, onChangeFunction, saveFunction } = useSaveButtonLogic({ + variable: currentOpenRouterAuthKey.data, + state: currentOpenRouterAuthKey.state, + setFunction: setOpenRouterAuthKey, + deleteFunction: deleteOpenRouterAuthKey, + }); + + return ( + <> + + + ); +}; +const OpenRouterModelContainer = () => { + const { t } = useI18n(); + const { + currentSelectableOpenRouterModelList, + + currentSelectedOpenRouterModel, + setSelectedOpenRouterModel, + + currentOpenRouterAuthKey, + } = useTranslation(); + + + const selectFunction = (selected_data) => { + setSelectedOpenRouterModel(selected_data.selected_id); + }; + + let selected_label = (!currentOpenRouterAuthKey.data && !currentSelectedOpenRouterModel.data) + ? t("config_page.common.correct_auth_key_required") + : currentSelectedOpenRouterModel.data; + + return ( + + ); +}; const LMStudioConnectionCheck_Box = () => { const { t } = useI18n(); From bf9b28d199c227504af3ca397750cf4f40d93afc Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Mon, 22 Dec 2025 16:00:19 +0900 Subject: [PATCH 2/3] [Fix] UI: Fix error handling for LMStudio and Ollama connections. --- src-ui/logics/_useBackendErrorHandling.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src-ui/logics/_useBackendErrorHandling.js b/src-ui/logics/_useBackendErrorHandling.js index b47cf00d..b7ae7f6b 100644 --- a/src-ui/logics/_useBackendErrorHandling.js +++ b/src-ui/logics/_useBackendErrorHandling.js @@ -211,7 +211,6 @@ export const _useBackendErrorHandling = () => { return; case "/set/data/selected_openai_model": - console.log(data); if (message === "OpenAI model is not valid") { updateSelectedOpenAIModel(data); showNotification_Error(message, { category_id: "selected_openai_model" }); @@ -344,15 +343,23 @@ export const _useBackendErrorHandling = () => { return; case "/run/lmstudio_connection": - updateIsLMStudioConnected(data); - showNotification_Error(message); - console.error(message); + if (message === "Cannot connect to LMStudio server") { + updateIsLMStudioConnected(data); + showNotification_Error(message, { category_id: "lmstudio_connection" }); + } else { + updateIsLMStudioConnected(data); + showNotification_Error(message, { category_id: "lmstudio_connection" }); + } return; case "/run/ollama_connection": - updateIsOllamaConnected(data); - showNotification_Error(message); - console.error(message); + if (message === "Cannot connect to ollama server") { + updateIsOllamaConnected(data); + showNotification_Error(message, { category_id: "ollama_connection" }); + } else { + updateIsOllamaConnected(data); + showNotification_Error(message, { category_id: "ollama_connection" }); + } return; default: From 316843f875471f37074e74316ae6e174e6b47c33 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Mon, 22 Dec 2025 16:25:11 +0900 Subject: [PATCH 3/3] [Fix] UI: Correct endpoint case for transcription receive error handling. --- src-ui/logics/_useBackendErrorHandling.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-ui/logics/_useBackendErrorHandling.js b/src-ui/logics/_useBackendErrorHandling.js index b7ae7f6b..4d494fe9 100644 --- a/src-ui/logics/_useBackendErrorHandling.js +++ b/src-ui/logics/_useBackendErrorHandling.js @@ -115,7 +115,7 @@ export const _useBackendErrorHandling = () => { } return; - case "/run/enable_transcription_send": + case "/run/enable_transcription_receive": if (message === "Transcription receive disabled due to VRAM overflow") { updateTranscriptionReceiveStatus(data); showNotification_Error("Transcription receive disabled due to VRAM overflow");