From dfc90508d1366a03b37772467aef965043922d52 Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Mon, 2 Jun 2025 15:07:33 +0900 Subject: [PATCH 01/41] [Fix] Controller: Handle VRAM overflow errors during translation and transcription processes. --- src-python/controller.py | 247 ++++++++++++++---- src-python/mainloop.py | 11 + src-python/model.py | 9 + .../transcription/transcription_whisper.py | 27 +- 4 files changed, 240 insertions(+), 54 deletions(-) diff --git a/src-python/controller.py b/src-python/controller.py index 89a07d3a..7adb1f87 100644 --- a/src-python/controller.py +++ b/src-python/controller.py @@ -259,17 +259,44 @@ class Controller: elif config.ENABLE_TRANSLATION is False: pass else: - translation, success = model.getInputTranslate(message, source_language=language) - if all(success) is not True: - self.changeToCTranslate2Process() - self.run( - 400, - self.run_mapping["error_translation_engine"], - { - "message":"Translation engine limit error", - "data": None - }, - ) + try: + translation, success = model.getInputTranslate(message, source_language=language) + if all(success) is not True: + self.changeToCTranslate2Process() + self.run( + 400, + self.run_mapping["error_translation_engine"], + { + "message":"Translation engine limit error", + "data": None + }, + ) + except Exception as e: + # VRAM不足エラーの検出 + is_vram_error, error_message = model.detectVRAMError(e) + if is_vram_error: + self.run( + 400, + self.run_mapping["error_translation_mic_vram_overflow"], + { + "message":"VRAM out of memory during translation of mic", + "data": error_message + }, + ) + # 翻訳機能をOFFにする + self.setDisableTranslation() + self.run( + 400, + self.run_mapping["enable_translation"], + { + "message":"Translation disabled due to VRAM overflow", + "data": False + }, + ) + return + else: + # その他のエラーは通常通り処理 + raise if config.CONVERT_MESSAGE_TO_ROMAJI is True or config.CONVERT_MESSAGE_TO_HIRAGANA is True: if config.SELECTED_TARGET_LANGUAGES[config.SELECTED_TAB_NO]["1"]["language"] == "Japanese": @@ -346,17 +373,44 @@ class Controller: elif config.ENABLE_TRANSLATION is False: pass else: - translation, success = model.getOutputTranslate(message, source_language=language) - if all(success) is not True: - self.changeToCTranslate2Process() - self.run( - 400, - self.run_mapping["error_translation_engine"], - { - "message":"Translation engine limit error", - "data": None - }, - ) + try: + translation, success = model.getOutputTranslate(message, source_language=language) + if all(success) is not True: + self.changeToCTranslate2Process() + self.run( + 400, + self.run_mapping["error_translation_engine"], + { + "message":"Translation engine limit error", + "data": None + }, + ) + except Exception as e: + # VRAM不足エラーの検出 + is_vram_error, error_message = model.detectVRAMError(e) + if is_vram_error: + self.run( + 400, + self.run_mapping["error_translation_speaker_vram_overflow"], + { + "message":"VRAM out of memory during translation of speaker", + "data": error_message + }, + ) + # 翻訳機能をOFFにする + self.setDisableTranslation() + self.run( + 400, + self.run_mapping["enable_translation"], + { + "message":"Translation disabled due to VRAM overflow", + "data": False + }, + ) + return + else: + # その他のエラーは通常通り処理 + raise if config.CONVERT_MESSAGE_TO_ROMAJI is True or config.CONVERT_MESSAGE_TO_HIRAGANA is True: if config.SELECTED_TARGET_LANGUAGES[config.SELECTED_TAB_NO]["1"]["language"] == "Japanese": @@ -417,26 +471,62 @@ class Controller: if config.ENABLE_TRANSLATION is False: pass else: - if config.USE_EXCLUDE_WORDS is True: - replacement_message, replacement_dict = self.replaceExclamationsWithRandom(message) - translation, success = model.getInputTranslate(replacement_message) + try: + if config.USE_EXCLUDE_WORDS is True: + replacement_message, replacement_dict = self.replaceExclamationsWithRandom(message) + translation, success = model.getInputTranslate(replacement_message) - message = self.removeExclamations(message) - for i in range(len(translation)): - translation[i] = self.restoreText(translation[i], replacement_dict) - else: - translation, success = model.getInputTranslate(message) + message = self.removeExclamations(message) + for i in range(len(translation)): + translation[i] = self.restoreText(translation[i], replacement_dict) + else: + translation, success = model.getInputTranslate(message) - if all(success) is not True: - self.changeToCTranslate2Process() - self.run( - 400, - self.run_mapping["error_translation_engine"], - { - "message":"Translation engine limit error", - "data": None - }, - ) + if all(success) is not True: + self.changeToCTranslate2Process() + self.run( + 400, + self.run_mapping["error_translation_engine"], + { + "message":"Translation engine limit error", + "data": None + }, + ) + except Exception as e: + # VRAM不足エラーの検出 + is_vram_error, error_message = model.detectVRAMError(e) + if is_vram_error: + self.run( + 400, + self.run_mapping["error_translation_chat_vram_overflow"], + { + "message":"VRAM out of memory during translation of chat", + "data": error_message + }, + ) + # 翻訳機能をOFFにする + self.setDisableTranslation() + self.run( + 400, + self.run_mapping["enable_translation"], + { + "message":"Translation disabled due to VRAM overflow", + "data": False + }, + ) + # エラー時は翻訳なしで返す + return {"status":200, + "result": + { + "id":id, + "message":message, + "translation":[], + "transliteration":[], + }, + } + else: + # その他のエラーは通常通り処理 + raise if config.CONVERT_MESSAGE_TO_ROMAJI is True or config.CONVERT_MESSAGE_TO_HIRAGANA is True: if config.SELECTED_TARGET_LANGUAGES[config.SELECTED_TAB_NO]["1"]["language"] == "Japanese": @@ -514,8 +604,21 @@ class Controller: @staticmethod def setSelectedTranslationComputeDevice(device:str, *args, **kwargs) -> dict: printLog("setSelectedTranslationComputeDevice", device) + pre_device = config.SELECTED_TRANSLATION_COMPUTE_DEVICE config.SELECTED_TRANSLATION_COMPUTE_DEVICE = device - model.changeTranslatorCTranslate2Model() + try: + model.changeTranslatorCTranslate2Model() + except Exception as e: + # VRAM不足エラーの検出(デバイス切り替え時) + is_vram_error, error_message = model.detectVRAMError(e) + if is_vram_error: + # 前のデバイス設定に戻す + printLog("VRAM error detected, reverting device setting") + config.SELECTED_TRANSLATION_COMPUTE_DEVICE = pre_device + model.changeTranslatorCTranslate2Model() + else: + # その他のエラーは通常通り処理 + errorLogging() return {"status":200,"result":config.SELECTED_TRANSLATION_COMPUTE_DEVICE} @staticmethod @@ -1628,8 +1731,35 @@ class Controller: while self.device_access_status is False: sleep(1) self.device_access_status = False - model.startMicTranscript(self.micMessage) - self.device_access_status = True + try: + model.startMicTranscript(self.micMessage) + except Exception as e: + # VRAM不足エラーの検出 + is_vram_error, error_message = model.detectVRAMError(e) + if is_vram_error: + self.run( + 400, + self.run_mapping["error_transcription_mic_vram_overflow"], + { + "message":"VRAM out of memory during mic transcription", + "data": error_message + }, + ) + # ここでマイクの音声認識を停止 + self.stopTranscriptionSendMessage() + self.run( + 400, + self.run_mapping["enable_transcription_send"], + { + "message":"Transcription send disabled due to VRAM overflow", + "data": False + }, + ) + else: + # その他のエラーは通常通り処理 + errorLogging() + finally: + self.device_access_status = True @staticmethod def stopTranscriptionSendMessage() -> None: @@ -1650,8 +1780,35 @@ class Controller: while self.device_access_status is False: sleep(1) self.device_access_status = False - model.startSpeakerTranscript(self.speakerMessage) - self.device_access_status = True + try: + model.startSpeakerTranscript(self.speakerMessage) + except Exception as e: + # VRAM不足エラーの検出 + is_vram_error, error_message = model.detectVRAMError(e) + if is_vram_error: + self.run( + 400, + self.run_mapping["error_transcription_speaker_vram_overflow"], + { + "message":"VRAM out of memory during speaker transcription", + "data": error_message + }, + ) + # ここでスピーカーの音声認識を停止 + self.stopTranscriptionReceiveMessage() + self.run( + 400, + self.run_mapping["enable_transcription_receive"], + { + "message":"Transcription receive disabled due to VRAM overflow", + "data": False + }, + ) + else: + # その他のエラーは通常通り処理 + errorLogging() + finally: + self.device_access_status = True @staticmethod def stopTranscriptionReceiveMessage() -> None: diff --git a/src-python/mainloop.py b/src-python/mainloop.py index 00bc8cb5..28207de5 100644 --- a/src-python/mainloop.py +++ b/src-python/mainloop.py @@ -11,6 +11,10 @@ from utils import printLog, printResponse, errorLogging, encodeBase64 # noqa: E4 logging.getLogger("huggingface_hub").setLevel(logging.ERROR) run_mapping = { + "enable_translation":"/run/enable_translation", + "enable_transcription_send":"/run/enable_transcription_send", + "enable_transcription_receive":"/run/enable_transcription_receive", + "connected_network":"/run/connected_network", "enable_ai_models":"/run/enable_ai_models", @@ -22,6 +26,13 @@ run_mapping = { "error_device":"/run/error_device", "error_translation_engine":"/run/error_translation_engine", + + "error_translation_chat_vram_overflow":"/run/error_translation_chat_vram_overflow", + "error_translation_mic_vram_overflow":"/run/error_translation_mic_vram_overflow", + "error_translation_speaker_vram_overflow":"/run/error_translation_speaker_vram_overflow", + "error_transcription_mic_vram_overflow":"/run/error_transcription_mic_vram_overflow", + "error_transcription_speaker_vram_overflow":"/run/error_transcription_speaker_vram_overflow", + "word_filter":"/run/word_filter", "download_progress_ctranslate2_weight":"/run/download_progress_ctranslate2_weight", diff --git a/src-python/model.py b/src-python/model.py index 3b4e51b6..b40936b5 100644 --- a/src-python/model.py +++ b/src-python/model.py @@ -509,6 +509,15 @@ class Model: if isinstance(self.mic_audio_recorder, SelectedMicEnergyAndAudioRecorder): self.mic_audio_recorder.pause() + # VRAM 不足エラーを検出するメソッドを追加 + def detectVRAMError(self, error): + error_str = str(error) + if isinstance(error, ValueError) and len(error.args) > 0 and error.args[0] == "VRAM_OUT_OF_MEMORY": + return True, error.args[1] if len(error.args) > 1 else "VRAM out of memory" + if "CUDA out of memory" in error_str or "CUBLAS_STATUS_ALLOC_FAILED" in error_str: + return True, error_str + return False, None + def changeMicTranscriptStatus(self): if config.VRC_MIC_MUTE_SYNC is True: match self.mic_mute_status: diff --git a/src-python/models/transcription/transcription_whisper.py b/src-python/models/transcription/transcription_whisper.py index 69499260..04f89626 100644 --- a/src-python/models/transcription/transcription_whisper.py +++ b/src-python/models/transcription/transcription_whisper.py @@ -77,15 +77,24 @@ def downloadWhisperWeight(root, weight_type, callback=None, end_callback=None): def getWhisperModel(root, weight_type, device="cpu", device_index=0): path = os_path.join(root, "weights", "whisper", weight_type) compute_type = getBestComputeType(device, device_index) - return WhisperModel( - path, - device=device, - device_index=device_index, - compute_type=compute_type, - cpu_threads=4, - num_workers=1, - local_files_only=True, - ) + try: + model = WhisperModel( + path, + device=device, + device_index=device_index, + compute_type=compute_type, + cpu_threads=4, + num_workers=1, + local_files_only=True, + ) + return model + except RuntimeError as e: + # VRAM不足エラーの検出 + error_message = str(e) + if "CUDA out of memory" in error_message or "CUBLAS_STATUS_ALLOC_FAILED" in error_message: + raise ValueError("VRAM_OUT_OF_MEMORY", error_message) + # その他のエラーは通常通り再送出 + raise if __name__ == "__main__": def callback(value): From bcef981955db69f9465f92e0c9bd177a391ee311 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Thu, 5 Jun 2025 18:11:53 +0900 Subject: [PATCH 02/41] [Update] Change the notification UI. (Change the base notification library from MUI to React-Toastify.) --- package-lock.json | 14 ++ package.json | 1 + .../app/error_boundary/AppErrorBoundary.jsx | 1 + .../AppErrorBoundary.module.scss | 1 + .../ReactToastifyOverrideClass.scss | 109 +++++++++++++++ .../SnackbarController.jsx | 130 +++++++++++++----- .../SnackbarController.module.scss | 94 +++++++++++-- .../app/splash_component/SplashComponent.jsx | 2 +- .../SplashComponent.module.scss | 2 +- src-ui/assets/error.svg | 1 + src-ui/logics/common/useNotificationStatus.js | 3 +- 11 files changed, 308 insertions(+), 50 deletions(-) create mode 100644 src-ui/app/snackbar_controller/ReactToastifyOverrideClass.scss create mode 100644 src-ui/assets/error.svg diff --git a/package-lock.json b/package-lock.json index f131d4a8..cbe6e142 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,6 +28,7 @@ "react-error-boundary": "5.0.0", "react-i18next": "15.5.1", "react-resizable-layout": "0.7.2", + "react-toastify": "11.0.5", "sass": "1.79.4", "semver": "7.7.1" }, @@ -5534,6 +5535,19 @@ "react-dom": ">=17.0.0" } }, + "node_modules/react-toastify": { + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-11.0.5.tgz", + "integrity": "sha512-EpqHBGvnSTtHYhCPLxML05NLY2ZX0JURbAdNYa6BUkk+amz4wbKBQvoKQAB0ardvSarUBuY4Q4s1sluAzZwkmA==", + "license": "MIT", + "dependencies": { + "clsx": "^2.1.1" + }, + "peerDependencies": { + "react": "^18 || ^19", + "react-dom": "^18 || ^19" + } + }, "node_modules/react-transition-group": { "version": "4.4.5", "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz", diff --git a/package.json b/package.json index a2d9030f..c15471e5 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "react-error-boundary": "5.0.0", "react-i18next": "15.5.1", "react-resizable-layout": "0.7.2", + "react-toastify": "11.0.5", "sass": "1.79.4", "semver": "7.7.1" }, diff --git a/src-ui/app/error_boundary/AppErrorBoundary.jsx b/src-ui/app/error_boundary/AppErrorBoundary.jsx index 4aeb34a2..37a1cc23 100644 --- a/src-ui/app/error_boundary/AppErrorBoundary.jsx +++ b/src-ui/app/error_boundary/AppErrorBoundary.jsx @@ -65,6 +65,7 @@ const ErrorContainer = ({error}) => { ); }; +// Duplicated const CloseButtonContainer = () => { const { asyncCloseApp } = useWindow(); return ( diff --git a/src-ui/app/error_boundary/AppErrorBoundary.module.scss b/src-ui/app/error_boundary/AppErrorBoundary.module.scss index 2abb2710..2ff85390 100644 --- a/src-ui/app/error_boundary/AppErrorBoundary.module.scss +++ b/src-ui/app/error_boundary/AppErrorBoundary.module.scss @@ -72,6 +72,7 @@ +// Duplicated .close_button_wrapper { position: absolute; top: 0; diff --git a/src-ui/app/snackbar_controller/ReactToastifyOverrideClass.scss b/src-ui/app/snackbar_controller/ReactToastifyOverrideClass.scss new file mode 100644 index 00000000..9325d747 --- /dev/null +++ b/src-ui/app/snackbar_controller/ReactToastifyOverrideClass.scss @@ -0,0 +1,109 @@ +:root { + --toastify-color-light: #fff; + --toastify-color-dark: var(--dark_950_color); + --toastify-color-info: var(--sent_400_color); + --toastify-color-success: var(--primary_400_color); + --toastify-color-warning: var(--waring_bc_color); + --toastify-color-error: var(--error_bc_color); + --toastify-color-transparent: rgba(255, 255, 255, 0.7); + + --toastify-icon-color-info: var(--toastify-color-info); + --toastify-icon-color-success: var(--toastify-color-success); + --toastify-icon-color-warning: var(--toastify-color-warning); + --toastify-icon-color-error: var(--toastify-color-error); + + --toastify-container-width: fit-content; + --toastify-toast-width: 32rem; + --toastify-toast-offset: 1.6rem; + --toastify-toast-top: max(var(--toastify-toast-offset), env(safe-area-inset-top)); + --toastify-toast-right: max(var(--toastify-toast-offset), env(safe-area-inset-right)); + --toastify-toast-left: max(var(--toastify-toast-offset), env(safe-area-inset-left)); + --toastify-toast-bottom: max(var(--toastify-toast-offset), env(safe-area-inset-bottom)); + --toastify-toast-background: #fff; + --toastify-toast-padding: 1.4rem; + --toastify-toast-min-height: 6.4rem; + --toastify-toast-max-height: 80rem; + --toastify-toast-bd-radius: 0.6rem; + --toastify-toast-shadow: .0 0.4rem 1.2rem rgba(0, 0, 0, 0.1); + --toastify-font-family: var(--font_family); + --toastify-z-index: 9999; + --toastify-text-color-light: #757575; + --toastify-text-color-dark: var(--dark_basic_text_color); + + /* Used only for colored theme */ + --toastify-text-color-info: var(--dark_basic_text_color); + --toastify-text-color-success: var(--dark_basic_text_color); + --toastify-text-color-warning: var(--dark_basic_text_color); + --toastify-text-color-error: var(--dark_basic_text_color); + + --toastify-spinner-color: #616161; + --toastify-spinner-color-empty-area: #e0e0e0; + --toastify-color-progress-light: linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #34aadc, #5856d6, #ff2d55); + --toastify-color-progress-dark: #bb86fc; + --toastify-color-progress-info: var(--toastify-color-info); + --toastify-color-progress-success: var(--toastify-color-success); + --toastify-color-progress-warning: var(--toastify-color-warning); + --toastify-color-progress-error: var(--toastify-color-error); + /* used to control the opacity of the progress trail */ + --toastify-color-progress-bgo: 0.2; +} + + +.Toastify__toast { + // -------------------------------------------------------- + // Default Settings + // -------------------------------------------------------- + position: relative; + touch-action: none; + // width: var(--toastify-toast-width); + min-height: var(--toastify-toast-min-height); + box-sizing: border-box; + margin-bottom: 1rem; + // padding: var(--toastify-toast-padding); + border-radius: 0.6rem; + box-shadow: none; + max-height: var(--toastify-toast-max-height); + // font-family: "Yu Gothic UI"; + // font-family: var(--toastify-font-family); + // z-index: 0; + // display: flex; + // flex: 1 auto; + // align-items: center; + word-break: break-word; + // -------------------------------------------------------- + // -------------------------------------------------------- + + + // Comment out above and override. Commented out is just for memorization. + overflow: hidden; + display: flex; + justify-content: start; + align-items: center; + font-size: 1.4rem; + width: fit-content; + max-width: 50vw; + padding-right: 4rem; + background-color: var(--dark_950_color); + gap: 0.6rem; +} + +.Toastify__progress-bar--success { + background: var(--success_bc_color); +} + +.Toastify__progress-bar--warning { + background: var(--warning_bc_color); +} + +.Toastify__progress-bar--error { + background: var(--error_bc_color); +} + + +.Toastify__toast-icon { + width: fit-content; + max-width: 2.8rem; + min-width: 2.8rem; + justify-content: center; + align-items: center; +} \ No newline at end of file diff --git a/src-ui/app/snackbar_controller/SnackbarController.jsx b/src-ui/app/snackbar_controller/SnackbarController.jsx index e503e695..28bd6325 100644 --- a/src-ui/app/snackbar_controller/SnackbarController.jsx +++ b/src-ui/app/snackbar_controller/SnackbarController.jsx @@ -1,46 +1,114 @@ +import React, { useEffect, useState } from "react"; +import { ToastContainer, toast, Bounce } from "react-toastify"; import clsx from "clsx"; -import Snackbar from "@mui/material/Snackbar"; -import Slide from "@mui/material/Slide"; +import "./ReactToastifyOverrideClass.scss"; import styles from "./SnackbarController.module.scss"; + +import XMarkSvg from "@images/cancel.svg?react"; +import WarningSvg from "@images/warning.svg?react"; +import MegaphoneSvg from "@images/megaphone.svg?react"; +import CheckMarkSvg from "@images/check_mark.svg?react"; +import ErrorSvg from "@images/error.svg?react"; + import { useNotificationStatus } from "@logics_common"; export const SnackbarController = () => { const { currentNotificationStatus, closeNotification } = useNotificationStatus(); - - const handleClose = (event, reason) => { - closeNotification(event, reason); - }; - - const snackbar_classname = clsx(styles.snackbar_content, { - [styles.is_success]: currentNotificationStatus.data.status === "success", - [styles.is_warning]: currentNotificationStatus.data.status === "warning", - [styles.is_error]: currentNotificationStatus.data.status === "error", - }); + const [containerKey, setContainerKey] = useState(0); const settings = currentNotificationStatus.data; - let hide_duration = 5000; - if (settings.options?.hide_duration === null) hide_duration = null; - if (Number(settings.options?.hide_duration)) hide_duration = settings.options.hide_duration; + const snackbar_classname = clsx( + styles.snackbar_content, + { + [styles.is_success]: settings.status === "success", + [styles.is_warning]: settings.status === "warning", + [styles.is_error]: settings.status === "error", + } + ); + + let hideDuration = 5000; + if (settings.options?.hide_duration === null) { + hideDuration = false; + } else if (Number(settings.options?.hide_duration)) { + hideDuration = Number(settings.options?.hide_duration); + } + + useEffect(() => { + if (!settings.is_open) return; + + const message_text = settings.message; + + if (toast.isActive(message_text)) { + setContainerKey(prevKey => prevKey + 1); + + setTimeout(() => { + toast(message_text, { + toastId: message_text, + type: settings.status, + autoClose: hideDuration, + transition: Bounce, + toastClassName: snackbar_classname, + progressClassName: styles.toast_progress, + closeButton: , + onClose: () => { + closeNotification(); + }, + }); + }, 50); + } else { + toast(message_text, { + toastId: message_text, + type: settings.status, + autoClose: hideDuration, + transition: Bounce, + toastClassName: snackbar_classname, + progressClassName: styles.toast_progress, + closeButton: , + onClose: () => { + closeNotification(); + }, + }); + } + }, [settings, hideDuration, closeNotification, snackbar_classname]); return ( -
- -
-

{settings.message}

-
-
-
+ { + switch (type) { + case "info": + return ; + case "error": + return ; + case "success": + return ; + case "warning": + return ; + default: + return null; + } + }} + /> ); }; -const SlideTransition = (props) => { - return ; -}; +const CloseButtonContainer = ({ closeToast }) => { + return ( + + ); +}; \ No newline at end of file diff --git a/src-ui/app/snackbar_controller/SnackbarController.module.scss b/src-ui/app/snackbar_controller/SnackbarController.module.scss index 075e4419..f048a6ba 100644 --- a/src-ui/app/snackbar_controller/SnackbarController.module.scss +++ b/src-ui/app/snackbar_controller/SnackbarController.module.scss @@ -1,19 +1,83 @@ +/* SnackbarController.module.scss */ + +/* ------------------------------------------------- + 1) トースト共通のスタイル +--------------------------------------------------*/ .snackbar_content { - width: 100%; - height: 100%; - padding: 2rem; - color: #fff; - &.is_success { - background-color: var(--success_bc_color); - } - &.is_warning { - background-color: var(--waring_bc_color); - } - &.is_error { - background-color: var(--error_bc_color); - } + position: relative; + padding: 1.2rem 1.6rem; + border-radius: 0.8rem; + font-size: 1.4rem; + box-shadow: 0 0.2rem 0.8rem rgba(0, 0, 0, 0.5); + color: #fff; /* ダークテーマ前提で文字を白に */ } -.snackbar_message { - font-size: 1.4rem; +/* ステータス別に背景色を指定 */ +.is_success { + background-color: var(--success_bc_color); +} + +.is_warning { + background-color: var(--warning_bc_color); + color: #212529; /* 黄系の背景に合わせて文字を濃く */ +} + +.is_error { + background-color: var(--error_bc_color); +} + + +.megaphone_svg { + color: var(--dark_200_color); + width: 2.4rem; +} +.error_svg { + color: var(--error_bc_color); + width: 2.4rem; +} +.check_mark_svg { + color: var(--primary_400_color); + width: 2rem; +} +.warning_svg { + color: var(--waring_color); + width: 2.4rem; +} + + + +// Duplicated (Customized) +.close_button_wrapper { + position: absolute; + top: 0; + left: 100%; + transform: translate(-50%, -50%) rotate(45deg); + display: flex; + justify-content: center; + align-items: end; + width: 5.6rem; + aspect-ratio: 1 / 1; + &:hover { + background-color: var(--error_bc_color); + & .x_mark_svg { + color: var(--dark_200_color); + transform: rotate(45deg); + } + } + &:active { + background-color: var(--error_bc_active_color); + } + transition: all 0.1s ease; +} + +.close_button { + // width: 100%; + // height: 100%; +} + +.x_mark_svg { + width: 2rem; + transform: rotate(-45deg); + color: var(--dark_700_color); + transition: transform 0.3s ease; } \ No newline at end of file diff --git a/src-ui/app/splash_component/SplashComponent.jsx b/src-ui/app/splash_component/SplashComponent.jsx index 2943bad0..809f917c 100644 --- a/src-ui/app/splash_component/SplashComponent.jsx +++ b/src-ui/app/splash_component/SplashComponent.jsx @@ -71,7 +71,7 @@ const AnnouncementsContainer = () => { }; - +// Duplicated const CloseButtonContainer = () => { const { asyncCloseApp } = useWindow(); diff --git a/src-ui/app/splash_component/SplashComponent.module.scss b/src-ui/app/splash_component/SplashComponent.module.scss index f279b21b..bae69063 100644 --- a/src-ui/app/splash_component/SplashComponent.module.scss +++ b/src-ui/app/splash_component/SplashComponent.module.scss @@ -67,7 +67,7 @@ } - +// Duplicated .close_button_wrapper { position: absolute; top: 0; diff --git a/src-ui/assets/error.svg b/src-ui/assets/error.svg new file mode 100644 index 00000000..4842a2a7 --- /dev/null +++ b/src-ui/assets/error.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src-ui/logics/common/useNotificationStatus.js b/src-ui/logics/common/useNotificationStatus.js index f4aab3ed..c623d091 100644 --- a/src-ui/logics/common/useNotificationStatus.js +++ b/src-ui/logics/common/useNotificationStatus.js @@ -35,8 +35,7 @@ export const useNotificationStatus = () => { }); }; - const closeNotification = (event, reason) => { - if (reason === "clickaway") return; + const closeNotification = () => { updateNotificationStatus((prev) => ({ ...prev.data, is_open: false, From ad0e87f5a1db538894d58d49a919358d5e5b1341 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Thu, 5 Jun 2025 22:04:40 +0900 Subject: [PATCH 03/41] [bugfix/Chore] Fix warning progress bar color that was not applied. --- src-ui/app/_index_css/variables.css | 4 +-- .../TranslatorSelectorOpenButton.module.scss | 2 +- .../PluginCompatibilityList.module.scss | 2 +- .../ReactToastifyOverrideClass.scss | 5 +++- .../SnackbarController.module.scss | 28 +++++++------------ 5 files changed, 18 insertions(+), 23 deletions(-) diff --git a/src-ui/app/_index_css/variables.css b/src-ui/app/_index_css/variables.css index ca2beca1..3ae80370 100644 --- a/src-ui/app/_index_css/variables.css +++ b/src-ui/app/_index_css/variables.css @@ -24,8 +24,8 @@ --error_bc_color: #bb4448; --error_bc_active_color: #9c3938; --success_bc_color: #368777; - --waring_color: #cb944f; - --waring_bc_color: #cf7b1b; + --warning_color: #cb944f; + --warning_bc_color: #cf7b1b; --dark_basic_text_color: #f2f2f2; --dark_100_color: #f5f7fb; diff --git a/src-ui/app/main_page/sidebar_section/language_settings/translator_selector_open_button/TranslatorSelectorOpenButton.module.scss b/src-ui/app/main_page/sidebar_section/language_settings/translator_selector_open_button/TranslatorSelectorOpenButton.module.scss index 6549c5b3..ed8a1ab7 100644 --- a/src-ui/app/main_page/sidebar_section/language_settings/translator_selector_open_button/TranslatorSelectorOpenButton.module.scss +++ b/src-ui/app/main_page/sidebar_section/language_settings/translator_selector_open_button/TranslatorSelectorOpenButton.module.scss @@ -31,5 +31,5 @@ margin-left: 0.2rem; padding-bottom: 0.2rem; width: 1.8rem; - color: var(--waring_color); + color: var(--warning_color); } \ No newline at end of file diff --git a/src-ui/app/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.module.scss b/src-ui/app/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.module.scss index 0b439619..a82112e1 100644 --- a/src-ui/app/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.module.scss +++ b/src-ui/app/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.module.scss @@ -54,7 +54,7 @@ .warning_svg { padding-bottom: 0.4rem; width: 2.4rem; - color: var(--waring_color); + color: var(--warning_color); flex-shrink: 0; } diff --git a/src-ui/app/snackbar_controller/ReactToastifyOverrideClass.scss b/src-ui/app/snackbar_controller/ReactToastifyOverrideClass.scss index 9325d747..75ad8e19 100644 --- a/src-ui/app/snackbar_controller/ReactToastifyOverrideClass.scss +++ b/src-ui/app/snackbar_controller/ReactToastifyOverrideClass.scss @@ -3,7 +3,7 @@ --toastify-color-dark: var(--dark_950_color); --toastify-color-info: var(--sent_400_color); --toastify-color-success: var(--primary_400_color); - --toastify-color-warning: var(--waring_bc_color); + --toastify-color-warning: var(--warning_bc_color); --toastify-color-error: var(--error_bc_color); --toastify-color-transparent: rgba(255, 255, 255, 0.7); @@ -87,6 +87,9 @@ gap: 0.6rem; } +.Toastify__progress-bar--wrp { + height: 0.4rem; +} .Toastify__progress-bar--success { background: var(--success_bc_color); } diff --git a/src-ui/app/snackbar_controller/SnackbarController.module.scss b/src-ui/app/snackbar_controller/SnackbarController.module.scss index f048a6ba..ebb18798 100644 --- a/src-ui/app/snackbar_controller/SnackbarController.module.scss +++ b/src-ui/app/snackbar_controller/SnackbarController.module.scss @@ -1,30 +1,22 @@ -/* SnackbarController.module.scss */ - -/* ------------------------------------------------- - 1) トースト共通のスタイル ---------------------------------------------------*/ .snackbar_content { position: relative; padding: 1.2rem 1.6rem; border-radius: 0.8rem; font-size: 1.4rem; box-shadow: 0 0.2rem 0.8rem rgba(0, 0, 0, 0.5); - color: #fff; /* ダークテーマ前提で文字を白に */ } -/* ステータス別に背景色を指定 */ -.is_success { - background-color: var(--success_bc_color); -} +// .is_success { +// background-color: var(--success_bc_color); +// } -.is_warning { - background-color: var(--warning_bc_color); - color: #212529; /* 黄系の背景に合わせて文字を濃く */ -} +// .is_warning { +// background-color: var(--warning_bc_color); +// } -.is_error { - background-color: var(--error_bc_color); -} +// .is_error { +// background-color: var(--error_bc_color); +// } .megaphone_svg { @@ -40,7 +32,7 @@ width: 2rem; } .warning_svg { - color: var(--waring_color); + color: var(--warning_color); width: 2.4rem; } From 0abeca4533204ef869edbdb98737763cc10d9788 Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Sat, 7 Jun 2025 16:26:32 +0900 Subject: [PATCH 04/41] [Add] Create release workflow for VRCT with GitHub Actions --- .github/workflows/release.yml | 75 +++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..f04f9aef --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,75 @@ +name: Release VRCT + +on: + push: + tags: + - 'v*' # タグが 'v' で始まる場合にトリガー (例: v1.0.0) + +jobs: + release: + name: Build VRCT + runs-on: windows-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' # プロジェクトに合わせて調整してください + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' # プロジェクトに合わせて調整してください + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable # プロジェクトに合わせて調整してください + profile: minimal + override: true + + - name: Install dependencies + run: npm install + + - name: Setup Python environment + run: npm run setup-python + + - name: Build and package + run: npm run release-all + + - name: Get version from tag + id: get_version + run: | + TAG_WITH_V="${GITHUB_REF#refs/tags/}" + echo "VERSION=${TAG_WITH_V#v}" >> $GITHUB_ENV + + - name: Upload to Hugging Face Hub + env: + HF_TOKEN: ${{ secrets.HF_TOKEN }} + run: | + pip install huggingface_hub + huggingface-cli upload misyaguziya/VRCT VRCT.zip VRCT.zip --repo-type dataset --commit-message "Upload VRCT.zip for version ${{ env.VERSION }}" + huggingface-cli upload misyaguziya/VRCT VRCT_cuda.zip VRCT_cuda.zip --repo-type dataset --commit-message "Upload VRCT_cuda.zip for version ${{ env.VERSION }}" + + - name: Create GitHub Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + - name: Upload Release Asset (NSIS Installer) + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./src-tauri/target/release/bundle/nsis/VRCT_${{ env.VERSION }}_x64-setup.exe + asset_name: VRCT_${{ env.VERSION }}_x64-setup.exe + asset_content_type: application/octet-stream From dfdb0812c352e977b294d51c9f8ec04e71c3a1b2 Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Sat, 7 Jun 2025 16:26:39 +0900 Subject: [PATCH 05/41] [Update] Bump version to 3.2.0 in tauri configuration --- src-tauri/tauri.conf.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 4d519488..b41c7fd1 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "VRCT", - "version": "3.0.0", + "version": "3.2.0", "identifier": "com.vrct.app", "build": { "beforeDevCommand": "", From a9cc7480ea72d29cb5efd8d81651a996139dace7 Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Sat, 7 Jun 2025 17:44:10 +0900 Subject: [PATCH 06/41] [Update] Change Node.js version to 22.15.0 in release workflow --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f04f9aef..6fc67de4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v4 with: - node-version: '20' # プロジェクトに合わせて調整してください + node-version: '22.15.0' # プロジェクトに合わせて調整してください - name: Set up Python uses: actions/setup-python@v5 From 205b5262da67f4232ef0b99303da37c1caa11587 Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Sat, 7 Jun 2025 18:15:41 +0900 Subject: [PATCH 07/41] [Add] Install Python script dependencies for tqdm --- .github/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6fc67de4..d6dca7c4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,6 +36,9 @@ jobs: - name: Setup Python environment run: npm run setup-python + - name: Install Python script dependencies + run: pip install tqdm + - name: Build and package run: npm run release-all From 1be2a1939f92d18d31f2f7e4a791e7b1f80465c2 Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Sat, 7 Jun 2025 19:57:36 +0900 Subject: [PATCH 08/41] [Update] Refactor version extraction in release workflow to use PowerShell syntax --- .github/workflows/release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d6dca7c4..2cbe8f32 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,9 +44,11 @@ jobs: - name: Get version from tag id: get_version + shell: pwsh # 明示的に PowerShell を指定 run: | - TAG_WITH_V="${GITHUB_REF#refs/tags/}" - echo "VERSION=${TAG_WITH_V#v}" >> $GITHUB_ENV + $TAG_WITH_V = $env:GITHUB_REF -replace "^refs/tags/", "" + $VERSION_NUM = $TAG_WITH_V -replace "^v", "" + echo "VERSION=$VERSION_NUM" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - name: Upload to Hugging Face Hub env: From 69af7fce22883ee1fe6305c3614cab9dc7ca0f38 Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Sat, 7 Jun 2025 21:09:02 +0900 Subject: [PATCH 09/41] [Update] Modify commit messages for Hugging Face uploads to include version release emoji --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2cbe8f32..8dbecba0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -55,8 +55,8 @@ jobs: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: | pip install huggingface_hub - huggingface-cli upload misyaguziya/VRCT VRCT.zip VRCT.zip --repo-type dataset --commit-message "Upload VRCT.zip for version ${{ env.VERSION }}" - huggingface-cli upload misyaguziya/VRCT VRCT_cuda.zip VRCT_cuda.zip --repo-type dataset --commit-message "Upload VRCT_cuda.zip for version ${{ env.VERSION }}" + huggingface-cli upload misyaguziya/VRCT VRCT.zip VRCT.zip --repo-type dataset --commit-message "👍️[Update] ${{ env.VERSION }} Release" + huggingface-cli upload misyaguziya/VRCT VRCT_cuda.zip VRCT_cuda.zip --repo-type dataset --commit-message "👍️[Update] ${{ env.VERSION }} Release" - name: Create GitHub Release id: create_release From f2ac3dc7680a3f172d387f0c6cac166e3eafa0d5 Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Sat, 7 Jun 2025 21:54:47 +0900 Subject: [PATCH 10/41] [Update] Clean up comments and ensure permissions are set for release job --- .github/workflows/release.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8dbecba0..9264cdc0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,6 +9,8 @@ jobs: release: name: Build VRCT runs-on: windows-latest + permissions: + contents: write steps: - name: Checkout code uses: actions/checkout@v4 @@ -16,17 +18,17 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v4 with: - node-version: '22.15.0' # プロジェクトに合わせて調整してください + node-version: '22.15.0' - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.11' # プロジェクトに合わせて調整してください + python-version: '3.11' - name: Set up Rust uses: actions-rs/toolchain@v1 with: - toolchain: stable # プロジェクトに合わせて調整してください + toolchain: stable profile: minimal override: true @@ -44,7 +46,7 @@ jobs: - name: Get version from tag id: get_version - shell: pwsh # 明示的に PowerShell を指定 + shell: pwsh run: | $TAG_WITH_V = $env:GITHUB_REF -replace "^refs/tags/", "" $VERSION_NUM = $TAG_WITH_V -replace "^v", "" From 636eb023929d94fd1da0ad1c558915d1e8175866 Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Sun, 8 Jun 2025 09:54:22 +0900 Subject: [PATCH 11/41] [Update] Fix Hugging Face upload repository path and set release name to version --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9264cdc0..daec6629 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,8 +57,8 @@ jobs: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: | pip install huggingface_hub - huggingface-cli upload misyaguziya/VRCT VRCT.zip VRCT.zip --repo-type dataset --commit-message "👍️[Update] ${{ env.VERSION }} Release" - huggingface-cli upload misyaguziya/VRCT VRCT_cuda.zip VRCT_cuda.zip --repo-type dataset --commit-message "👍️[Update] ${{ env.VERSION }} Release" + huggingface-cli upload ms-software/VRCT VRCT.zip VRCT.zip --repo-type dataset --commit-message "👍️[Update] ${{ env.VERSION }} Release" + huggingface-cli upload ms-software/VRCT VRCT_cuda.zip VRCT_cuda.zip --repo-type dataset --commit-message "👍️[Update] ${{ env.VERSION }} Release" - name: Create GitHub Release id: create_release @@ -67,7 +67,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} + release_name: ${{ env.VERSION }} draft: false prerelease: false From 05daf17a74f60be142be11778e142b1de0320a88 Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Sun, 8 Jun 2025 10:33:45 +0900 Subject: [PATCH 12/41] [Update] Refactor Hugging Face upload process to use temporary directory and add tagging for releases --- .github/workflows/release.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index daec6629..ff2362a1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -55,10 +55,20 @@ jobs: - name: Upload to Hugging Face Hub env: HF_TOKEN: ${{ secrets.HF_TOKEN }} + shell: pwsh # Explicitly use PowerShell for file operations run: | pip install huggingface_hub - huggingface-cli upload ms-software/VRCT VRCT.zip VRCT.zip --repo-type dataset --commit-message "👍️[Update] ${{ env.VERSION }} Release" - huggingface-cli upload ms-software/VRCT VRCT_cuda.zip VRCT_cuda.zip --repo-type dataset --commit-message "👍️[Update] ${{ env.VERSION }} Release" + + $UPLOAD_DIR = "./hf_upload_temp" + New-Item -ItemType Directory -Force -Path $UPLOAD_DIR + Copy-Item -Path ./VRCT.zip -Destination "$UPLOAD_DIR/VRCT.zip" + Copy-Item -Path ./VRCT_cuda.zip -Destination "$UPLOAD_DIR/VRCT_cuda.zip" + + huggingface-cli upload ms-software/VRCT $UPLOAD_DIR . --repo-type model --commit-message "👍️[Update] ${{ env.VERSION }} Release" + + huggingface-cli tag ms-software/VRCT ${{ github.ref_name }} --repo-type model --message "Release ${{ github.ref_name }}" + + Remove-Item -Recurse -Force $UPLOAD_DIR - name: Create GitHub Release id: create_release From 851e3b764074e8f22f191a990c4125e224836e01 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Mon, 9 Jun 2025 01:21:58 +0900 Subject: [PATCH 13/41] [Update] UI: Add VRAM overflow and out of memory error notifications and functions. --- src-ui/logics/_useBackendErrorHandling.js | 43 +++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src-ui/logics/_useBackendErrorHandling.js b/src-ui/logics/_useBackendErrorHandling.js index d5987a1b..053b7d8f 100644 --- a/src-ui/logics/_useBackendErrorHandling.js +++ b/src-ui/logics/_useBackendErrorHandling.js @@ -4,6 +4,10 @@ import { useNotificationStatus, } from "@logics_common"; +import { + useMainFunction, +} from "@logics_main"; + import { useMicRecordTimeout, useMicPhraseTimeout, @@ -24,6 +28,8 @@ export const _useBackendErrorHandling = () => { const { t } = useTranslation(); const { showNotification_Error } = useNotificationStatus(); + const { updateTranslationStatus, updateTranscriptionSendStatus, updateTranscriptionReceiveStatus } = useMainFunction(); + const { updateMicRecordTimeout } = useMicRecordTimeout(); const { updateMicPhraseTimeout } = useMicPhraseTimeout(); const { updateMicMaxWords } = useMicMaxWords(); @@ -70,6 +76,43 @@ export const _useBackendErrorHandling = () => { if (message === "Translation engine limit error") showNotification_Error(t("common_error.translation_limit")); return; + case "/run/enable_translation": + if (message === "Translation disabled due to VRAM overflow") { + updateTranslationStatus(data); + showNotification_Error("Translation disabled due to VRAM overflow"); + } + return; + + case "/run/enable_transcription_send": + if (message === "Transcription send disabled due to VRAM overflow") { + updateTranscriptionSendStatus(data); + showNotification_Error("Transcription send disabled due to VRAM overflow"); + } + return; + + case "/run/enable_transcription_send": + if (message === "Transcription receive disabled due to VRAM overflow") { + updateTranscriptionReceiveStatus(data); + showNotification_Error("Transcription receive disabled due to VRAM overflow"); + } + return; + + case "/run/error_translation_chat_vram_overflow": + if (message === "VRAM out of memory during translation of chat") showNotification_Error("VRAM out of memory during translation of chat"); + return; + case "/run/error_translation_mic_vram_overflow": + if (message === "VRAM out of memory during translation of mic") showNotification_Error("VRAM out of memory during translation of mic"); + return; + case "/run/error_translation_speaker_vram_overflow": + if (message === "VRAM out of memory during translation of speaker") showNotification_Error("VRAM out of memory during translation of speaker"); + return; + case "/run/error_transcription_mic_vram_overflow": + if (message === "VRAM out of memory during mic transcription") showNotification_Error("VRAM out of memory during mic transcription"); + return; + case "/run/error_transcription_speaker_vram_overflow": + if (message === "VRAM out of memory during speaker transcription") showNotification_Error("VRAM out of memory during speaker transcription"); + return; + case "/set/data/deepl_auth_key": if (message === "DeepL auth key length is not correct") { updateDeepLAuthKey(data); From 1f52c3625af99265ead86bd166ec401b121ad540 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Mon, 9 Jun 2025 12:35:40 +0900 Subject: [PATCH 14/41] [Refactor] Adjust color variables. Add some comments. --- src-ui/app/_index_css/variables.css | 10 +++++++--- .../SupportUsContainer.module.scss | 6 +++--- .../supporters_wrapper/SupportersWrapper.module.scss | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src-ui/app/_index_css/variables.css b/src-ui/app/_index_css/variables.css index 3ae80370..97a43d1c 100644 --- a/src-ui/app/_index_css/variables.css +++ b/src-ui/app/_index_css/variables.css @@ -18,12 +18,13 @@ --primary_600_color_44: #36877744; + /* primary_300_color 61b4a7 as standard */ --sent_400_color: #6197b4; - --sent_300_color: #6197b4; --received_300_color: #a861b4; + --error_bc_color: #bb4448; --error_bc_active_color: #9c3938; - --success_bc_color: #368777; + --success_bc_color: --primary_600_color; --warning_color: #cb944f; --warning_bc_color: #cf7b1b; @@ -60,6 +61,8 @@ --dark_1000_color_aa: #151517aa; --dark_1000_color_dd: #151517dd; + /*sent_400_color + #000 10% = */ + --supporters_color_fuwa: #5788a2; --title_bar_height: 2rem; --main_page_topbar_height: 4.8rem; @@ -68,4 +71,5 @@ --font_family: "Yu Gothic UI"; } -/* https://m2.material.io/design/color/the-color-system.html#tools-for-picking-colors */ \ No newline at end of file +/* https://m2.material.io/design/color/the-color-system.html#tools-for-picking-colors */ +/* https://meyerweb.com/eric/tools/color-blend/#::1:hex */ \ No newline at end of file diff --git a/src-ui/app/config_page/setting_section/setting_box/supporters/support_us_container/SupportUsContainer.module.scss b/src-ui/app/config_page/setting_section/setting_box/supporters/support_us_container/SupportUsContainer.module.scss index ef7ef6fc..1ef360b4 100644 --- a/src-ui/app/config_page/setting_section/setting_box/supporters/support_us_container/SupportUsContainer.module.scss +++ b/src-ui/app/config_page/setting_section/setting_box/supporters/support_us_container/SupportUsContainer.module.scss @@ -86,7 +86,7 @@ $progress_ease: cubic-bezier(0, 1, 0.75, 1); } .line_fuwa { - background-color: #5788a2; + background-color: var(--supporters_color_fuwa); animation: expandWidth 1s $progress_ease 0.6s forwards; } @@ -150,8 +150,8 @@ $progress_ease: cubic-bezier(0, 1, 0.75, 1); box-shadow: 0 0 0.4rem 0 var(--dark_800_color); } .spiral_top::after { - background: #5788a2; - box-shadow: 0 0 0.4rem 0 #5788a2; + background: var(--supporters_color_fuwa); + box-shadow: 0 0 0.4rem 0 var(--supporters_color_fuwa); } .spiral_bottom::before { background: var(--received_300_color); diff --git a/src-ui/app/config_page/setting_section/setting_box/supporters/supporters_container/supporters_wrapper/SupportersWrapper.module.scss b/src-ui/app/config_page/setting_section/setting_box/supporters/supporters_container/supporters_wrapper/SupportersWrapper.module.scss index 3d392642..73c28ea5 100644 --- a/src-ui/app/config_page/setting_section/setting_box/supporters/supporters_container/supporters_wrapper/SupportersWrapper.module.scss +++ b/src-ui/app/config_page/setting_section/setting_box/supporters/supporters_container/supporters_wrapper/SupportersWrapper.module.scss @@ -62,7 +62,7 @@ $progress_ease: cubic-bezier(0, 1, 0.75, 1); height: 4rem; aspect-ratio: 1 /1; border-radius: 50%; - background-color: #ffffff; + background-color: var(--dark_basic_text_color); overflow: hidden; position: relative; transition: transform 0.6s $progress_ease; @@ -236,7 +236,7 @@ $progress_ease: cubic-bezier(0, 1, 0.75, 1); background-color: var(--received_300_color); } &.fuwa_bar { - background-color: #5788a2; + background-color: var(--supporters_color_fuwa); } &.basic_bar { background-color: var(--dark_800_color); From 8289c9f1b346e70760db60cd723d753c935d39c9 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Mon, 9 Jun 2025 14:44:42 +0900 Subject: [PATCH 15/41] [bugfix] Config Page: Entry components: Prevent showing the currently stored value; instead, display the value the user intends to store. --- .../setting_box/advanced_settings/AdvancedSettings.jsx | 4 ++++ .../setting_section/setting_box/translation/Translation.jsx | 1 + 2 files changed, 5 insertions(+) diff --git a/src-ui/app/config_page/setting_section/setting_box/advanced_settings/AdvancedSettings.jsx b/src-ui/app/config_page/setting_section/setting_box/advanced_settings/AdvancedSettings.jsx index 2f4c15cd..4e7d798f 100644 --- a/src-ui/app/config_page/setting_section/setting_box/advanced_settings/AdvancedSettings.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/advanced_settings/AdvancedSettings.jsx @@ -50,6 +50,7 @@ const OscIpAddressContainer = () => { }; useEffect(()=> { + if (currentOscIpAddress.state === "pending") return; setInputValue(currentOscIpAddress.data); }, [currentOscIpAddress]); @@ -80,6 +81,7 @@ const OscPortContainer = () => { }; useEffect(()=> { + if (currentOscPort.state === "pending") return; setInputValue(currentOscPort.data); }, [currentOscPort]); @@ -169,6 +171,7 @@ const WebsocketHostContainer = () => { }; useEffect(()=> { + if (currentWebsocketHost.state === "pending") return; setInputValue(currentWebsocketHost.data); }, [currentWebsocketHost]); @@ -199,6 +202,7 @@ const WebsocketPortContainer = () => { }; useEffect(()=> { + if (currentWebsocketPort.state === "pending") return; setInputValue(currentWebsocketPort.data); }, [currentWebsocketPort]); diff --git a/src-ui/app/config_page/setting_section/setting_box/translation/Translation.jsx b/src-ui/app/config_page/setting_section/setting_box/translation/Translation.jsx index 5c4dfa51..db11d169 100644 --- a/src-ui/app/config_page/setting_section/setting_box/translation/Translation.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/translation/Translation.jsx @@ -134,6 +134,7 @@ const DeeplAuthKey_Box = () => { }; useEffect(() => { + if (currentDeepLAuthKey.state === "pending") return; seInputValue(currentDeepLAuthKey.data); }, [currentDeepLAuthKey]); From 35369f739474879653603064cb0bb51b771b29e2 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Mon, 9 Jun 2025 15:30:55 +0900 Subject: [PATCH 16/41] [Update/bugfix] Notification UI: Expand max width for readability. Line breaks now follow newline characters correctly. Fixed the bug that was success progress bar was not set properly. --- src-ui/app/_index_css/variables.css | 2 +- src-ui/app/snackbar_controller/ReactToastifyOverrideClass.scss | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src-ui/app/_index_css/variables.css b/src-ui/app/_index_css/variables.css index 97a43d1c..a5579afc 100644 --- a/src-ui/app/_index_css/variables.css +++ b/src-ui/app/_index_css/variables.css @@ -24,7 +24,7 @@ --error_bc_color: #bb4448; --error_bc_active_color: #9c3938; - --success_bc_color: --primary_600_color; + --success_bc_color: var(--primary_600_color); --warning_color: #cb944f; --warning_bc_color: #cf7b1b; diff --git a/src-ui/app/snackbar_controller/ReactToastifyOverrideClass.scss b/src-ui/app/snackbar_controller/ReactToastifyOverrideClass.scss index 75ad8e19..640a2116 100644 --- a/src-ui/app/snackbar_controller/ReactToastifyOverrideClass.scss +++ b/src-ui/app/snackbar_controller/ReactToastifyOverrideClass.scss @@ -81,10 +81,11 @@ align-items: center; font-size: 1.4rem; width: fit-content; - max-width: 50vw; + max-width: 70vw; padding-right: 4rem; background-color: var(--dark_950_color); gap: 0.6rem; + white-space: pre-wrap; } .Toastify__progress-bar--wrp { From f6216dbdbe087aaab74aa604b556c4fdcb93261f Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Mon, 9 Jun 2025 17:15:42 +0900 Subject: [PATCH 17/41] [Update] Enhance OSC Query handling by adding mute sync info flag and modifying disableOscQuery method --- src-python/controller.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src-python/controller.py b/src-python/controller.py index 89a07d3a..315113f5 100644 --- a/src-python/controller.py +++ b/src-python/controller.py @@ -1153,8 +1153,12 @@ class Controller: if model.getIsOscQueryEnabled() is True: self.enableOscQuery() else: - self.setDisableVrcMicMuteSync() - self.disableOscQuery() + mute_sync_info_flag = False + if config.VRC_MIC_MUTE_SYNC is True: + self.setDisableVrcMicMuteSync() + mute_sync_info_flag = True + self.disableOscQuery(mute_sync_info=mute_sync_info_flag) + response = {"status":200, "result":config.OSC_IP_ADDRESS} except Exception: model.setOscIpAddress(config.OSC_IP_ADDRESS) @@ -1933,12 +1937,13 @@ class Controller: } ) - def disableOscQuery(self): + def disableOscQuery(self, mute_sync_info:bool=False): + disabled_functions = [] + if mute_sync_info is True: + disabled_functions.append("vrc_mic_mute_sync") self.run(200, self.run_mapping["enable_osc_query"], { "data": False, - "disabled_functions": [ - "vrc_mic_mute_sync", - ] + "disabled_functions": disabled_functions }) def init(self, *args, **kwargs) -> None: @@ -2055,13 +2060,15 @@ class Controller: osc_query_enabled = model.getIsOscQueryEnabled() if osc_query_enabled is True: self.enableOscQuery() + if config.VRC_MIC_MUTE_SYNC is True: + self.setEnableVrcMicMuteSync() else: # OSC Query is disabled, so disable VRC some features - config.VRC_MIC_MUTE_SYNC = False - self.disableOscQuery() - - if config.VRC_MIC_MUTE_SYNC is True: - self.setEnableVrcMicMuteSync() + mute_sync_info_flag = False + if config.VRC_MIC_MUTE_SYNC is True: + self.setDisableVrcMicMuteSync() + mute_sync_info_flag = True + self.disableOscQuery(mute_sync_info=mute_sync_info_flag) # init Auto device selection printLog("Init Device Manager") From bc7f70729ac2a025dd4660bd90eef27ac779b412 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Tue, 10 Jun 2025 16:42:49 +0900 Subject: [PATCH 18/41] [Update] UI: OSC query availability: Update disable functions. --- src-ui/logics/common/useHandleOscQuery.js | 60 +++++++++++------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src-ui/logics/common/useHandleOscQuery.js b/src-ui/logics/common/useHandleOscQuery.js index 2e6b1681..61c2ba59 100644 --- a/src-ui/logics/common/useHandleOscQuery.js +++ b/src-ui/logics/common/useHandleOscQuery.js @@ -1,44 +1,44 @@ import { useTranslation } from "react-i18next"; import { useNotificationStatus } from "@logics_common"; -import { - useEnableVrcMicMuteSync, -} from "@logics_configs"; +import { useEnableVrcMicMuteSync } from "@logics_configs"; export const useHandleOscQuery = () => { const { t } = useTranslation(); - const { showNotification_Warning } = useNotificationStatus(); const { updateEnableVrcMicMuteSync } = useEnableVrcMicMuteSync(); - const handleOscQuery = ({is_osc_query_enabled, disabled_functions}) => { - if (!is_osc_query_enabled && disabled_functions.length > 0) { - const BASE_LABEL = t("common_warning.unable_to_use_osc_query"); - let items_label = ""; - - for (const disabled_function of disabled_functions) { - if (disabled_function === "vrc_mic_mute_sync") { - updateEnableVrcMicMuteSync({ - is_enabled: false, - is_available: false, - }); - const item = `- ${t("config_page.others.vrc_mic_mute_sync.label")}`; - items_label = `${items_label}\n${item}`; - } - } - const label = `${BASE_LABEL}${items_label}`; - showNotification_Warning( - label, - { hide_duration: 10000, } - ); - } else if (is_osc_query_enabled) { - updateEnableVrcMicMuteSync((old_value) => ({ - ...old_value.data, + const handleOscQuery = ({ is_osc_query_enabled, disabled_functions }) => { + if (is_osc_query_enabled) { + updateEnableVrcMicMuteSync(prev => ({ + ...prev.data, is_available: true, })); + return; + } + + if (!disabled_functions.length) { + updateEnableVrcMicMuteSync(prev => ({ + ...prev.data, + is_available: false, + })); + return; + } + + const items_label = disabled_functions + .filter(fn => fn === "vrc_mic_mute_sync") + .map(() => `- ${t("config_page.others.vrc_mic_mute_sync.label")}`) + .join("\n"); + + updateEnableVrcMicMuteSync({ + is_enabled: false, + is_available: false, + }); + + if (items_label) { + const message = `${t("common_warning.unable_to_use_osc_query")}\n${items_label}`; + showNotification_Warning(message, { hide_duration: 10000 }); } }; - return { - handleOscQuery, - }; + return { handleOscQuery }; }; \ No newline at end of file From 5c7c7308092d7998b755dd16cb4c20e48d24c5f0 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Tue, 10 Jun 2025 17:17:10 +0900 Subject: [PATCH 19/41] [Update] UI: Error Handling: VRC Mic Mute Sync: Add an error notification. --- src-ui/logics/_useBackendErrorHandling.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src-ui/logics/_useBackendErrorHandling.js b/src-ui/logics/_useBackendErrorHandling.js index d5987a1b..c1cdd15f 100644 --- a/src-ui/logics/_useBackendErrorHandling.js +++ b/src-ui/logics/_useBackendErrorHandling.js @@ -15,6 +15,8 @@ import { useDeepLAuthKey, + useEnableVrcMicMuteSync, + useOscIpAddress, useWebsocket, } from "@logics_configs"; @@ -34,6 +36,8 @@ export const _useBackendErrorHandling = () => { const { updateDeepLAuthKey } = useDeepLAuthKey(); + const { updateEnableVrcMicMuteSync } = useEnableVrcMicMuteSync(); + const { updateOscIpAddress } = useOscIpAddress(); const { updateEnableWebsocket, updateWebsocketHost, updateWebsocketPort } = useWebsocket(); @@ -130,6 +134,14 @@ export const _useBackendErrorHandling = () => { } return; + case "/set/enable/vrc_mic_mute_sync": + // Normally, this path shouldn't happen because VRC Mic Mute Sync is disabled and can't be turned on from the UI. + if (message === "Cannot enable VRC mic mute sync while OSC query is disabled") { + updateEnableVrcMicMuteSync(data); + showNotification_Error("Cannot enable VRC Mic Mute Sync while OSC query is disabled"); + } + return; + // Advanced Settings, error messages are set by Backend (EN only) case "/set/data/osc_ip_address": From f229d9ec95abb8073bb556c762d7b680450a81b5 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Tue, 10 Jun 2025 20:36:16 +0900 Subject: [PATCH 20/41] [Refactor] Organize files. --- src-ui/app/App.jsx | 21 ++++++++++++------- .../setting_box/_components/index.js | 3 +-- .../setting_box/plugins/Plugins.jsx | 2 +- .../PluginsControlComponent.jsx | 5 ++--- .../PluginsControlComponent.module.scss | 0 .../error_boundary/AppErrorBoundary.jsx | 0 .../AppErrorBoundary.module.scss | 0 .../contacts_container/ContactsContainer.jsx | 0 .../ContactsContainer.module.scss | 0 src-ui/app/others/index.js | 6 ++++++ .../modal_controller/ModalController.jsx | 0 .../ModalController.module.scss | 0 .../update_modal/UpdateModal.jsx | 0 .../update_modal/UpdateModal.module.scss | 0 .../PluginCompatibilityList.jsx | 0 .../PluginCompatibilityList.module.scss | 0 .../ReactToastifyOverrideClass.scss | 0 .../SnackbarController.jsx | 0 .../SnackbarController.module.scss | 0 .../splash_component/SplashComponent.jsx | 4 ++-- .../SplashComponent.module.scss | 0 .../DownloadModelsContainer.jsx | 0 .../DownloadModelsContainer.module.scss | 0 .../StartUpProgressContainer.jsx | 0 .../StartUpProgressContainer.module.scss | 0 .../updating_component/UpdatingComponent.jsx | 0 .../UpdatingComponent.module.scss | 0 .../window_title_bar/WindowTitleBar.jsx | 0 .../WindowTitleBar.module.scss | 0 29 files changed, 25 insertions(+), 16 deletions(-) rename src-ui/app/config_page/setting_section/setting_box/{_components => plugins}/plugins_control_component/PluginsControlComponent.jsx (94%) rename src-ui/app/config_page/setting_section/setting_box/{_components => plugins}/plugins_control_component/PluginsControlComponent.module.scss (100%) rename src-ui/app/{ => others}/error_boundary/AppErrorBoundary.jsx (100%) rename src-ui/app/{ => others}/error_boundary/AppErrorBoundary.module.scss (100%) rename src-ui/app/{ => others}/error_boundary/contacts_container/ContactsContainer.jsx (100%) rename src-ui/app/{ => others}/error_boundary/contacts_container/ContactsContainer.module.scss (100%) create mode 100644 src-ui/app/others/index.js rename src-ui/app/{ => others}/modal_controller/ModalController.jsx (100%) rename src-ui/app/{ => others}/modal_controller/ModalController.module.scss (100%) rename src-ui/app/{ => others}/modal_controller/update_modal/UpdateModal.jsx (100%) rename src-ui/app/{ => others}/modal_controller/update_modal/UpdateModal.module.scss (100%) rename src-ui/app/{ => others}/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.jsx (100%) rename src-ui/app/{ => others}/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.module.scss (100%) rename src-ui/app/{ => others}/snackbar_controller/ReactToastifyOverrideClass.scss (100%) rename src-ui/app/{ => others}/snackbar_controller/SnackbarController.jsx (100%) rename src-ui/app/{ => others}/snackbar_controller/SnackbarController.module.scss (100%) rename src-ui/app/{ => others}/splash_component/SplashComponent.jsx (94%) rename src-ui/app/{ => others}/splash_component/SplashComponent.module.scss (100%) rename src-ui/app/{ => others}/splash_component/download_models_container/DownloadModelsContainer.jsx (100%) rename src-ui/app/{ => others}/splash_component/download_models_container/DownloadModelsContainer.module.scss (100%) rename src-ui/app/{ => others}/splash_component/start_up_progress_container/StartUpProgressContainer.jsx (100%) rename src-ui/app/{ => others}/splash_component/start_up_progress_container/StartUpProgressContainer.module.scss (100%) rename src-ui/app/{ => others}/updating_component/UpdatingComponent.jsx (100%) rename src-ui/app/{ => others}/updating_component/UpdatingComponent.module.scss (100%) rename src-ui/app/{ => others}/window_title_bar/WindowTitleBar.jsx (100%) rename src-ui/app/{ => others}/window_title_bar/WindowTitleBar.module.scss (100%) diff --git a/src-ui/app/App.jsx b/src-ui/app/App.jsx index 7dc99689..ac9159e1 100644 --- a/src-ui/app/App.jsx +++ b/src-ui/app/App.jsx @@ -11,18 +11,23 @@ import { TransparencyController, CornerRadiusController, PluginsController, -} from "./_app_controllers/index.js"; +} from "./_app_controllers"; + +import styles from "./App.module.scss"; -import { WindowTitleBar } from "./window_title_bar/WindowTitleBar"; import { MainPage } from "./main_page/MainPage"; import { ConfigPage } from "./config_page/ConfigPage"; -import { SplashComponent } from "./splash_component/SplashComponent"; -import { UpdatingComponent } from "./updating_component/UpdatingComponent"; -import { ModalController } from "./modal_controller/ModalController"; -import { SnackbarController } from "./snackbar_controller/SnackbarController"; -import styles from "./App.module.scss"; + +import { + WindowTitleBar, + SplashComponent, + UpdatingComponent, + ModalController, + SnackbarController, + AppErrorBoundary, +} from "./others"; + import { useIsBackendReady, useIsSoftwareUpdating, useIsVrctAvailable, useWindow } from "@logics_common"; -import { AppErrorBoundary } from "./error_boundary/AppErrorBoundary"; export const App = () => { const { currentIsVrctAvailable } = useIsVrctAvailable(); diff --git a/src-ui/app/config_page/setting_section/setting_box/_components/index.js b/src-ui/app/config_page/setting_section/setting_box/_components/index.js index 178dbcec..7b695b35 100644 --- a/src-ui/app/config_page/setting_section/setting_box/_components/index.js +++ b/src-ui/app/config_page/setting_section/setting_box/_components/index.js @@ -12,5 +12,4 @@ export { Slider } from "./slider/Slider"; export { SwitchBox } from "./switch_box/SwitchBox"; export { ThresholdComponent } from "./threshold_component/ThresholdComponent"; export { WordFilter, WordFilterListToggleComponent } from "./word_filter/WordFilter"; -export { DownloadModels } from "./download_models/DownloadModels"; -export { PluginsControlComponent } from "./plugins_control_component/PluginsControlComponent"; \ No newline at end of file +export { DownloadModels } from "./download_models/DownloadModels"; \ No newline at end of file diff --git a/src-ui/app/config_page/setting_section/setting_box/plugins/Plugins.jsx b/src-ui/app/config_page/setting_section/setting_box/plugins/Plugins.jsx index 0d7f8693..9928fad1 100644 --- a/src-ui/app/config_page/setting_section/setting_box/plugins/Plugins.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/plugins/Plugins.jsx @@ -2,7 +2,7 @@ import { useEffect, useRef, useState, useCallback } from "react"; import { useTranslation } from "react-i18next"; import { usePlugins } from "@logics_configs"; import styles from "./Plugins.module.scss"; -import { PluginsControlComponent } from "../_components/plugins_control_component/PluginsControlComponent"; +import { PluginsControlComponent } from "./plugins_control_component/PluginsControlComponent"; import { useNotificationStatus } from "@logics_common"; import ExternalLink from "@images/external_link.svg?react"; diff --git a/src-ui/app/config_page/setting_section/setting_box/_components/plugins_control_component/PluginsControlComponent.jsx b/src-ui/app/config_page/setting_section/setting_box/plugins/plugins_control_component/PluginsControlComponent.jsx similarity index 94% rename from src-ui/app/config_page/setting_section/setting_box/_components/plugins_control_component/PluginsControlComponent.jsx rename to src-ui/app/config_page/setting_section/setting_box/plugins/plugins_control_component/PluginsControlComponent.jsx index c7c6ace0..94a90b50 100644 --- a/src-ui/app/config_page/setting_section/setting_box/_components/plugins_control_component/PluginsControlComponent.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/plugins/plugins_control_component/PluginsControlComponent.jsx @@ -1,6 +1,5 @@ -import React from "react"; -import { SwitchBox } from "../index"; -import { _DownloadButton } from "../_atoms/_download_button/_DownloadButton"; +import { SwitchBox } from "../../_components"; +import { _DownloadButton } from "../../_components/_atoms/_download_button/_DownloadButton"; import styles from "./PluginsControlComponent.module.scss"; import { useTranslation } from "react-i18next"; diff --git a/src-ui/app/config_page/setting_section/setting_box/_components/plugins_control_component/PluginsControlComponent.module.scss b/src-ui/app/config_page/setting_section/setting_box/plugins/plugins_control_component/PluginsControlComponent.module.scss similarity index 100% rename from src-ui/app/config_page/setting_section/setting_box/_components/plugins_control_component/PluginsControlComponent.module.scss rename to src-ui/app/config_page/setting_section/setting_box/plugins/plugins_control_component/PluginsControlComponent.module.scss diff --git a/src-ui/app/error_boundary/AppErrorBoundary.jsx b/src-ui/app/others/error_boundary/AppErrorBoundary.jsx similarity index 100% rename from src-ui/app/error_boundary/AppErrorBoundary.jsx rename to src-ui/app/others/error_boundary/AppErrorBoundary.jsx diff --git a/src-ui/app/error_boundary/AppErrorBoundary.module.scss b/src-ui/app/others/error_boundary/AppErrorBoundary.module.scss similarity index 100% rename from src-ui/app/error_boundary/AppErrorBoundary.module.scss rename to src-ui/app/others/error_boundary/AppErrorBoundary.module.scss diff --git a/src-ui/app/error_boundary/contacts_container/ContactsContainer.jsx b/src-ui/app/others/error_boundary/contacts_container/ContactsContainer.jsx similarity index 100% rename from src-ui/app/error_boundary/contacts_container/ContactsContainer.jsx rename to src-ui/app/others/error_boundary/contacts_container/ContactsContainer.jsx diff --git a/src-ui/app/error_boundary/contacts_container/ContactsContainer.module.scss b/src-ui/app/others/error_boundary/contacts_container/ContactsContainer.module.scss similarity index 100% rename from src-ui/app/error_boundary/contacts_container/ContactsContainer.module.scss rename to src-ui/app/others/error_boundary/contacts_container/ContactsContainer.module.scss diff --git a/src-ui/app/others/index.js b/src-ui/app/others/index.js new file mode 100644 index 00000000..80d702e7 --- /dev/null +++ b/src-ui/app/others/index.js @@ -0,0 +1,6 @@ +export { WindowTitleBar } from "./window_title_bar/WindowTitleBar.jsx"; +export { SplashComponent } from "./splash_component/SplashComponent.jsx"; +export { UpdatingComponent } from "./updating_component/UpdatingComponent.jsx"; +export { ModalController } from "./modal_controller/ModalController.jsx"; +export { SnackbarController } from "./snackbar_controller/SnackbarController.jsx"; +export { AppErrorBoundary } from "./error_boundary/AppErrorBoundary.jsx"; \ No newline at end of file diff --git a/src-ui/app/modal_controller/ModalController.jsx b/src-ui/app/others/modal_controller/ModalController.jsx similarity index 100% rename from src-ui/app/modal_controller/ModalController.jsx rename to src-ui/app/others/modal_controller/ModalController.jsx diff --git a/src-ui/app/modal_controller/ModalController.module.scss b/src-ui/app/others/modal_controller/ModalController.module.scss similarity index 100% rename from src-ui/app/modal_controller/ModalController.module.scss rename to src-ui/app/others/modal_controller/ModalController.module.scss diff --git a/src-ui/app/modal_controller/update_modal/UpdateModal.jsx b/src-ui/app/others/modal_controller/update_modal/UpdateModal.jsx similarity index 100% rename from src-ui/app/modal_controller/update_modal/UpdateModal.jsx rename to src-ui/app/others/modal_controller/update_modal/UpdateModal.jsx diff --git a/src-ui/app/modal_controller/update_modal/UpdateModal.module.scss b/src-ui/app/others/modal_controller/update_modal/UpdateModal.module.scss similarity index 100% rename from src-ui/app/modal_controller/update_modal/UpdateModal.module.scss rename to src-ui/app/others/modal_controller/update_modal/UpdateModal.module.scss diff --git a/src-ui/app/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.jsx b/src-ui/app/others/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.jsx similarity index 100% rename from src-ui/app/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.jsx rename to src-ui/app/others/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.jsx diff --git a/src-ui/app/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.module.scss b/src-ui/app/others/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.module.scss similarity index 100% rename from src-ui/app/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.module.scss rename to src-ui/app/others/modal_controller/update_modal/plugins_compatibility_list/PluginCompatibilityList.module.scss diff --git a/src-ui/app/snackbar_controller/ReactToastifyOverrideClass.scss b/src-ui/app/others/snackbar_controller/ReactToastifyOverrideClass.scss similarity index 100% rename from src-ui/app/snackbar_controller/ReactToastifyOverrideClass.scss rename to src-ui/app/others/snackbar_controller/ReactToastifyOverrideClass.scss diff --git a/src-ui/app/snackbar_controller/SnackbarController.jsx b/src-ui/app/others/snackbar_controller/SnackbarController.jsx similarity index 100% rename from src-ui/app/snackbar_controller/SnackbarController.jsx rename to src-ui/app/others/snackbar_controller/SnackbarController.jsx diff --git a/src-ui/app/snackbar_controller/SnackbarController.module.scss b/src-ui/app/others/snackbar_controller/SnackbarController.module.scss similarity index 100% rename from src-ui/app/snackbar_controller/SnackbarController.module.scss rename to src-ui/app/others/snackbar_controller/SnackbarController.module.scss diff --git a/src-ui/app/splash_component/SplashComponent.jsx b/src-ui/app/others/splash_component/SplashComponent.jsx similarity index 94% rename from src-ui/app/splash_component/SplashComponent.jsx rename to src-ui/app/others/splash_component/SplashComponent.jsx index 809f917c..a9ac4aeb 100644 --- a/src-ui/app/splash_component/SplashComponent.jsx +++ b/src-ui/app/others/splash_component/SplashComponent.jsx @@ -1,7 +1,7 @@ import { useState, useEffect } from "react"; import styles from "./SplashComponent.module.scss"; -import { StartUpProgressContainer } from "./start_up_progress_container/StartUpProgressContainer/"; -import { DownloadModelsContainer } from "./download_models_container/DownloadModelsContainer/"; +import { StartUpProgressContainer } from "./start_up_progress_container/StartUpProgressContainer"; +import { DownloadModelsContainer } from "./download_models_container/DownloadModelsContainer"; import MegaphoneSvg from "@images/megaphone.svg?react"; import XMarkSvg from "@images/cancel.svg?react"; import { useWindow } from "@logics_common"; diff --git a/src-ui/app/splash_component/SplashComponent.module.scss b/src-ui/app/others/splash_component/SplashComponent.module.scss similarity index 100% rename from src-ui/app/splash_component/SplashComponent.module.scss rename to src-ui/app/others/splash_component/SplashComponent.module.scss diff --git a/src-ui/app/splash_component/download_models_container/DownloadModelsContainer.jsx b/src-ui/app/others/splash_component/download_models_container/DownloadModelsContainer.jsx similarity index 100% rename from src-ui/app/splash_component/download_models_container/DownloadModelsContainer.jsx rename to src-ui/app/others/splash_component/download_models_container/DownloadModelsContainer.jsx diff --git a/src-ui/app/splash_component/download_models_container/DownloadModelsContainer.module.scss b/src-ui/app/others/splash_component/download_models_container/DownloadModelsContainer.module.scss similarity index 100% rename from src-ui/app/splash_component/download_models_container/DownloadModelsContainer.module.scss rename to src-ui/app/others/splash_component/download_models_container/DownloadModelsContainer.module.scss diff --git a/src-ui/app/splash_component/start_up_progress_container/StartUpProgressContainer.jsx b/src-ui/app/others/splash_component/start_up_progress_container/StartUpProgressContainer.jsx similarity index 100% rename from src-ui/app/splash_component/start_up_progress_container/StartUpProgressContainer.jsx rename to src-ui/app/others/splash_component/start_up_progress_container/StartUpProgressContainer.jsx diff --git a/src-ui/app/splash_component/start_up_progress_container/StartUpProgressContainer.module.scss b/src-ui/app/others/splash_component/start_up_progress_container/StartUpProgressContainer.module.scss similarity index 100% rename from src-ui/app/splash_component/start_up_progress_container/StartUpProgressContainer.module.scss rename to src-ui/app/others/splash_component/start_up_progress_container/StartUpProgressContainer.module.scss diff --git a/src-ui/app/updating_component/UpdatingComponent.jsx b/src-ui/app/others/updating_component/UpdatingComponent.jsx similarity index 100% rename from src-ui/app/updating_component/UpdatingComponent.jsx rename to src-ui/app/others/updating_component/UpdatingComponent.jsx diff --git a/src-ui/app/updating_component/UpdatingComponent.module.scss b/src-ui/app/others/updating_component/UpdatingComponent.module.scss similarity index 100% rename from src-ui/app/updating_component/UpdatingComponent.module.scss rename to src-ui/app/others/updating_component/UpdatingComponent.module.scss diff --git a/src-ui/app/window_title_bar/WindowTitleBar.jsx b/src-ui/app/others/window_title_bar/WindowTitleBar.jsx similarity index 100% rename from src-ui/app/window_title_bar/WindowTitleBar.jsx rename to src-ui/app/others/window_title_bar/WindowTitleBar.jsx diff --git a/src-ui/app/window_title_bar/WindowTitleBar.module.scss b/src-ui/app/others/window_title_bar/WindowTitleBar.module.scss similarity index 100% rename from src-ui/app/window_title_bar/WindowTitleBar.module.scss rename to src-ui/app/others/window_title_bar/WindowTitleBar.module.scss From 1fcb765ca06bac67a6af6cbd91996e92ca99c633 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Wed, 11 Jun 2025 18:34:13 +0900 Subject: [PATCH 21/41] [Refactor] Change aliases and move test_data.js. --- test_data.js => src-ui/_test_data.js | 2 +- .../StartPythonController.jsx | 39 +++++++++++++++++-- src-ui/logics/common/useMessage.js | 2 +- src-ui/logics/common/useOpenFolder.js | 2 +- src-ui/logics/common/useSoftwareVersion.js | 2 +- src-ui/logics/common/useUpdateSoftware.js | 2 +- src-ui/logics/common/useVolume.js | 2 +- src-ui/logics/common/useWindow.js | 2 +- .../advanced_settings/useOscIpAddress.js | 2 +- .../configs/advanced_settings/useOscPort.js | 2 +- .../configs/advanced_settings/useWebsocket.js | 2 +- .../appearance/useMessageLogUiScaling.js | 2 +- .../appearance/useRestoreWindowGeometry.js | 2 +- .../appearance/useSelectedFontFamily.js | 2 +- .../appearance/useSendMessageButtonType.js | 2 +- .../configs/appearance/useTransparency.js | 2 +- .../configs/appearance/useUiLanguage.js | 2 +- .../logics/configs/appearance/useUiScaling.js | 2 +- .../configs/device/useEnableAutoMicSelect.js | 2 +- .../device/useEnableAutoSpeakerSelect.js | 2 +- .../logics/configs/device/useMicDeviceList.js | 2 +- .../logics/configs/device/useMicHostList.js | 2 +- .../logics/configs/device/useMicThreshold.js | 2 +- .../configs/device/useSelectedMicDevice.js | 2 +- .../configs/device/useSelectedMicHost.js | 2 +- .../device/useSelectedSpeakerDevice.js | 2 +- .../configs/device/useSpeakerDeviceList.js | 2 +- .../configs/device/useSpeakerThreshold.js | 2 +- src-ui/logics/configs/hotkeys/useHotkeys.js | 2 +- .../useEnableAutoClearMessageInputBox.js | 2 +- .../others/useEnableAutoExportMessageLogs.js | 2 +- .../others/useEnableNotificationVrcSfx.js | 2 +- .../others/useEnableSendMessageToVrc.js | 2 +- .../useEnableSendOnlyTranslatedMessages.js | 2 +- .../useEnableSendReceivedMessageToVrc.js | 2 +- .../configs/others/useEnableVrcMicMuteSync.js | 2 +- .../others/useSendMessageButtonType.js | 2 +- src-ui/logics/configs/plugins/usePlugins.js | 2 +- .../configs/transcription/useMicMaxWords.js | 2 +- .../transcription/useMicPhraseTimeout.js | 2 +- .../transcription/useMicRecordTimeout.js | 2 +- .../transcription/useMicWordFilterList.js | 2 +- .../useSelectableWhisperComputeDeviceList.js | 2 +- .../useSelectedTranscriptionEngine.js | 2 +- .../useSelectedWhisperComputeDevice.js | 2 +- .../useSelectedWhisperWeightType.js | 2 +- .../transcription/useSpeakerMaxWords.js | 2 +- .../transcription/useSpeakerPhraseTimeout.js | 2 +- .../transcription/useSpeakerRecordTimeout.js | 2 +- .../useWhisperWeightTypeStatus.js | 2 +- .../useCTranslate2WeightTypeStatus.js | 2 +- .../configs/translation/useDeepLAuthKey.js | 2 +- ...eSelectableCTranslate2ComputeDeviceList.js | 2 +- .../useSelectedCTranslate2ComputeDevice.js | 2 +- .../useSelectedCTranslate2WeightType.js | 2 +- .../configs/vr/useIsEnabledOverlayLargeLog.js | 2 +- .../configs/vr/useIsEnabledOverlaySmallLog.js | 2 +- .../configs/vr/useOverlayLargeLogSettings.js | 2 +- .../useOverlayShowOnlyTranslatedMessages.js | 2 +- .../configs/vr/useOverlaySmallLogSettings.js | 2 +- .../logics/configs/vr/useSendTextToOverlay.js | 2 +- .../logics/main/useIsMainPageCompactMode.js | 2 +- src-ui/logics/main/useLanguageSettings.js | 2 +- src-ui/logics/main/useMainFunction.js | 2 +- src-ui/logics/main/useMessageInputBoxRatio.js | 2 +- .../logics/main/useSelectableLanguageList.js | 2 +- src-ui/logics/useStartPython.js | 34 ---------------- src-ui/store.js | 7 ++-- vite.config.js | 4 +- 69 files changed, 108 insertions(+), 106 deletions(-) rename test_data.js => src-ui/_test_data.js (95%) delete mode 100644 src-ui/logics/useStartPython.js diff --git a/test_data.js b/src-ui/_test_data.js similarity index 95% rename from test_data.js rename to src-ui/_test_data.js index ba53cb7e..d2e1723c 100644 --- a/test_data.js +++ b/src-ui/_test_data.js @@ -1,4 +1,4 @@ -export const generateTestData = (num) => { +export const generateTestConversationData = (num) => { const testDataArray = []; const messagesJa = [ "今日はとてもいい天気ですね。", diff --git a/src-ui/app/_app_controllers/StartPythonController.jsx b/src-ui/app/_app_controllers/StartPythonController.jsx index c351120c..55824bc8 100644 --- a/src-ui/app/_app_controllers/StartPythonController.jsx +++ b/src-ui/app/_app_controllers/StartPythonController.jsx @@ -1,11 +1,16 @@ import { invoke } from "@tauri-apps/api/core"; +import { Command } from "@tauri-apps/plugin-shell"; import { useEffect, useRef } from "react"; -import { useStartPython } from "@logics/useStartPython"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; -import { useStore_SelectableFontFamilyList } from "@store"; +import { useStdoutToPython } from "@useStdoutToPython"; +import { useReceiveRoutes } from "@useReceiveRoutes"; +import { store, useStore_SelectableFontFamilyList } from "@store"; import { arrayToObject } from "@utils"; +import { + useNotificationStatus, +} from "@logics_common"; + export const StartPythonController = () => { const { asyncStartPython } = useStartPython(); const hasRunRef = useRef(false); @@ -26,6 +31,34 @@ export const StartPythonController = () => { return null; }; +const useStartPython = () => { + const { receiveRoutes } = useReceiveRoutes(); + const { showNotification_Success, showNotification_Error } = useNotificationStatus(); + + const asyncStartPython = async () => { + const command = Command.sidecar("bin/VRCT-sidecar"); + command.on("error", error => console.error(`error: "${error}"`)); + command.stdout.on("data", (line) => { + let parsed_data = ""; + try { + parsed_data = JSON.parse(line); + receiveRoutes(parsed_data); + } catch (error) { + console.log(error, line); + } + }); + command.stderr.on("data", line => { + showNotification_Error( + `An error occurred. Please restart VRCT or contact the developers. The last line:${JSON.stringify(line)}`, { hide_duration: null }); + console.error("stderr", line); + }); + const backend_subprocess = await command.spawn(); + store.backend_subprocess = backend_subprocess; + }; + + return { asyncStartPython }; +}; + const useAsyncFetchFonts = () => { const { updateSelectableFontFamilyList } = useStore_SelectableFontFamilyList(); const asyncFetchFonts = async () => { diff --git a/src-ui/logics/common/useMessage.js b/src-ui/logics/common/useMessage.js index 416555a6..841c90dc 100644 --- a/src-ui/logics/common/useMessage.js +++ b/src-ui/logics/common/useMessage.js @@ -3,7 +3,7 @@ import { useStore_MessageInputValue, } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useMessage = () => { const { currentMessageLogs, addMessageLogs, updateMessageLogs } = useStore_MessageLogs(); diff --git a/src-ui/logics/common/useOpenFolder.js b/src-ui/logics/common/useOpenFolder.js index 202ef5ad..fa991f03 100644 --- a/src-ui/logics/common/useOpenFolder.js +++ b/src-ui/logics/common/useOpenFolder.js @@ -1,4 +1,4 @@ -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useOpenFolder = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/common/useSoftwareVersion.js b/src-ui/logics/common/useSoftwareVersion.js index 18f24a7f..25c257d5 100644 --- a/src-ui/logics/common/useSoftwareVersion.js +++ b/src-ui/logics/common/useSoftwareVersion.js @@ -1,7 +1,7 @@ import semver from "semver"; import { useStore_SoftwareVersion, useStore_LatestSoftwareVersionInfo } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useSoftwareVersion = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/common/useUpdateSoftware.js b/src-ui/logics/common/useUpdateSoftware.js index f3d2f1cf..208cbf30 100644 --- a/src-ui/logics/common/useUpdateSoftware.js +++ b/src-ui/logics/common/useUpdateSoftware.js @@ -1,4 +1,4 @@ -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useUpdateSoftware = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/common/useVolume.js b/src-ui/logics/common/useVolume.js index b3e2165b..ce94a391 100644 --- a/src-ui/logics/common/useVolume.js +++ b/src-ui/logics/common/useVolume.js @@ -5,7 +5,7 @@ import { useStore_SpeakerThresholdCheckStatus, } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useVolume = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/common/useWindow.js b/src-ui/logics/common/useWindow.js index 88182dd6..9585d0df 100644 --- a/src-ui/logics/common/useWindow.js +++ b/src-ui/logics/common/useWindow.js @@ -1,6 +1,6 @@ import { useEffect, useRef } from "react"; import { currentMonitor, availableMonitors, PhysicalPosition, PhysicalSize } from "@tauri-apps/api/window"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; import { useStore_IsBreakPoint } from "@store"; import { useUiScaling } from "@logics_configs"; import { store } from "@store"; diff --git a/src-ui/logics/configs/advanced_settings/useOscIpAddress.js b/src-ui/logics/configs/advanced_settings/useOscIpAddress.js index 702a6d98..8fe1ae06 100644 --- a/src-ui/logics/configs/advanced_settings/useOscIpAddress.js +++ b/src-ui/logics/configs/advanced_settings/useOscIpAddress.js @@ -1,5 +1,5 @@ import { useStore_OscIpAddress } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useOscIpAddress = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/advanced_settings/useOscPort.js b/src-ui/logics/configs/advanced_settings/useOscPort.js index d3e28557..0710021c 100644 --- a/src-ui/logics/configs/advanced_settings/useOscPort.js +++ b/src-ui/logics/configs/advanced_settings/useOscPort.js @@ -1,5 +1,5 @@ import { useStore_OscPort } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; import { useNotificationStatus } from "@logics_common"; export const useOscPort = () => { diff --git a/src-ui/logics/configs/advanced_settings/useWebsocket.js b/src-ui/logics/configs/advanced_settings/useWebsocket.js index 51361489..2002b78d 100644 --- a/src-ui/logics/configs/advanced_settings/useWebsocket.js +++ b/src-ui/logics/configs/advanced_settings/useWebsocket.js @@ -3,7 +3,7 @@ import { useStore_WebsocketHost, useStore_WebsocketPort, } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useWebsocket = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/appearance/useMessageLogUiScaling.js b/src-ui/logics/configs/appearance/useMessageLogUiScaling.js index 625f6263..2833774f 100644 --- a/src-ui/logics/configs/appearance/useMessageLogUiScaling.js +++ b/src-ui/logics/configs/appearance/useMessageLogUiScaling.js @@ -1,5 +1,5 @@ import { useStore_MessageLogUiScaling } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useMessageLogUiScaling = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/appearance/useRestoreWindowGeometry.js b/src-ui/logics/configs/appearance/useRestoreWindowGeometry.js index 2cc618be..76a01a4b 100644 --- a/src-ui/logics/configs/appearance/useRestoreWindowGeometry.js +++ b/src-ui/logics/configs/appearance/useRestoreWindowGeometry.js @@ -1,5 +1,5 @@ // import { useStore_RestoreWindowGeometry } from "@store"; -// import { useStdoutToPython } from "@logics/useStdoutToPython"; +// import { useStdoutToPython } from "@useStdoutToPython"; // export const useRestoreWindowGeometry = () => { // const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/appearance/useSelectedFontFamily.js b/src-ui/logics/configs/appearance/useSelectedFontFamily.js index bfb43029..538ef462 100644 --- a/src-ui/logics/configs/appearance/useSelectedFontFamily.js +++ b/src-ui/logics/configs/appearance/useSelectedFontFamily.js @@ -1,5 +1,5 @@ import { useStore_SelectedFontFamily } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useSelectedFontFamily = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/appearance/useSendMessageButtonType.js b/src-ui/logics/configs/appearance/useSendMessageButtonType.js index f69a51f2..e92c9b21 100644 --- a/src-ui/logics/configs/appearance/useSendMessageButtonType.js +++ b/src-ui/logics/configs/appearance/useSendMessageButtonType.js @@ -1,5 +1,5 @@ import { useStore_SendMessageButtonType } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useSendMessageButtonType = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/appearance/useTransparency.js b/src-ui/logics/configs/appearance/useTransparency.js index 9ab7429f..4c719503 100644 --- a/src-ui/logics/configs/appearance/useTransparency.js +++ b/src-ui/logics/configs/appearance/useTransparency.js @@ -1,5 +1,5 @@ import { useStore_Transparency } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useTransparency = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/appearance/useUiLanguage.js b/src-ui/logics/configs/appearance/useUiLanguage.js index 149a8fb3..bb3a5b39 100644 --- a/src-ui/logics/configs/appearance/useUiLanguage.js +++ b/src-ui/logics/configs/appearance/useUiLanguage.js @@ -1,5 +1,5 @@ import { useStore_UiLanguage } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useUiLanguage = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/appearance/useUiScaling.js b/src-ui/logics/configs/appearance/useUiScaling.js index 501118f1..e5d75e1d 100644 --- a/src-ui/logics/configs/appearance/useUiScaling.js +++ b/src-ui/logics/configs/appearance/useUiScaling.js @@ -1,5 +1,5 @@ import { useStore_UiScaling } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useUiScaling = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/device/useEnableAutoMicSelect.js b/src-ui/logics/configs/device/useEnableAutoMicSelect.js index 1370d055..c9f7e5d6 100644 --- a/src-ui/logics/configs/device/useEnableAutoMicSelect.js +++ b/src-ui/logics/configs/device/useEnableAutoMicSelect.js @@ -1,5 +1,5 @@ import { useStore_EnableAutoMicSelect } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useEnableAutoMicSelect = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/device/useEnableAutoSpeakerSelect.js b/src-ui/logics/configs/device/useEnableAutoSpeakerSelect.js index d43184de..406cbf25 100644 --- a/src-ui/logics/configs/device/useEnableAutoSpeakerSelect.js +++ b/src-ui/logics/configs/device/useEnableAutoSpeakerSelect.js @@ -1,5 +1,5 @@ import { useStore_EnableAutoSpeakerSelect } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useEnableAutoSpeakerSelect = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/device/useMicDeviceList.js b/src-ui/logics/configs/device/useMicDeviceList.js index 196b32cf..486c3f58 100644 --- a/src-ui/logics/configs/device/useMicDeviceList.js +++ b/src-ui/logics/configs/device/useMicDeviceList.js @@ -1,5 +1,5 @@ import { useStore_MicDeviceList } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useMicDeviceList = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/device/useMicHostList.js b/src-ui/logics/configs/device/useMicHostList.js index ed61f80a..39d34097 100644 --- a/src-ui/logics/configs/device/useMicHostList.js +++ b/src-ui/logics/configs/device/useMicHostList.js @@ -1,5 +1,5 @@ import { useStore_MicHostList } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useMicHostList = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/device/useMicThreshold.js b/src-ui/logics/configs/device/useMicThreshold.js index ab6bda6c..a6224c38 100644 --- a/src-ui/logics/configs/device/useMicThreshold.js +++ b/src-ui/logics/configs/device/useMicThreshold.js @@ -1,5 +1,5 @@ import { useStore_MicThreshold, useStore_EnableAutomaticMicThreshold } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useMicThreshold = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/device/useSelectedMicDevice.js b/src-ui/logics/configs/device/useSelectedMicDevice.js index 798eae5a..6bd7d11a 100644 --- a/src-ui/logics/configs/device/useSelectedMicDevice.js +++ b/src-ui/logics/configs/device/useSelectedMicDevice.js @@ -1,5 +1,5 @@ import { useStore_SelectedMicDevice } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useSelectedMicDevice = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/device/useSelectedMicHost.js b/src-ui/logics/configs/device/useSelectedMicHost.js index 0ef9c882..f1c1c147 100644 --- a/src-ui/logics/configs/device/useSelectedMicHost.js +++ b/src-ui/logics/configs/device/useSelectedMicHost.js @@ -1,5 +1,5 @@ import { useStore_SelectedMicHost } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useSelectedMicHost = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/device/useSelectedSpeakerDevice.js b/src-ui/logics/configs/device/useSelectedSpeakerDevice.js index b8d85693..672a9267 100644 --- a/src-ui/logics/configs/device/useSelectedSpeakerDevice.js +++ b/src-ui/logics/configs/device/useSelectedSpeakerDevice.js @@ -1,5 +1,5 @@ import { useStore_SelectedSpeakerDevice } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useSelectedSpeakerDevice = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/device/useSpeakerDeviceList.js b/src-ui/logics/configs/device/useSpeakerDeviceList.js index 2848111c..b0385cf8 100644 --- a/src-ui/logics/configs/device/useSpeakerDeviceList.js +++ b/src-ui/logics/configs/device/useSpeakerDeviceList.js @@ -1,5 +1,5 @@ import { useStore_SpeakerDeviceList } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useSpeakerDeviceList = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/device/useSpeakerThreshold.js b/src-ui/logics/configs/device/useSpeakerThreshold.js index 29824b01..c21fe2ef 100644 --- a/src-ui/logics/configs/device/useSpeakerThreshold.js +++ b/src-ui/logics/configs/device/useSpeakerThreshold.js @@ -1,5 +1,5 @@ import { useStore_SpeakerThreshold, useStore_EnableAutomaticSpeakerThreshold } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useSpeakerThreshold = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/hotkeys/useHotkeys.js b/src-ui/logics/configs/hotkeys/useHotkeys.js index a2bbe35d..20b18732 100644 --- a/src-ui/logics/configs/hotkeys/useHotkeys.js +++ b/src-ui/logics/configs/hotkeys/useHotkeys.js @@ -1,5 +1,5 @@ import { store, useStore_Hotkeys } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; import { useNotificationStatus } from "@logics_common"; import { useMainFunction } from "@logics_main"; import { register, unregisterAll, isRegistered } from "@tauri-apps/plugin-global-shortcut"; diff --git a/src-ui/logics/configs/others/useEnableAutoClearMessageInputBox.js b/src-ui/logics/configs/others/useEnableAutoClearMessageInputBox.js index d04c6094..6508990c 100644 --- a/src-ui/logics/configs/others/useEnableAutoClearMessageInputBox.js +++ b/src-ui/logics/configs/others/useEnableAutoClearMessageInputBox.js @@ -1,5 +1,5 @@ import { useStore_EnableAutoClearMessageInputBox } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useEnableAutoClearMessageInputBox = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/others/useEnableAutoExportMessageLogs.js b/src-ui/logics/configs/others/useEnableAutoExportMessageLogs.js index 8249a83a..e9faab35 100644 --- a/src-ui/logics/configs/others/useEnableAutoExportMessageLogs.js +++ b/src-ui/logics/configs/others/useEnableAutoExportMessageLogs.js @@ -1,5 +1,5 @@ import { useStore_EnableAutoExportMessageLogs } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useEnableAutoExportMessageLogs = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/others/useEnableNotificationVrcSfx.js b/src-ui/logics/configs/others/useEnableNotificationVrcSfx.js index 24e1096a..9a001114 100644 --- a/src-ui/logics/configs/others/useEnableNotificationVrcSfx.js +++ b/src-ui/logics/configs/others/useEnableNotificationVrcSfx.js @@ -1,5 +1,5 @@ import { useStore_EnableNotificationVrcSfx } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useEnableNotificationVrcSfx = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/others/useEnableSendMessageToVrc.js b/src-ui/logics/configs/others/useEnableSendMessageToVrc.js index 10ef4b0c..6284dd17 100644 --- a/src-ui/logics/configs/others/useEnableSendMessageToVrc.js +++ b/src-ui/logics/configs/others/useEnableSendMessageToVrc.js @@ -1,5 +1,5 @@ import { useStore_EnableSendMessageToVrc } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useEnableSendMessageToVrc = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/others/useEnableSendOnlyTranslatedMessages.js b/src-ui/logics/configs/others/useEnableSendOnlyTranslatedMessages.js index 7e9abefb..4ba9d4af 100644 --- a/src-ui/logics/configs/others/useEnableSendOnlyTranslatedMessages.js +++ b/src-ui/logics/configs/others/useEnableSendOnlyTranslatedMessages.js @@ -1,5 +1,5 @@ import { useStore_EnableSendOnlyTranslatedMessages } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useEnableSendOnlyTranslatedMessages = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/others/useEnableSendReceivedMessageToVrc.js b/src-ui/logics/configs/others/useEnableSendReceivedMessageToVrc.js index 5eeeb102..bfc550a1 100644 --- a/src-ui/logics/configs/others/useEnableSendReceivedMessageToVrc.js +++ b/src-ui/logics/configs/others/useEnableSendReceivedMessageToVrc.js @@ -1,5 +1,5 @@ import { useStore_EnableSendReceivedMessageToVrc } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useEnableSendReceivedMessageToVrc = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/others/useEnableVrcMicMuteSync.js b/src-ui/logics/configs/others/useEnableVrcMicMuteSync.js index 6515ffc2..f8711d81 100644 --- a/src-ui/logics/configs/others/useEnableVrcMicMuteSync.js +++ b/src-ui/logics/configs/others/useEnableVrcMicMuteSync.js @@ -1,5 +1,5 @@ import { useStore_EnableVrcMicMuteSync } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useEnableVrcMicMuteSync = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/others/useSendMessageButtonType.js b/src-ui/logics/configs/others/useSendMessageButtonType.js index a6a22add..621c7dbc 100644 --- a/src-ui/logics/configs/others/useSendMessageButtonType.js +++ b/src-ui/logics/configs/others/useSendMessageButtonType.js @@ -1,5 +1,5 @@ import { useStore_SendMessageButtonType } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useSendMessageButtonType = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/plugins/usePlugins.js b/src-ui/logics/configs/plugins/usePlugins.js index d4d398fa..50a9fe41 100644 --- a/src-ui/logics/configs/plugins/usePlugins.js +++ b/src-ui/logics/configs/plugins/usePlugins.js @@ -11,7 +11,7 @@ import { useStore_FetchedPluginsInfo, useStore_LoadedPlugins, } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; import { transform } from "@babel/standalone"; import { writeFile, mkdir, exists, remove, readDir, BaseDirectory, readTextFile } from "@tauri-apps/plugin-fs"; diff --git a/src-ui/logics/configs/transcription/useMicMaxWords.js b/src-ui/logics/configs/transcription/useMicMaxWords.js index 7415d655..72abd77b 100644 --- a/src-ui/logics/configs/transcription/useMicMaxWords.js +++ b/src-ui/logics/configs/transcription/useMicMaxWords.js @@ -1,5 +1,5 @@ import { useStore_MicMaxWords } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useMicMaxWords = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/transcription/useMicPhraseTimeout.js b/src-ui/logics/configs/transcription/useMicPhraseTimeout.js index 02601b0c..6f66abf8 100644 --- a/src-ui/logics/configs/transcription/useMicPhraseTimeout.js +++ b/src-ui/logics/configs/transcription/useMicPhraseTimeout.js @@ -1,5 +1,5 @@ import { useStore_MicPhraseTimeout } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useMicPhraseTimeout = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/transcription/useMicRecordTimeout.js b/src-ui/logics/configs/transcription/useMicRecordTimeout.js index 27798804..cfeab807 100644 --- a/src-ui/logics/configs/transcription/useMicRecordTimeout.js +++ b/src-ui/logics/configs/transcription/useMicRecordTimeout.js @@ -1,5 +1,5 @@ import { useStore_MicRecordTimeout } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useMicRecordTimeout = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/transcription/useMicWordFilterList.js b/src-ui/logics/configs/transcription/useMicWordFilterList.js index cca40b0a..a0ac5b09 100644 --- a/src-ui/logics/configs/transcription/useMicWordFilterList.js +++ b/src-ui/logics/configs/transcription/useMicWordFilterList.js @@ -1,5 +1,5 @@ import { useStore_MicWordFilterList } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useMicWordFilterList = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/transcription/useSelectableWhisperComputeDeviceList.js b/src-ui/logics/configs/transcription/useSelectableWhisperComputeDeviceList.js index 94ae24f6..2c732651 100644 --- a/src-ui/logics/configs/transcription/useSelectableWhisperComputeDeviceList.js +++ b/src-ui/logics/configs/transcription/useSelectableWhisperComputeDeviceList.js @@ -1,5 +1,5 @@ import { useStore_SelectableWhisperComputeDeviceList } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useSelectableWhisperComputeDeviceList = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/transcription/useSelectedTranscriptionEngine.js b/src-ui/logics/configs/transcription/useSelectedTranscriptionEngine.js index 43f0b6ab..9c7758f7 100644 --- a/src-ui/logics/configs/transcription/useSelectedTranscriptionEngine.js +++ b/src-ui/logics/configs/transcription/useSelectedTranscriptionEngine.js @@ -1,5 +1,5 @@ import { useStore_SelectedTranscriptionEngine } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useSelectedTranscriptionEngine = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/transcription/useSelectedWhisperComputeDevice.js b/src-ui/logics/configs/transcription/useSelectedWhisperComputeDevice.js index f2d34af1..517dde00 100644 --- a/src-ui/logics/configs/transcription/useSelectedWhisperComputeDevice.js +++ b/src-ui/logics/configs/transcription/useSelectedWhisperComputeDevice.js @@ -1,5 +1,5 @@ import { useStore_SelectedWhisperComputeDevice } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useSelectedWhisperComputeDevice = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/transcription/useSelectedWhisperWeightType.js b/src-ui/logics/configs/transcription/useSelectedWhisperWeightType.js index 02993646..220921ae 100644 --- a/src-ui/logics/configs/transcription/useSelectedWhisperWeightType.js +++ b/src-ui/logics/configs/transcription/useSelectedWhisperWeightType.js @@ -1,5 +1,5 @@ import { useStore_SelectedWhisperWeightType } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useSelectedWhisperWeightType = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/transcription/useSpeakerMaxWords.js b/src-ui/logics/configs/transcription/useSpeakerMaxWords.js index 8678ceb2..4907ab09 100644 --- a/src-ui/logics/configs/transcription/useSpeakerMaxWords.js +++ b/src-ui/logics/configs/transcription/useSpeakerMaxWords.js @@ -1,5 +1,5 @@ import { useStore_SpeakerMaxWords } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useSpeakerMaxWords = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/transcription/useSpeakerPhraseTimeout.js b/src-ui/logics/configs/transcription/useSpeakerPhraseTimeout.js index af9e8fba..4f9ac1c9 100644 --- a/src-ui/logics/configs/transcription/useSpeakerPhraseTimeout.js +++ b/src-ui/logics/configs/transcription/useSpeakerPhraseTimeout.js @@ -1,5 +1,5 @@ import { useStore_SpeakerPhraseTimeout } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useSpeakerPhraseTimeout = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/transcription/useSpeakerRecordTimeout.js b/src-ui/logics/configs/transcription/useSpeakerRecordTimeout.js index 5d17754c..123ad89b 100644 --- a/src-ui/logics/configs/transcription/useSpeakerRecordTimeout.js +++ b/src-ui/logics/configs/transcription/useSpeakerRecordTimeout.js @@ -1,5 +1,5 @@ import { useStore_SpeakerRecordTimeout } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useSpeakerRecordTimeout = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/transcription/useWhisperWeightTypeStatus.js b/src-ui/logics/configs/transcription/useWhisperWeightTypeStatus.js index 482273d2..1d8a96c3 100644 --- a/src-ui/logics/configs/transcription/useWhisperWeightTypeStatus.js +++ b/src-ui/logics/configs/transcription/useWhisperWeightTypeStatus.js @@ -1,5 +1,5 @@ import { useStore_WhisperWeightTypeStatus } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useWhisperWeightTypeStatus = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/translation/useCTranslate2WeightTypeStatus.js b/src-ui/logics/configs/translation/useCTranslate2WeightTypeStatus.js index 4f840765..fa28404e 100644 --- a/src-ui/logics/configs/translation/useCTranslate2WeightTypeStatus.js +++ b/src-ui/logics/configs/translation/useCTranslate2WeightTypeStatus.js @@ -1,5 +1,5 @@ import { useStore_CTranslate2WeightTypeStatus } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useCTranslate2WeightTypeStatus = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/translation/useDeepLAuthKey.js b/src-ui/logics/configs/translation/useDeepLAuthKey.js index a568dfe9..bff8163b 100644 --- a/src-ui/logics/configs/translation/useDeepLAuthKey.js +++ b/src-ui/logics/configs/translation/useDeepLAuthKey.js @@ -1,5 +1,5 @@ import { useStore_DeepLAuthKey } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; import { useTranslation } from "react-i18next"; import { useNotificationStatus } from "@logics_common"; diff --git a/src-ui/logics/configs/translation/useSelectableCTranslate2ComputeDeviceList.js b/src-ui/logics/configs/translation/useSelectableCTranslate2ComputeDeviceList.js index e2ca89ca..db576d9c 100644 --- a/src-ui/logics/configs/translation/useSelectableCTranslate2ComputeDeviceList.js +++ b/src-ui/logics/configs/translation/useSelectableCTranslate2ComputeDeviceList.js @@ -1,5 +1,5 @@ import { useStore_SelectableCTranslate2ComputeDeviceList } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useSelectableCTranslate2ComputeDeviceList = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/translation/useSelectedCTranslate2ComputeDevice.js b/src-ui/logics/configs/translation/useSelectedCTranslate2ComputeDevice.js index 37f6623d..0887364d 100644 --- a/src-ui/logics/configs/translation/useSelectedCTranslate2ComputeDevice.js +++ b/src-ui/logics/configs/translation/useSelectedCTranslate2ComputeDevice.js @@ -1,5 +1,5 @@ import { useStore_SelectedCTranslate2ComputeDevice } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useSelectedCTranslate2ComputeDevice = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/translation/useSelectedCTranslate2WeightType.js b/src-ui/logics/configs/translation/useSelectedCTranslate2WeightType.js index 8641a2ac..9b6197dc 100644 --- a/src-ui/logics/configs/translation/useSelectedCTranslate2WeightType.js +++ b/src-ui/logics/configs/translation/useSelectedCTranslate2WeightType.js @@ -1,5 +1,5 @@ import { useStore_SelectedCTranslate2WeightType } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useSelectedCTranslate2WeightType = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/vr/useIsEnabledOverlayLargeLog.js b/src-ui/logics/configs/vr/useIsEnabledOverlayLargeLog.js index 0e1f8881..c66e865f 100644 --- a/src-ui/logics/configs/vr/useIsEnabledOverlayLargeLog.js +++ b/src-ui/logics/configs/vr/useIsEnabledOverlayLargeLog.js @@ -1,5 +1,5 @@ import { useStore_IsEnabledOverlayLargeLog } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useIsEnabledOverlayLargeLog = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/vr/useIsEnabledOverlaySmallLog.js b/src-ui/logics/configs/vr/useIsEnabledOverlaySmallLog.js index e51a34c3..dbdf0247 100644 --- a/src-ui/logics/configs/vr/useIsEnabledOverlaySmallLog.js +++ b/src-ui/logics/configs/vr/useIsEnabledOverlaySmallLog.js @@ -1,5 +1,5 @@ import { useStore_IsEnabledOverlaySmallLog } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useIsEnabledOverlaySmallLog = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/vr/useOverlayLargeLogSettings.js b/src-ui/logics/configs/vr/useOverlayLargeLogSettings.js index 548189e3..f7a1a577 100644 --- a/src-ui/logics/configs/vr/useOverlayLargeLogSettings.js +++ b/src-ui/logics/configs/vr/useOverlayLargeLogSettings.js @@ -1,5 +1,5 @@ import { useStore_OverlayLargeLogSettings } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useOverlayLargeLogSettings = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/vr/useOverlayShowOnlyTranslatedMessages.js b/src-ui/logics/configs/vr/useOverlayShowOnlyTranslatedMessages.js index 895581ae..40e3fc87 100644 --- a/src-ui/logics/configs/vr/useOverlayShowOnlyTranslatedMessages.js +++ b/src-ui/logics/configs/vr/useOverlayShowOnlyTranslatedMessages.js @@ -1,5 +1,5 @@ import { useStore_OverlayShowOnlyTranslatedMessages } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useOverlayShowOnlyTranslatedMessages = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/vr/useOverlaySmallLogSettings.js b/src-ui/logics/configs/vr/useOverlaySmallLogSettings.js index 03b61393..7979f5c1 100644 --- a/src-ui/logics/configs/vr/useOverlaySmallLogSettings.js +++ b/src-ui/logics/configs/vr/useOverlaySmallLogSettings.js @@ -1,5 +1,5 @@ import { useStore_OverlaySmallLogSettings } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useOverlaySmallLogSettings = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/configs/vr/useSendTextToOverlay.js b/src-ui/logics/configs/vr/useSendTextToOverlay.js index 268881ec..f109e3ad 100644 --- a/src-ui/logics/configs/vr/useSendTextToOverlay.js +++ b/src-ui/logics/configs/vr/useSendTextToOverlay.js @@ -1,4 +1,4 @@ -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useSendTextToOverlay = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/main/useIsMainPageCompactMode.js b/src-ui/logics/main/useIsMainPageCompactMode.js index 9a883c51..a1c7110f 100644 --- a/src-ui/logics/main/useIsMainPageCompactMode.js +++ b/src-ui/logics/main/useIsMainPageCompactMode.js @@ -1,5 +1,5 @@ import { useStore_IsMainPageCompactMode } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useIsMainPageCompactMode = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/main/useLanguageSettings.js b/src-ui/logics/main/useLanguageSettings.js index 163f9f37..dcee9bcf 100644 --- a/src-ui/logics/main/useLanguageSettings.js +++ b/src-ui/logics/main/useLanguageSettings.js @@ -1,5 +1,5 @@ import { useStore_SelectedPresetTabNumber, useStore_EnableMultiTranslation, useStore_SelectedYourLanguages, useStore_SelectedTargetLanguages, useStore_TranslationEngines, useStore_SelectedTranslationEngines } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useLanguageSettings = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/main/useMainFunction.js b/src-ui/logics/main/useMainFunction.js index 05be0662..334ef643 100644 --- a/src-ui/logics/main/useMainFunction.js +++ b/src-ui/logics/main/useMainFunction.js @@ -6,7 +6,7 @@ import { useStore_TranscriptionReceiveStatus, useStore_ForegroundStatus, } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useMainFunction = () => { const appWindow = store.appWindow; diff --git a/src-ui/logics/main/useMessageInputBoxRatio.js b/src-ui/logics/main/useMessageInputBoxRatio.js index b8f8430c..173219d6 100644 --- a/src-ui/logics/main/useMessageInputBoxRatio.js +++ b/src-ui/logics/main/useMessageInputBoxRatio.js @@ -1,6 +1,6 @@ import { store } from "@store"; import { useStore_MessageInputBoxRatio } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; import { clampMinMax } from "@utils"; export const useMessageInputBoxRatio = () => { const appWindow = store.appWindow; diff --git a/src-ui/logics/main/useSelectableLanguageList.js b/src-ui/logics/main/useSelectableLanguageList.js index ef771d7f..094530c8 100644 --- a/src-ui/logics/main/useSelectableLanguageList.js +++ b/src-ui/logics/main/useSelectableLanguageList.js @@ -1,5 +1,5 @@ import { useStore_SelectableLanguageList } from "@store"; -import { useStdoutToPython } from "@logics/useStdoutToPython"; +import { useStdoutToPython } from "@useStdoutToPython"; export const useSelectableLanguageList = () => { const { asyncStdoutToPython } = useStdoutToPython(); diff --git a/src-ui/logics/useStartPython.js b/src-ui/logics/useStartPython.js deleted file mode 100644 index c8aaf2f5..00000000 --- a/src-ui/logics/useStartPython.js +++ /dev/null @@ -1,34 +0,0 @@ -import { Command } from "@tauri-apps/plugin-shell"; -import { store } from "@store"; -import { useReceiveRoutes } from "./useReceiveRoutes"; -import { - useNotificationStatus, -} from "@logics_common"; - -export const useStartPython = () => { - const { receiveRoutes } = useReceiveRoutes(); - const { showNotification_Success, showNotification_Error } = useNotificationStatus(); - - const asyncStartPython = async () => { - const command = Command.sidecar("bin/VRCT-sidecar"); - command.on("error", error => console.error(`error: "${error}"`)); - command.stdout.on("data", (line) => { - let parsed_data = ""; - try { - parsed_data = JSON.parse(line); - receiveRoutes(parsed_data); - } catch (error) { - console.log(error, line); - } - }); - command.stderr.on("data", line => { - showNotification_Error( - `An error occurred. Please restart VRCT or contact the developers. The last line:${JSON.stringify(line)}`, { hide_duration: null }); - console.error("stderr", line) - }); - const backend_subprocess = await command.spawn(); - store.backend_subprocess = backend_subprocess; - }; - - return { asyncStartPython }; -}; \ No newline at end of file diff --git a/src-ui/store.js b/src-ui/store.js index 06fc859a..fcd4c0fd 100644 --- a/src-ui/store.js +++ b/src-ui/store.js @@ -5,8 +5,9 @@ import { } from "jotai"; import { - generateTestData, -} from "@test_data"; + generateTestConversationData, +} from "./_test_data.js" + import { translator_status, ctranslate2_weight_type_status, @@ -169,7 +170,7 @@ export const { atomInstance: Atom_SelectableLanguageList, useHook: useStore_Sele // Message Container export const { atomInstance: Atom_MessageLogs, useHook: useStore_MessageLogs } = createAtomWithHook([], "MessageLogs"); -// export const { atomInstance: Atom_MessageLogs, useHook: useStore_MessageLogs } = createAtomWithHook(generateTestData(20), "MessageLogs"); // For testing +// export const { atomInstance: Atom_MessageLogs, useHook: useStore_MessageLogs } = createAtomWithHook(generateTestConversationData(20), "MessageLogs"); // For testing export const { atomInstance: Atom_MessageInputBoxRatio, useHook: useStore_MessageInputBoxRatio } = createAtomWithHook(20, "MessageInputBoxRatio"); export const { atomInstance: Atom_MessageInputValue, useHook: useStore_MessageInputValue } = createAtomWithHook("", "MessageInputValue"); export const { atomInstance: Atom_IsVisibleResendButton, useHook: useStore_IsVisibleResendButton } = createAtomWithHook(false, "IsVisibleResendButton", {is_state_ok: true}); diff --git a/vite.config.js b/vite.config.js index 092db909..32bd2c51 100644 --- a/vite.config.js +++ b/vite.config.js @@ -56,7 +56,9 @@ export default defineConfig(async () => { resolve: { alias: { "@root": path.resolve(__dirname), - "@test_data": path.resolve(__dirname, "./test_data.js"), + + "@useReceiveRoutes": path.resolve(__dirname, "src-ui/logics/useReceiveRoutes.js"), + "@useStdoutToPython": path.resolve(__dirname, "src-ui/logics/useStdoutToPython.js"), "@ui_configs": path.resolve(__dirname, "src-ui/ui_configs.js"), "@scss_mixins": path.resolve(__dirname, "src-ui/common_css/mixins.scss"), From fb2b2242310021a5e5869950c0c977b437e0b51f Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 14 Jun 2025 01:07:12 +0900 Subject: [PATCH 22/41] [Refactor] (Huge Refactoring) ReceiveRoutes: change the way define endpoints, hooks and methods. Remove 'multi language translation enable/disable' related methods that is no longer in use from quite ago. --- .../language_selector/LanguageSelector.jsx | 4 +- .../LanguageSwapButton.jsx | 4 +- src-ui/logics/common/useHandleOscQuery.js | 5 +- src-ui/logics/common/useIsVrctAvailable.js | 11 + src-ui/logics/common/useMessage.js | 4 + src-ui/logics/common/useOpenFolder.js | 10 + src-ui/logics/common/useSoftwareVersion.js | 8 + .../logics/configs/device/useMicDeviceList.js | 9 + .../logics/configs/device/useMicHostList.js | 7 + .../configs/device/useSelectedMicHost.js | 13 + .../configs/device/useSpeakerDeviceList.js | 8 + .../configs/others/useEnableVrcMicMuteSync.js | 8 + .../transcription/useMicWordFilterList.js | 17 + .../useSelectableWhisperComputeDeviceList.js | 7 + .../configs/translation/useDeepLAuthKey.js | 4 + ...eSelectableCTranslate2ComputeDeviceList.js | 7 + src-ui/logics/main/index.js | 3 +- src-ui/logics/main/useLanguageSettings.js | 53 +- .../logics/main/useSelectableLanguageList.js | 17 - src-ui/logics/useReceiveRoutes.js | 911 +++++++----------- src-ui/store.js | 1 - src-ui/utils.js | 8 + 22 files changed, 510 insertions(+), 609 deletions(-) delete mode 100644 src-ui/logics/main/useSelectableLanguageList.js diff --git a/src-ui/app/main_page/main_section/language_selector/LanguageSelector.jsx b/src-ui/app/main_page/main_section/language_selector/LanguageSelector.jsx index 8fce4e2d..3665df67 100644 --- a/src-ui/app/main_page/main_section/language_selector/LanguageSelector.jsx +++ b/src-ui/app/main_page/main_section/language_selector/LanguageSelector.jsx @@ -1,12 +1,12 @@ import { useTranslation } from "react-i18next"; -import { useSelectableLanguageList } from "@logics_main"; +import { useLanguageSettings } from "@logics_main"; import styles from "./LanguageSelector.module.scss"; import { LanguageSelectorTopBar } from "./language_selector_top_bar/LanguageSelectorTopBar"; export const LanguageSelector = ({ title, onClickFunction }) => { const { t } = useTranslation(); - const { currentSelectableLanguageList } = useSelectableLanguageList(); + const { currentSelectableLanguageList } = useLanguageSettings(); const groupLanguagesByFirstLetter = (languages) => { return languages.reduce((acc, { language, country }) => { diff --git a/src-ui/app/main_page/sidebar_section/language_settings/language_swap_button/LanguageSwapButton.jsx b/src-ui/app/main_page/sidebar_section/language_settings/language_swap_button/LanguageSwapButton.jsx index dd479a65..ef8d7c0b 100644 --- a/src-ui/app/main_page/sidebar_section/language_settings/language_swap_button/LanguageSwapButton.jsx +++ b/src-ui/app/main_page/sidebar_section/language_settings/language_swap_button/LanguageSwapButton.jsx @@ -10,7 +10,7 @@ import { useLanguageSettings } from "@logics_main"; export const LanguageSwapButton = () => { const [isHovered, setIsHovered] = useState(false); const { t } = useTranslation(); - const { runLanguageSwap } = useLanguageSettings(); + const { swapSelectedLanguages } = useLanguageSettings(); const label = isHovered ? t("main_page.swap_button_label") @@ -29,7 +29,7 @@ export const LanguageSwapButton = () => { className={styles.swap_button_wrapper} onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave} - onClick={runLanguageSwap} + onClick={swapSelectedLanguages} >

{label}

diff --git a/src-ui/logics/common/useHandleOscQuery.js b/src-ui/logics/common/useHandleOscQuery.js index 61c2ba59..dace04d5 100644 --- a/src-ui/logics/common/useHandleOscQuery.js +++ b/src-ui/logics/common/useHandleOscQuery.js @@ -7,7 +7,10 @@ export const useHandleOscQuery = () => { const { showNotification_Warning } = useNotificationStatus(); const { updateEnableVrcMicMuteSync } = useEnableVrcMicMuteSync(); - const handleOscQuery = ({ is_osc_query_enabled, disabled_functions }) => { + const handleOscQuery = (payload) => { + const is_osc_query_enabled = payload.data; + const disabled_functions = payload.disabled_functions; + if (is_osc_query_enabled) { updateEnableVrcMicMuteSync(prev => ({ ...prev.data, diff --git a/src-ui/logics/common/useIsVrctAvailable.js b/src-ui/logics/common/useIsVrctAvailable.js index dae8911e..569a0210 100644 --- a/src-ui/logics/common/useIsVrctAvailable.js +++ b/src-ui/logics/common/useIsVrctAvailable.js @@ -1,10 +1,21 @@ import { useStore_IsVrctAvailable } from "@store"; +import { useNotificationStatus } from "@logics_common"; export const useIsVrctAvailable = () => { const { currentIsVrctAvailable, updateIsVrctAvailable } = useStore_IsVrctAvailable(); + const { showNotification_Success, showNotification_Error } = useNotificationStatus(); + + const handleAiModelsAvailability = (is_ai_models_available) => { + if (is_ai_models_available === false) { + updateIsVrctAvailable(false); + showNotification_Error("AI models have not been detected. Check the network connection and restart VRCT (it will download automatically, normally).", { hide_duration: null }); + } + }; return { currentIsVrctAvailable, updateIsVrctAvailable, + + handleAiModelsAvailability, }; }; \ No newline at end of file diff --git a/src-ui/logics/common/useMessage.js b/src-ui/logics/common/useMessage.js index 841c90dc..78986b55 100644 --- a/src-ui/logics/common/useMessage.js +++ b/src-ui/logics/common/useMessage.js @@ -42,6 +42,9 @@ export const useMessage = () => { messages: {message: message}, }); }; + const addSystemMessageLog_FromBackend = (payload) => { + addSystemMessageLog(payload.message); + }; const updateSentMessageLogById = (payload) => { updateMessageLogs(updateItemById(payload.id, payload.translation)); @@ -66,6 +69,7 @@ export const useMessage = () => { currentMessageLogs, sendMessage, addSystemMessageLog, + addSystemMessageLog_FromBackend, updateSentMessageLogById, addSentMessageLog, addReceivedMessageLog, diff --git a/src-ui/logics/common/useOpenFolder.js b/src-ui/logics/common/useOpenFolder.js index fa991f03..6ecfd6bd 100644 --- a/src-ui/logics/common/useOpenFolder.js +++ b/src-ui/logics/common/useOpenFolder.js @@ -2,16 +2,26 @@ import { useStdoutToPython } from "@useStdoutToPython"; export const useOpenFolder = () => { const { asyncStdoutToPython } = useStdoutToPython(); + const openFolder_MessageLogs = () => { asyncStdoutToPython("/run/open_filepath_logs"); }; + const openedFolder_MessageLogs = () => { + console.log("Opened Directory, Message Logs"); + }; const openFolder_ConfigFile = () => { asyncStdoutToPython("/run/open_filepath_config_file"); }; + const openedFolder_ConfigFile = () => { + console.log("Opened Directory, Config File"); + }; return { openFolder_MessageLogs, openFolder_ConfigFile, + + openedFolder_MessageLogs, + openedFolder_ConfigFile, }; }; \ No newline at end of file diff --git a/src-ui/logics/common/useSoftwareVersion.js b/src-ui/logics/common/useSoftwareVersion.js index 25c257d5..ea6e99ad 100644 --- a/src-ui/logics/common/useSoftwareVersion.js +++ b/src-ui/logics/common/useSoftwareVersion.js @@ -13,6 +13,13 @@ export const useSoftwareVersion = () => { asyncStdoutToPython("/get/data/version"); }; + const updateSoftwareVersionInfo = (payload) => { + updateLatestSoftwareVersionInfo(prev => ({ + is_update_available: payload.is_update_available, + new_version: payload.new_version || prev.data.new_version, + })); + }; + const isPluginCompatible = (main_version, lower_version, upper_version) => { // lower_version 以上かつ upper_version 以下なら互換性ありと判定 return semver.gte(main_version, lower_version) && semver.lte(main_version, upper_version); @@ -32,6 +39,7 @@ export const useSoftwareVersion = () => { getSoftwareVersion, updateSoftwareVersion, + updateSoftwareVersionInfo, currentLatestSoftwareVersionInfo, updateLatestSoftwareVersionInfo, diff --git a/src-ui/logics/configs/device/useMicDeviceList.js b/src-ui/logics/configs/device/useMicDeviceList.js index 486c3f58..d145a890 100644 --- a/src-ui/logics/configs/device/useMicDeviceList.js +++ b/src-ui/logics/configs/device/useMicDeviceList.js @@ -1,5 +1,6 @@ import { useStore_MicDeviceList } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; +import { arrayToObject } from "@utils"; export const useMicDeviceList = () => { const { asyncStdoutToPython } = useStdoutToPython(); @@ -10,9 +11,17 @@ export const useMicDeviceList = () => { asyncStdoutToPython("/get/data/mic_device_list"); }; + + const updateMicDeviceList_FromBackend = (payload) => { + updateMicDeviceList(arrayToObject(payload)); + }; + + return { currentMicDeviceList, getMicDeviceList, updateMicDeviceList, + + updateMicDeviceList_FromBackend, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useMicHostList.js b/src-ui/logics/configs/device/useMicHostList.js index 39d34097..898f348c 100644 --- a/src-ui/logics/configs/device/useMicHostList.js +++ b/src-ui/logics/configs/device/useMicHostList.js @@ -1,5 +1,6 @@ import { useStore_MicHostList } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; +import { arrayToObject } from "@utils"; export const useMicHostList = () => { const { asyncStdoutToPython } = useStdoutToPython(); @@ -10,9 +11,15 @@ export const useMicHostList = () => { asyncStdoutToPython("/get/data/mic_host_list"); }; + const updateMicHostList_FromBackend = (payload) => { + updateMicHostList(arrayToObject(payload)); + }; + return { currentMicHostList, getMicHostList, updateMicHostList, + + updateMicHostList_FromBackend, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useSelectedMicHost.js b/src-ui/logics/configs/device/useSelectedMicHost.js index f1c1c147..0197cfc8 100644 --- a/src-ui/logics/configs/device/useSelectedMicHost.js +++ b/src-ui/logics/configs/device/useSelectedMicHost.js @@ -1,10 +1,13 @@ import { useStore_SelectedMicHost } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; +import { useSelectedMicDevice } from "@logics_configs"; export const useSelectedMicHost = () => { const { asyncStdoutToPython } = useStdoutToPython(); const { currentSelectedMicHost, updateSelectedMicHost, pendingSelectedMicHost } = useStore_SelectedMicHost(); + const { updateSelectedMicDevice } = useSelectedMicDevice(); + const getSelectedMicHost = () => { pendingSelectedMicHost(); asyncStdoutToPython("/get/data/selected_mic_host"); @@ -15,10 +18,20 @@ export const useSelectedMicHost = () => { asyncStdoutToPython("/set/data/selected_mic_host", selected_mic_host); }; + + // Need refactoring (Duplicated, Host, Device) + const updateSelectedMicHostAndDevice = (payload) => { + updateSelectedMicHost(payload.host); + updateSelectedMicDevice(payload.device); + }; + + return { currentSelectedMicHost, getSelectedMicHost, updateSelectedMicHost, setSelectedMicHost, + + updateSelectedMicHostAndDevice, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useSpeakerDeviceList.js b/src-ui/logics/configs/device/useSpeakerDeviceList.js index b0385cf8..b88ed285 100644 --- a/src-ui/logics/configs/device/useSpeakerDeviceList.js +++ b/src-ui/logics/configs/device/useSpeakerDeviceList.js @@ -1,5 +1,6 @@ import { useStore_SpeakerDeviceList } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; +import { arrayToObject } from "@utils"; export const useSpeakerDeviceList = () => { const { asyncStdoutToPython } = useStdoutToPython(); @@ -10,9 +11,16 @@ export const useSpeakerDeviceList = () => { asyncStdoutToPython("/get/data/speaker_device_list"); }; + const updateSpeakerDeviceList_FromBackend = (payload) => { + updateSpeakerDeviceList(arrayToObject(payload)); + }; + + return { currentSpeakerDeviceList, getSpeakerDeviceList, updateSpeakerDeviceList, + + updateSpeakerDeviceList_FromBackend, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/others/useEnableVrcMicMuteSync.js b/src-ui/logics/configs/others/useEnableVrcMicMuteSync.js index f8711d81..df79fd54 100644 --- a/src-ui/logics/configs/others/useEnableVrcMicMuteSync.js +++ b/src-ui/logics/configs/others/useEnableVrcMicMuteSync.js @@ -19,10 +19,18 @@ export const useEnableVrcMicMuteSync = () => { } }; + const updateEnableVrcMicMuteSync_FromBackend = (payload) => { + updateEnableVrcMicMuteSync((old_value) => { + return {...old_value.data, is_enabled: payload}; + }); + }; + return { currentEnableVrcMicMuteSync, getEnableVrcMicMuteSync, toggleEnableVrcMicMuteSync, updateEnableVrcMicMuteSync, + + updateEnableVrcMicMuteSync_FromBackend, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/transcription/useMicWordFilterList.js b/src-ui/logics/configs/transcription/useMicWordFilterList.js index a0ac5b09..1901e286 100644 --- a/src-ui/logics/configs/transcription/useMicWordFilterList.js +++ b/src-ui/logics/configs/transcription/useMicWordFilterList.js @@ -15,10 +15,27 @@ export const useMicWordFilterList = () => { asyncStdoutToPython("/set/data/mic_word_filter", selected_mic_word_filter); }; + const updateMicWordFilterList_FromBackend = (payload) => { + updateMicWordFilterList((prev_list) => { + const updated_list = [...prev_list.data]; + for (const value of payload) { + const existing_item = updated_list.find(item => item.value === value); + if (existing_item) { + existing_item.is_redoable = false; + } else { + updated_list.push({ value, is_redoable: false }); + } + } + return updated_list; + }); + }; + return { currentMicWordFilterList, getMicWordFilterList, updateMicWordFilterList, setMicWordFilterList, + + updateMicWordFilterList_FromBackend, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/transcription/useSelectableWhisperComputeDeviceList.js b/src-ui/logics/configs/transcription/useSelectableWhisperComputeDeviceList.js index 2c732651..a5528937 100644 --- a/src-ui/logics/configs/transcription/useSelectableWhisperComputeDeviceList.js +++ b/src-ui/logics/configs/transcription/useSelectableWhisperComputeDeviceList.js @@ -1,5 +1,6 @@ import { useStore_SelectableWhisperComputeDeviceList } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; +import { transformToIndexedArray } from "@utils"; export const useSelectableWhisperComputeDeviceList = () => { const { asyncStdoutToPython } = useStdoutToPython(); @@ -10,9 +11,15 @@ export const useSelectableWhisperComputeDeviceList = () => { asyncStdoutToPython("/get/data/transcription_compute_device_list"); }; + const updateSelectableWhisperComputeDeviceList_FromBackend = (payload) => { + updateSelectableWhisperComputeDeviceList(transformToIndexedArray(payload)); + }; + return { currentSelectableWhisperComputeDeviceList, getSelectableWhisperComputeDeviceList, updateSelectableWhisperComputeDeviceList, + + updateSelectableWhisperComputeDeviceList_FromBackend, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/translation/useDeepLAuthKey.js b/src-ui/logics/configs/translation/useDeepLAuthKey.js index bff8163b..89661ad1 100644 --- a/src-ui/logics/configs/translation/useDeepLAuthKey.js +++ b/src-ui/logics/configs/translation/useDeepLAuthKey.js @@ -23,6 +23,9 @@ export const useDeepLAuthKey = () => { pendingDeepLAuthKey(); asyncStdoutToPython("/delete/data/deepl_auth_key"); }; + const deletedDeepLAuthKey = () => { + updateDeepLAuthKey(""); + }; const savedDeepLAuthKey = (data) => { updateDeepLAuthKey(data); @@ -36,6 +39,7 @@ export const useDeepLAuthKey = () => { setDeepLAuthKey, deleteDeepLAuthKey, + deletedDeepLAuthKey, savedDeepLAuthKey, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/translation/useSelectableCTranslate2ComputeDeviceList.js b/src-ui/logics/configs/translation/useSelectableCTranslate2ComputeDeviceList.js index db576d9c..4ae60c1f 100644 --- a/src-ui/logics/configs/translation/useSelectableCTranslate2ComputeDeviceList.js +++ b/src-ui/logics/configs/translation/useSelectableCTranslate2ComputeDeviceList.js @@ -1,5 +1,6 @@ import { useStore_SelectableCTranslate2ComputeDeviceList } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; +import { transformToIndexedArray } from "@utils"; export const useSelectableCTranslate2ComputeDeviceList = () => { const { asyncStdoutToPython } = useStdoutToPython(); @@ -10,9 +11,15 @@ export const useSelectableCTranslate2ComputeDeviceList = () => { asyncStdoutToPython("/get/data/translation_compute_device_list"); }; + const updateSelectableCTranslate2ComputeDeviceList_FromBackend = (payload) => { + updateSelectableCTranslate2ComputeDeviceList(transformToIndexedArray(payload)); + }; + return { currentSelectableCTranslate2ComputeDeviceList, getSelectableCTranslate2ComputeDeviceList, updateSelectableCTranslate2ComputeDeviceList, + + updateSelectableCTranslate2ComputeDeviceList_FromBackend, }; }; \ No newline at end of file diff --git a/src-ui/logics/main/index.js b/src-ui/logics/main/index.js index 7cd492d6..14e817dc 100644 --- a/src-ui/logics/main/index.js +++ b/src-ui/logics/main/index.js @@ -3,5 +3,4 @@ export { useIsMainPageCompactMode } from "./useIsMainPageCompactMode"; export { useLanguageSettings } from "./useLanguageSettings"; export { useMainFunction } from "./useMainFunction"; export { useMessageLogScroll } from "./useMessageLogScroll"; -export { useMessageInputBoxRatio } from "./useMessageInputBoxRatio"; -export { useSelectableLanguageList } from "./useSelectableLanguageList"; \ No newline at end of file +export { useMessageInputBoxRatio } from "./useMessageInputBoxRatio"; \ No newline at end of file diff --git a/src-ui/logics/main/useLanguageSettings.js b/src-ui/logics/main/useLanguageSettings.js index dcee9bcf..aad7ae15 100644 --- a/src-ui/logics/main/useLanguageSettings.js +++ b/src-ui/logics/main/useLanguageSettings.js @@ -1,13 +1,10 @@ -import { useStore_SelectedPresetTabNumber, useStore_EnableMultiTranslation, useStore_SelectedYourLanguages, useStore_SelectedTargetLanguages, useStore_TranslationEngines, useStore_SelectedTranslationEngines } from "@store"; +import { useStore_SelectedPresetTabNumber, useStore_SelectedYourLanguages, useStore_SelectedTargetLanguages, useStore_TranslationEngines, useStore_SelectedTranslationEngines, useStore_SelectableLanguageList } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; +import { translator_status } from "@ui_configs"; export const useLanguageSettings = () => { const { asyncStdoutToPython } = useStdoutToPython(); - const { - currentEnableMultiTranslation, - updateEnableMultiTranslation, - pendingEnableMultiTranslation, - } = useStore_EnableMultiTranslation(); + const { currentSelectedYourLanguages, updateSelectedYourLanguages, @@ -34,10 +31,11 @@ export const useLanguageSettings = () => { pendingSelectedTranslationEngines, } = useStore_SelectedTranslationEngines(); - const getEnableMultiTranslation = () => { - pendingEnableMultiTranslation(); - asyncStdoutToPython("/get/data/multi_language_translation"); - }; + const { + currentSelectableLanguageList, + updateSelectableLanguageList, + } = useStore_SelectableLanguageList(); + const getSelectedPresetTabNumber = () => { pendingSelectedPresetTabNumber(); @@ -112,6 +110,16 @@ export const useLanguageSettings = () => { asyncStdoutToPython("/get/data/translation_engines"); }; + const updateTranslatorAvailability = (payload) => { + const keys = payload; + const updated_list = translator_status.map(translator => ({ + ...translator, + is_available: keys.includes(translator.id), + })); + updateTranslationEngines(updated_list); + }; + + const getSelectedTranslationEngines = () => { pendingSelectedTranslationEngines(); asyncStdoutToPython("/get/data/selected_translation_engines"); @@ -124,12 +132,22 @@ export const useLanguageSettings = () => { asyncStdoutToPython("/set/data/selected_translation_engines", send_obj); }; - const runLanguageSwap = () => { + const swapSelectedLanguages = () => { pendingSelectedYourLanguages(); pendingSelectedTargetLanguages(); asyncStdoutToPython("/run/swap_your_language_and_target_language"); }; + const updateBothSelectedLanguages = (payload) => { + updateSelectedYourLanguages(payload.your); + updateSelectedTargetLanguages(payload.target); + }; + + + const getSelectableLanguageList = () => { + asyncStdoutToPython("/get/data/selectable_language_list"); + }; + return { currentSelectedPresetTabNumber, @@ -137,11 +155,6 @@ export const useLanguageSettings = () => { updateSelectedPresetTabNumber, setSelectedPresetTabNumber, - currentEnableMultiTranslation, - getEnableMultiTranslation, - updateEnableMultiTranslation, - // setEnableMultiTranslation, - currentSelectedYourLanguages, getSelectedYourLanguages, updateSelectedYourLanguages, @@ -158,12 +171,18 @@ export const useLanguageSettings = () => { currentTranslationEngines, getTranslationEngines, updateTranslationEngines, + updateTranslatorAvailability, currentSelectedTranslationEngines, getSelectedTranslationEngines, updateSelectedTranslationEngines, setSelectedTranslationEngines, - runLanguageSwap, + swapSelectedLanguages, + updateBothSelectedLanguages, + + currentSelectableLanguageList, + getSelectableLanguageList, + updateSelectableLanguageList, }; }; \ No newline at end of file diff --git a/src-ui/logics/main/useSelectableLanguageList.js b/src-ui/logics/main/useSelectableLanguageList.js deleted file mode 100644 index 094530c8..00000000 --- a/src-ui/logics/main/useSelectableLanguageList.js +++ /dev/null @@ -1,17 +0,0 @@ -import { useStore_SelectableLanguageList } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useSelectableLanguageList = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSelectableLanguageList, updateSelectableLanguageList } = useStore_SelectableLanguageList(); - - const getSelectableLanguageList = () => { - asyncStdoutToPython("/get/data/selectable_language_list"); - }; - - return { - currentSelectableLanguageList, - getSelectableLanguageList, - updateSelectableLanguageList, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/useReceiveRoutes.js b/src-ui/logics/useReceiveRoutes.js index b1d3421b..54f49203 100644 --- a/src-ui/logics/useReceiveRoutes.js +++ b/src-ui/logics/useReceiveRoutes.js @@ -1,572 +1,356 @@ -import { translator_status } from "@ui_configs"; -import { arrayToObject } from "@utils"; - +import * as common from "@logics_common"; +import * as main from "@logics_main"; +import * as configs from "@logics_configs"; import { _useBackendErrorHandling } from "./_useBackendErrorHandling"; -import { - useIsVrctAvailable, - useNotificationStatus, - useHandleNetworkConnection, - useHandleOscQuery, +export const ROUTE_META_LIST = [ + // Common + { endpoint: "/run/feed_watchdog", ns: null, hook_name: null, method_name: null }, + { endpoint: "/run/initialization_progress", ns: common, hook_name: "useInitProgress", method_name: "updateInitProgress" }, + { endpoint: "/run/enable_ai_models", ns: common, hook_name: "useIsVrctAvailable", method_name: "handleAiModelsAvailability" }, + { endpoint: "/get/data/compute_mode", ns: common, hook_name: "useComputeMode", method_name: "updateComputeMode" }, - useSoftwareVersion, - useComputeMode, - useInitProgress, - useIsBackendReady, - useWindow, - useMessage, - useVolume, -} from "@logics_common"; + { endpoint: "/get/data/main_window_geometry", ns: common, hook_name: "useWindow", method_name: "restoreWindowGeometry" }, + { endpoint: "/set/data/main_window_geometry", ns: null, hook_name: null, method_name: null }, -import { - useMainFunction, - useSelectableLanguageList, - useLanguageSettings, - useIsMainPageCompactMode, - useMessageInputBoxRatio, -} from "@logics_main"; + { endpoint: "/run/open_filepath_logs", ns: common, hook_name: "useOpenFolder", method_name: "openedFolder_MessageLogs" }, + { endpoint: "/run/open_filepath_config_file", ns: common, hook_name: "useOpenFolder", method_name: "openedFolder_ConfigFile" }, -import { - useEnableAutoMicSelect, - useEnableAutoSpeakerSelect, - useMicHostList, - useSelectedMicHost, - useMicDeviceList, - useSelectedMicDevice, - useSpeakerDeviceList, - useSelectedSpeakerDevice, - useMicThreshold, - useSpeakerThreshold, - useEnableAutoClearMessageInputBox, - useEnableSendOnlyTranslatedMessages, - useEnableAutoExportMessageLogs, - useEnableVrcMicMuteSync, - useEnableSendMessageToVrc, - useEnableSendReceivedMessageToVrc, - useSelectedFontFamily, - useUiLanguage, - useUiScaling, - useMessageLogUiScaling, - useSendMessageButtonType, - useTransparency, - useMicRecordTimeout, - useMicPhraseTimeout, - useMicMaxWords, - useMicWordFilterList, - useSpeakerRecordTimeout, - useSpeakerPhraseTimeout, - useSpeakerMaxWords, - useDeepLAuthKey, - useCTranslate2WeightTypeStatus, - useSelectableCTranslate2ComputeDeviceList, - useSelectedCTranslate2ComputeDevice, - useSelectableWhisperComputeDeviceList, - useSelectedWhisperComputeDevice, - useSelectedCTranslate2WeightType, - useSelectedTranscriptionEngine, - useSelectedWhisperWeightType, - useWhisperWeightTypeStatus, - useIsEnabledOverlaySmallLog, - useOverlaySmallLogSettings, - useIsEnabledOverlayLargeLog, - useOverlayLargeLogSettings, - useOverlayShowOnlyTranslatedMessages, - useEnableNotificationVrcSfx, - useHotkeys, - usePlugins, - useOscIpAddress, - useOscPort, - useWebsocket, -} from "@logics_configs"; + // Software Version + { endpoint: "/get/data/version", ns: common, hook_name: "useSoftwareVersion", method_name: "updateSoftwareVersion" }, + // Latest Software Version Info + { endpoint: "/run/software_update_info", ns: common, hook_name: "useSoftwareVersion", method_name: "updateLatestSoftwareVersionInfo" }, + + { endpoint: "/run/connected_network", ns: common, hook_name: "useHandleNetworkConnection", method_name: "handleNetworkConnection" }, + { endpoint: "/run/enable_osc_query", ns: common, hook_name: "useHandleOscQuery", method_name: "handleOscQuery" }, + + // Message (By typing) + { endpoint: "/run/send_message_box", ns: common, hook_name: "useMessage", method_name: "updateSentMessageLogById" }, + { endpoint: "/run/typing_message_box", ns: null, hook_name: null, method_name: null }, + { endpoint: "/run/stop_typing_message_box", ns: null, hook_name: null, method_name: null }, + // Message Transcription + { endpoint: "/run/transcription_send_mic_message", ns: common, hook_name: "useMessage", method_name: "addSentMessageLog" }, + { endpoint: "/run/transcription_receive_speaker_message", ns: common, hook_name: "useMessage", method_name: "addReceivedMessageLog" }, + + // System Messages + { endpoint: "/run/word_filter", ns: common, hook_name: "useMessage", method_name: "addSystemMessageLog_FromBackend" }, + + + // Volume + { endpoint: "/run/check_mic_volume", ns: common, hook_name: "useVolume", method_name: "updateVolumeVariable_Mic" }, + { endpoint: "/run/check_speaker_volume", ns: common, hook_name: "useVolume", method_name: "updateVolumeVariable_Speaker" }, + { endpoint: "/set/enable/check_mic_threshold", ns: common, hook_name: "useVolume", method_name: "updateMicThresholdCheckStatus" }, + { endpoint: "/set/disable/check_mic_threshold", ns: common, hook_name: "useVolume", method_name: "updateMicThresholdCheckStatus" }, + { endpoint: "/set/enable/check_speaker_threshold", ns: common, hook_name: "useVolume", method_name: "updateSpeakerThresholdCheckStatus" }, + { endpoint: "/set/disable/check_speaker_threshold", ns: common, hook_name: "useVolume", method_name: "updateSpeakerThresholdCheckStatus" }, + + + + + // Main Page + // Page Controls + { endpoint: "/get/data/main_window_sidebar_compact_mode", ns: main, hook_name: "useIsMainPageCompactMode", method_name: "updateIsMainPageCompactMode" }, + { endpoint: "/set/enable/main_window_sidebar_compact_mode", ns: main, hook_name: "useIsMainPageCompactMode", method_name: "updateIsMainPageCompactMode" }, + { endpoint: "/set/disable/main_window_sidebar_compact_mode", ns: main, hook_name: "useIsMainPageCompactMode", method_name: "updateIsMainPageCompactMode" }, + + // Main Functions + { endpoint: "/set/enable/translation", ns: main, hook_name: "useMainFunction", method_name: "updateTranslationStatus" }, + { endpoint: "/set/disable/translation", ns: main, hook_name: "useMainFunction", method_name: "updateTranslationStatus" }, + { endpoint: "/set/enable/transcription_send", ns: main, hook_name: "useMainFunction", method_name: "updateTranscriptionSendStatus" }, + { endpoint: "/set/disable/transcription_send", ns: main, hook_name: "useMainFunction", method_name: "updateTranscriptionSendStatus" }, + { endpoint: "/set/enable/transcription_receive", ns: main, hook_name: "useMainFunction", method_name: "updateTranscriptionReceiveStatus" }, + { endpoint: "/set/disable/transcription_receive", ns: main, hook_name: "useMainFunction", method_name: "updateTranscriptionReceiveStatus" }, + + // Language Settings + { endpoint: "/get/data/selected_tab_no", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedPresetTabNumber" }, + { endpoint: "/set/data/selected_tab_no", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedPresetTabNumber" }, + + { endpoint: "/get/data/selected_your_languages", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedYourLanguages" }, + { endpoint: "/set/data/selected_your_languages", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedYourLanguages" }, + { endpoint: "/get/data/selected_target_languages", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedTargetLanguages" }, + { endpoint: "/set/data/selected_target_languages", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedTargetLanguages" }, + + { endpoint: "/get/data/translation_engines", ns: main, hook_name: "useLanguageSettings", method_name: "updateTranslatorAvailability" }, + { endpoint: "/run/translation_engines", ns: main, hook_name: "useLanguageSettings", method_name: "updateTranslatorAvailability" }, + + { endpoint: "/get/data/selected_translation_engines", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedTranslationEngines" }, + { endpoint: "/set/data/selected_translation_engines", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedTranslationEngines" }, + { endpoint: "/run/selected_translation_engines", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedTranslationEngines" }, + + { endpoint: "/run/swap_your_language_and_target_language", ns: main, hook_name: "useLanguageSettings", method_name: "updateBothSelectedLanguages" }, + + // Language Selector + { endpoint: "/get/data/selectable_language_list", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectableLanguageList" }, + + + // Message Input Box + { endpoint: "/get/data/message_box_ratio", ns: main, hook_name: "useMessageInputBoxRatio", method_name: "updateMessageInputBoxRatio" }, + { endpoint: "/set/data/message_box_ratio", ns: main, hook_name: "useMessageInputBoxRatio", method_name: "updateMessageInputBoxRatio" }, + + + + // Config Page + // Device + { endpoint: "/get/data/auto_mic_select", ns: configs, hook_name: "useEnableAutoMicSelect", method_name: "updateEnableAutoMicSelect" }, + { endpoint: "/set/enable/auto_mic_select", ns: configs, hook_name: "useEnableAutoMicSelect", method_name: "updateEnableAutoMicSelect" }, + { endpoint: "/set/disable/auto_mic_select", ns: configs, hook_name: "useEnableAutoMicSelect", method_name: "updateEnableAutoMicSelect" }, + { endpoint: "/get/data/auto_speaker_select", ns: configs, hook_name: "useEnableAutoSpeakerSelect", method_name: "updateEnableAutoSpeakerSelect" }, + { endpoint: "/set/enable/auto_speaker_select", ns: configs, hook_name: "useEnableAutoSpeakerSelect", method_name: "updateEnableAutoSpeakerSelect" }, + { endpoint: "/set/disable/auto_speaker_select", ns: configs, hook_name: "useEnableAutoSpeakerSelect", method_name: "updateEnableAutoSpeakerSelect" }, + + // Device (Mic) + { endpoint: "/get/data/mic_host_list", ns: configs, hook_name: "useMicHostList", method_name: "updateMicHostList_FromBackend" }, + { endpoint: "/run/mic_host_list", ns: configs, hook_name: "useMicHostList", method_name: "updateMicHostList_FromBackend" }, + + { endpoint: "/get/data/selected_mic_host", ns: configs, hook_name: "useSelectedMicHost", method_name: "updateSelectedMicHost" }, + { endpoint: "/set/data/selected_mic_host", ns: configs, hook_name: "useSelectedMicHost", method_name: "updateSelectedMicHostAndDevice" }, // Need refactoring (Duplicated, Host, Device) + + + { endpoint: "/get/data/mic_device_list", ns: configs, hook_name: "useMicDeviceList", method_name: "updateMicDeviceList_FromBackend" }, + { endpoint: "/run/mic_device_list", ns: configs, hook_name: "useMicDeviceList", method_name: "updateMicDeviceList_FromBackend" }, + + { endpoint: "/get/data/selected_mic_device", ns: configs, hook_name: "useSelectedMicDevice", method_name: "updateSelectedMicDevice" }, + { endpoint: "/set/data/selected_mic_device", ns: configs, hook_name: "useSelectedMicDevice", method_name: "updateSelectedMicDevice" }, + + { endpoint: "/run/selected_mic_device", ns: configs, hook_name: "useSelectedMicHost", method_name: "updateSelectedMicHostAndDevice" }, // Need refactoring (Duplicated, Host, Device) + + // Device (Speaker) + { endpoint: "/get/data/speaker_device_list", ns: configs, hook_name: "useSpeakerDeviceList", method_name: "updateSpeakerDeviceList_FromBackend" }, + { endpoint: "/run/speaker_device_list", ns: configs, hook_name: "useSpeakerDeviceList", method_name: "updateSpeakerDeviceList_FromBackend" }, + + { endpoint: "/get/data/selected_speaker_device", ns: configs, hook_name: "useSelectedSpeakerDevice", method_name: "updateSelectedSpeakerDevice" }, + { endpoint: "/set/data/selected_speaker_device", ns: configs, hook_name: "useSelectedSpeakerDevice", method_name: "updateSelectedSpeakerDevice" }, + { endpoint: "/run/selected_speaker_device", ns: configs, hook_name: "useSelectedSpeakerDevice", method_name: "updateSelectedSpeakerDevice" }, + + // Device (Threshold) + { endpoint: "/get/data/mic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateMicThreshold" }, + { endpoint: "/set/data/mic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateMicThreshold" }, + { endpoint: "/get/data/speaker_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateSpeakerThreshold" }, + { endpoint: "/set/data/speaker_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateSpeakerThreshold" }, + + { endpoint: "/get/data/mic_automatic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateEnableAutomaticMicThreshold" }, + { endpoint: "/set/enable/mic_automatic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateEnableAutomaticMicThreshold" }, + { endpoint: "/set/disable/mic_automatic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateEnableAutomaticMicThreshold" }, + { endpoint: "/get/data/speaker_automatic_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateEnableAutomaticSpeakerThreshold" }, + { endpoint: "/set/enable/speaker_automatic_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateEnableAutomaticSpeakerThreshold" }, + { endpoint: "/set/disable/speaker_automatic_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateEnableAutomaticSpeakerThreshold" }, + + + // Appearance + { endpoint: "/get/data/ui_language", ns: configs, hook_name: "useUiLanguage", method_name: "updateUiLanguage" }, + { endpoint: "/set/data/ui_language", ns: configs, hook_name: "useUiLanguage", method_name: "updateUiLanguage" }, + + { endpoint: "/get/data/ui_scaling", ns: configs, hook_name: "useUiScaling", method_name: "updateUiScaling" }, + { endpoint: "/set/data/ui_scaling", ns: configs, hook_name: "useUiScaling", method_name: "updateUiScaling" }, + + { endpoint: "/get/data/textbox_ui_scaling", ns: configs, hook_name: "useMessageLogUiScaling", method_name: "updateMessageLogUiScaling" }, + { endpoint: "/set/data/textbox_ui_scaling", ns: configs, hook_name: "useMessageLogUiScaling", method_name: "updateMessageLogUiScaling" }, + + { endpoint: "/get/data/send_message_button_type", ns: configs, hook_name: "useSendMessageButtonType", method_name: "updateSendMessageButtonType" }, + { endpoint: "/set/data/send_message_button_type", ns: configs, hook_name: "useSendMessageButtonType", method_name: "updateSendMessageButtonType" }, + + { endpoint: "/get/data/font_family", ns: configs, hook_name: "useSelectedFontFamily", method_name: "updateSelectedFontFamily" }, + { endpoint: "/set/data/font_family", ns: configs, hook_name: "useSelectedFontFamily", method_name: "updateSelectedFontFamily" }, + + { endpoint: "/get/data/transparency", ns: configs, hook_name: "useTransparency", method_name: "updateTransparency" }, + { endpoint: "/set/data/transparency", ns: configs, hook_name: "useTransparency", method_name: "updateTransparency" }, + + // Translation + { endpoint: "/get/data/deepl_auth_key", ns: configs, hook_name: "useDeepLAuthKey", method_name: "updateDeepLAuthKey" }, + { endpoint: "/set/data/deepl_auth_key", ns: configs, hook_name: "useDeepLAuthKey", method_name: "savedDeepLAuthKey" }, + { endpoint: "/delete/data/deepl_auth_key", ns: configs, hook_name: "useDeepLAuthKey", method_name: "deletedDeepLAuthKey" }, + + // Translation (AI Models) + { endpoint: "/get/data/ctranslate2_weight_type", ns: configs, hook_name: "useSelectedCTranslate2WeightType", method_name: "updateSelectedCTranslate2WeightType" }, + { endpoint: "/set/data/ctranslate2_weight_type", ns: configs, hook_name: "useSelectedCTranslate2WeightType", method_name: "updateSelectedCTranslate2WeightType" }, + + { endpoint: "/get/data/selectable_ctranslate2_weight_type_dict", ns: configs, hook_name: "useCTranslate2WeightTypeStatus", method_name: "updateDownloadedCTranslate2WeightTypeStatus" }, + + { endpoint: "/get/data/translation_compute_device_list", ns: configs, hook_name: "useSelectableCTranslate2ComputeDeviceList", method_name: "updateSelectableCTranslate2ComputeDeviceList_FromBackend" }, + + { endpoint: "/get/data/selected_translation_compute_device", ns: configs, hook_name: "useSelectedCTranslate2ComputeDevice", method_name: "updateSelectedCTranslate2ComputeDevice" }, + { endpoint: "/set/data/selected_translation_compute_device", ns: configs, hook_name: "useSelectedCTranslate2ComputeDevice", method_name: "updateSelectedCTranslate2ComputeDevice" }, + + { endpoint: "/run/downloaded_ctranslate2_weight", ns: configs, hook_name: "useCTranslate2WeightTypeStatus", method_name: "downloadedCTranslate2WeightType" }, + { endpoint: "/run/download_ctranslate2_weight", ns: null, hook_name: null, method_name: null }, + { endpoint: "/run/download_progress_ctranslate2_weight", ns: configs, hook_name: "useCTranslate2WeightTypeStatus", method_name: "updateDownloadProgressCTranslate2WeightTypeStatus" }, + + // Transcription + // Transcription (Mic) + { endpoint: "/get/data/mic_record_timeout", ns: configs, hook_name: "useMicRecordTimeout", method_name: "updateMicRecordTimeout" }, + { endpoint: "/set/data/mic_record_timeout", ns: configs, hook_name: "useMicRecordTimeout", method_name: "updateMicRecordTimeout" }, + + { endpoint: "/get/data/mic_phrase_timeout", ns: configs, hook_name: "useMicPhraseTimeout", method_name: "updateMicPhraseTimeout" }, + { endpoint: "/set/data/mic_phrase_timeout", ns: configs, hook_name: "useMicPhraseTimeout", method_name: "updateMicPhraseTimeout" }, + + { endpoint: "/get/data/mic_max_phrases", ns: configs, hook_name: "useMicMaxWords", method_name: "updateMicMaxWords" }, + { endpoint: "/set/data/mic_max_phrases", ns: configs, hook_name: "useMicMaxWords", method_name: "updateMicMaxWords" }, + + { endpoint: "/get/data/mic_word_filter", ns: configs, hook_name: "useMicWordFilterList", method_name: "updateMicWordFilterList_FromBackend" }, + { endpoint: "/set/data/mic_word_filter", ns: configs, hook_name: "useMicWordFilterList", method_name: "updateMicWordFilterList_FromBackend" }, + + // Transcription (Speaker) + { endpoint: "/get/data/speaker_record_timeout", ns: configs, hook_name: "useSpeakerRecordTimeout", method_name: "updateSpeakerRecordTimeout" }, + { endpoint: "/set/data/speaker_record_timeout", ns: configs, hook_name: "useSpeakerRecordTimeout", method_name: "updateSpeakerRecordTimeout" }, + + { endpoint: "/get/data/speaker_phrase_timeout", ns: configs, hook_name: "useSpeakerPhraseTimeout", method_name: "updateSpeakerPhraseTimeout" }, + { endpoint: "/set/data/speaker_phrase_timeout", ns: configs, hook_name: "useSpeakerPhraseTimeout", method_name: "updateSpeakerPhraseTimeout" }, + + { endpoint: "/get/data/speaker_max_phrases", ns: configs, hook_name: "useSpeakerMaxWords", method_name: "updateSpeakerMaxWords" }, + { endpoint: "/set/data/speaker_max_phrases", ns: configs, hook_name: "useSpeakerMaxWords", method_name: "updateSpeakerMaxWords" }, + + // Transcription (AI Models) + { endpoint: "/get/data/selected_transcription_engine", ns: configs, hook_name: "useSelectedTranscriptionEngine", method_name: "updateSelectedTranscriptionEngine" }, + { endpoint: "/set/data/selected_transcription_engine", ns: configs, hook_name: "useSelectedTranscriptionEngine", method_name: "updateSelectedTranscriptionEngine" }, + + { endpoint: "/get/data/whisper_weight_type", ns: configs, hook_name: "useSelectedWhisperWeightType", method_name: "updateSelectedWhisperWeightType" }, + { endpoint: "/set/data/whisper_weight_type", ns: configs, hook_name: "useSelectedWhisperWeightType", method_name: "updateSelectedWhisperWeightType" }, + + { endpoint: "/get/data/selectable_whisper_weight_type_dict", ns: configs, hook_name: "useWhisperWeightTypeStatus", method_name: "updateDownloadedWhisperWeightTypeStatus" }, + + { endpoint: "/run/downloaded_whisper_weight", ns: configs, hook_name: "useWhisperWeightTypeStatus", method_name: "downloadedWhisperWeightType" }, + { endpoint: "/run/download_whisper_weight", ns: null, hook_name: null, method_name: null }, + { endpoint: "/run/download_progress_whisper_weight", ns: configs, hook_name: "useWhisperWeightTypeStatus", method_name: "updateDownloadProgressWhisperWeightTypeStatus" }, + + { endpoint: "/get/data/transcription_compute_device_list", ns: configs, hook_name: "useSelectableWhisperComputeDeviceList", method_name: "updateSelectableWhisperComputeDeviceList_FromBackend" }, + { endpoint: "/get/data/selected_transcription_compute_device", ns: configs, hook_name: "useSelectedWhisperComputeDevice", method_name: "updateSelectedWhisperComputeDevice" }, + { endpoint: "/set/data/selected_transcription_compute_device", ns: configs, hook_name: "useSelectedWhisperComputeDevice", method_name: "updateSelectedWhisperComputeDevice" }, + + // VR + { endpoint: "/get/data/overlay_small_log", ns: configs, hook_name: "useIsEnabledOverlaySmallLog", method_name: "updateIsEnabledOverlaySmallLog" }, + { endpoint: "/set/enable/overlay_small_log", ns: configs, hook_name: "useIsEnabledOverlaySmallLog", method_name: "updateIsEnabledOverlaySmallLog" }, + { endpoint: "/set/disable/overlay_small_log", ns: configs, hook_name: "useIsEnabledOverlaySmallLog", method_name: "updateIsEnabledOverlaySmallLog" }, + + { endpoint: "/get/data/overlay_small_log_settings", ns: configs, hook_name: "useOverlaySmallLogSettings", method_name: "updateOverlaySmallLogSettings" }, + { endpoint: "/set/data/overlay_small_log_settings", ns: configs, hook_name: "useOverlaySmallLogSettings", method_name: "updateOverlaySmallLogSettings" }, + + { endpoint: "/get/data/overlay_large_log", ns: configs, hook_name: "useIsEnabledOverlayLargeLog", method_name: "updateIsEnabledOverlayLargeLog" }, + { endpoint: "/set/enable/overlay_large_log", ns: configs, hook_name: "useIsEnabledOverlayLargeLog", method_name: "updateIsEnabledOverlayLargeLog" }, + { endpoint: "/set/disable/overlay_large_log", ns: configs, hook_name: "useIsEnabledOverlayLargeLog", method_name: "updateIsEnabledOverlayLargeLog" }, + + { endpoint: "/get/data/overlay_large_log_settings", ns: configs, hook_name: "useOverlayLargeLogSettings", method_name: "updateOverlayLargeLogSettings" }, + { endpoint: "/set/data/overlay_large_log_settings", ns: configs, hook_name: "useOverlayLargeLogSettings", method_name: "updateOverlayLargeLogSettings" }, + + { endpoint: "/get/data/overlay_show_only_translated_messages", ns: configs, hook_name: "useOverlayShowOnlyTranslatedMessages", method_name: "updateOverlayShowOnlyTranslatedMessages" }, + { endpoint: "/set/enable/overlay_show_only_translated_messages", ns: configs, hook_name: "useOverlayShowOnlyTranslatedMessages", method_name: "updateOverlayShowOnlyTranslatedMessages" }, + { endpoint: "/set/disable/overlay_show_only_translated_messages", ns: configs, hook_name: "useOverlayShowOnlyTranslatedMessages", method_name: "updateOverlayShowOnlyTranslatedMessages" }, + + { endpoint: "/run/send_text_overlay", ns: null, hook_name: null, method_name: null }, + + + // Others + { endpoint: "/get/data/auto_clear_message_box", ns: configs, hook_name: "useEnableAutoClearMessageInputBox", method_name: "updateEnableAutoClearMessageInputBox" }, + { endpoint: "/set/enable/auto_clear_message_box", ns: configs, hook_name: "useEnableAutoClearMessageInputBox", method_name: "updateEnableAutoClearMessageInputBox" }, + { endpoint: "/set/disable/auto_clear_message_box", ns: configs, hook_name: "useEnableAutoClearMessageInputBox", method_name: "updateEnableAutoClearMessageInputBox" }, + + { endpoint: "/get/data/send_only_translated_messages", ns: configs, hook_name: "useEnableSendOnlyTranslatedMessages", method_name: "updateEnableSendOnlyTranslatedMessages" }, + { endpoint: "/set/enable/send_only_translated_messages", ns: configs, hook_name: "useEnableSendOnlyTranslatedMessages", method_name: "updateEnableSendOnlyTranslatedMessages" }, + { endpoint: "/set/disable/send_only_translated_messages", ns: configs, hook_name: "useEnableSendOnlyTranslatedMessages", method_name: "updateEnableSendOnlyTranslatedMessages" }, + + { endpoint: "/get/data/logger_feature", ns: configs, hook_name: "useEnableAutoExportMessageLogs", method_name: "updateEnableAutoExportMessageLogs" }, + { endpoint: "/set/enable/logger_feature", ns: configs, hook_name: "useEnableAutoExportMessageLogs", method_name: "updateEnableAutoExportMessageLogs" }, + { endpoint: "/set/disable/logger_feature", ns: configs, hook_name: "useEnableAutoExportMessageLogs", method_name: "updateEnableAutoExportMessageLogs" }, + + { endpoint: "/get/data/vrc_mic_mute_sync", ns: configs, hook_name: "useEnableVrcMicMuteSync", method_name: "updateEnableVrcMicMuteSync_FromBackend" }, + { endpoint: "/set/enable/vrc_mic_mute_sync", ns: configs, hook_name: "useEnableVrcMicMuteSync", method_name: "updateEnableVrcMicMuteSync_FromBackend" }, + { endpoint: "/set/disable/vrc_mic_mute_sync", ns: configs, hook_name: "useEnableVrcMicMuteSync", method_name: "updateEnableVrcMicMuteSync_FromBackend" }, + + + { endpoint: "/get/data/send_message_to_vrc", ns: configs, hook_name: "useEnableSendMessageToVrc", method_name: "updateEnableSendMessageToVrc" }, + { endpoint: "/set/enable/send_message_to_vrc", ns: configs, hook_name: "useEnableSendMessageToVrc", method_name: "updateEnableSendMessageToVrc" }, + { endpoint: "/set/disable/send_message_to_vrc", ns: configs, hook_name: "useEnableSendMessageToVrc", method_name: "updateEnableSendMessageToVrc" }, + + { endpoint: "/get/data/send_received_message_to_vrc", ns: configs, hook_name: "useEnableSendReceivedMessageToVrc", method_name: "updateEnableSendReceivedMessageToVrc" }, + { endpoint: "/set/enable/send_received_message_to_vrc", ns: configs, hook_name: "useEnableSendReceivedMessageToVrc", method_name: "updateEnableSendReceivedMessageToVrc" }, + { endpoint: "/set/disable/send_received_message_to_vrc", ns: configs, hook_name: "useEnableSendReceivedMessageToVrc", method_name: "updateEnableSendReceivedMessageToVrc" }, + + { endpoint: "/get/data/notification_vrc_sfx", ns: configs, hook_name: "useEnableNotificationVrcSfx", method_name: "updateEnableNotificationVrcSfx" }, + { endpoint: "/set/enable/notification_vrc_sfx", ns: configs, hook_name: "useEnableNotificationVrcSfx", method_name: "updateEnableNotificationVrcSfx" }, + { endpoint: "/set/disable/notification_vrc_sfx", ns: configs, hook_name: "useEnableNotificationVrcSfx", method_name: "updateEnableNotificationVrcSfx" }, + + // Hotkeys + { endpoint: "/get/data/hotkeys", ns: configs, hook_name: "useHotkeys", method_name: "updateHotkeys" }, + { endpoint: "/set/data/hotkeys", ns: configs, hook_name: "useHotkeys", method_name: "updateHotkeys" }, + + // Plugins + { endpoint: "/get/data/plugins_status", ns: configs, hook_name: "usePlugins", method_name: "updateSavedPluginsStatus" }, + { endpoint: "/set/data/plugins_status", ns: configs, hook_name: "usePlugins", method_name: "updateSavedPluginsStatus" }, + + // Advanced Settings + { endpoint: "/get/data/osc_ip_address", ns: configs, hook_name: "useOscIpAddress", method_name: "updateOscIpAddress" }, + { endpoint: "/set/data/osc_ip_address", ns: configs, hook_name: "useOscIpAddress", method_name: "updateOscIpAddress" }, + + { endpoint: "/get/data/osc_port", ns: configs, hook_name: "useOscPort", method_name: "updateOscPort" }, + { endpoint: "/set/data/osc_port", ns: configs, hook_name: "useOscPort", method_name: "updateOscPort" }, + + { endpoint: "/get/data/websocket_server", ns: configs, hook_name: "useWebsocket", method_name: "updateEnableWebsocket" }, + { endpoint: "/set/enable/websocket_server", ns: configs, hook_name: "useWebsocket", method_name: "updateEnableWebsocket" }, + { endpoint: "/set/disable/websocket_server", ns: configs, hook_name: "useWebsocket", method_name: "updateEnableWebsocket" }, + + { endpoint: "/get/data/websocket_host", ns: configs, hook_name: "useWebsocket", method_name: "updateWebsocketHost" }, + { endpoint: "/set/data/websocket_host", ns: configs, hook_name: "useWebsocket", method_name: "updateWebsocketHost" }, + + { endpoint: "/get/data/websocket_port", ns: configs, hook_name: "useWebsocket", method_name: "updateWebsocketPort" }, + { endpoint: "/set/data/websocket_port", ns: configs, hook_name: "useWebsocket", method_name: "updateWebsocketPort" }, + + + // Not Implemented Yet... + { endpoint: "/get/data/mic_avg_logprob", ns: null, hook_name: null, method_name: null }, // Not implemented on UI yet + { endpoint: "/get/data/mic_no_speech_prob", ns: null, hook_name: null, method_name: null }, // Not implemented on UI yet + { endpoint: "/get/data/speaker_avg_logprob", ns: null, hook_name: null, method_name: null }, // Not implemented on UI yet + { endpoint: "/get/data/speaker_no_speech_prob", ns: null, hook_name: null, method_name: null }, // Not implemented on UI yet + { endpoint: "/get/data/convert_message_to_romaji", ns: null, hook_name: null, method_name: null }, // Not implemented on UI yet + { endpoint: "/get/data/convert_message_to_hiragana", ns: null, hook_name: null, method_name: null }, // Not implemented on UI yet + { endpoint: "/get/data/transcription_engines", ns: null, hook_name: null, method_name: null }, // Not implemented on UI yet. (if ai_models has not been detected, this will be blank array[]. if the ai_models are ok but just network has not connected, it'l be only ["Whisper"]) +]; export const useReceiveRoutes = () => { - const { updateIsVrctAvailable } = useIsVrctAvailable(); - const { updateComputeMode } = useComputeMode(); - const { updateInitProgress } = useInitProgress(); - const { updateIsBackendReady } = useIsBackendReady(); - const { handleOscQuery } = useHandleOscQuery(); - const { restoreWindowGeometry } = useWindow(); - const { updateIsMainPageCompactMode } = useIsMainPageCompactMode(); - const { - updateTranslationStatus, - updateTranscriptionSendStatus, - updateTranscriptionReceiveStatus, - } = useMainFunction(); - const { - updateSelectedPresetTabNumber, - updateEnableMultiTranslation, - updateSelectedYourLanguages, - updateSelectedTargetLanguages, - updateTranslationEngines, - updateSelectedTranslationEngines, - } = useLanguageSettings(); - const { updateSelectableLanguageList } = useSelectableLanguageList(); - const { - addSystemMessageLog, - updateSentMessageLogById, - addSentMessageLog, - addReceivedMessageLog, - } = useMessage(); - const { updateLatestSoftwareVersionInfo } = useSoftwareVersion(); - const { updateSoftwareVersion } = useSoftwareVersion(); - const { updateEnableAutoMicSelect } = useEnableAutoMicSelect(); - const { updateEnableAutoSpeakerSelect } = useEnableAutoSpeakerSelect(); - const { updateMicHostList } = useMicHostList(); - const { updateSelectedMicHost } = useSelectedMicHost(); - const { updateMicDeviceList } = useMicDeviceList(); - const { updateSelectedMicDevice } = useSelectedMicDevice(); - const { updateSpeakerDeviceList } = useSpeakerDeviceList(); - const { updateSelectedSpeakerDevice } = useSelectedSpeakerDevice(); - const { updateMicThreshold, updateEnableAutomaticMicThreshold } = useMicThreshold(); - const { updateSpeakerThreshold, updateEnableAutomaticSpeakerThreshold } = useSpeakerThreshold(); + const { showNotification_Error } = common.useNotificationStatus(); + const { errorHandling_Backend } = _useBackendErrorHandling(); + const { updateIsBackendReady } = common.useIsBackendReady(); - const { updateEnableAutoClearMessageInputBox } = useEnableAutoClearMessageInputBox(); - const { updateEnableSendOnlyTranslatedMessages } = useEnableSendOnlyTranslatedMessages(); - const { updateEnableAutoExportMessageLogs } = useEnableAutoExportMessageLogs(); - const { updateEnableVrcMicMuteSync } = useEnableVrcMicMuteSync(); - const { updateEnableSendMessageToVrc } = useEnableSendMessageToVrc(); - const { updateEnableSendReceivedMessageToVrc } = useEnableSendReceivedMessageToVrc(); - - const { updateSendMessageButtonType } = useSendMessageButtonType(); - const { updateUiLanguage } = useUiLanguage(); - const { updateUiScaling } = useUiScaling(); - const { updateMessageLogUiScaling } = useMessageLogUiScaling(); - const { - updateVolumeVariable_Mic, - updateVolumeVariable_Speaker, - updateMicThresholdCheckStatus, - updateSpeakerThresholdCheckStatus, - } = useVolume(); - - const { updateMessageInputBoxRatio } = useMessageInputBoxRatio(); - const { updateSelectedFontFamily } = useSelectedFontFamily(); - const { updateTransparency } = useTransparency(); - - const { updateMicRecordTimeout } = useMicRecordTimeout(); - const { updateMicPhraseTimeout } = useMicPhraseTimeout(); - const { updateMicMaxWords } = useMicMaxWords(); - const { updateMicWordFilterList } = useMicWordFilterList(); - - const { updateSpeakerRecordTimeout } = useSpeakerRecordTimeout(); - const { updateSpeakerPhraseTimeout } = useSpeakerPhraseTimeout(); - const { updateSpeakerMaxWords } = useSpeakerMaxWords(); - - const { updateDeepLAuthKey, savedDeepLAuthKey } = useDeepLAuthKey(); - const { updateSelectedCTranslate2WeightType } = useSelectedCTranslate2WeightType(); - const { - updateDownloadedCTranslate2WeightTypeStatus, - updateDownloadProgressCTranslate2WeightTypeStatus, - downloadedCTranslate2WeightType, - } = useCTranslate2WeightTypeStatus(); - const { updateSelectableCTranslate2ComputeDeviceList } = useSelectableCTranslate2ComputeDeviceList(); - const { updateSelectedCTranslate2ComputeDevice } = useSelectedCTranslate2ComputeDevice(); - const { updateSelectableWhisperComputeDeviceList } = useSelectableWhisperComputeDeviceList(); - const { updateSelectedWhisperComputeDevice } = useSelectedWhisperComputeDevice(); - - const { updateSelectedTranscriptionEngine } = useSelectedTranscriptionEngine(); - const { updateSelectedWhisperWeightType } = useSelectedWhisperWeightType(); - const { - updateDownloadedWhisperWeightTypeStatus, - updateDownloadProgressWhisperWeightTypeStatus, - downloadedWhisperWeightType, - } = useWhisperWeightTypeStatus(); - - const { updateOverlaySmallLogSettings } = useOverlaySmallLogSettings(); - const { updateIsEnabledOverlaySmallLog } = useIsEnabledOverlaySmallLog(); - const { updateOverlayLargeLogSettings } = useOverlayLargeLogSettings(); - const { updateIsEnabledOverlayLargeLog } = useIsEnabledOverlayLargeLog(); - const { updateOverlayShowOnlyTranslatedMessages } = useOverlayShowOnlyTranslatedMessages(); - const { updateEnableNotificationVrcSfx } = useEnableNotificationVrcSfx(); - - const { updateHotkeys } = useHotkeys(); - const { updateSavedPluginsStatus } = usePlugins(); - - const { updateOscIpAddress } = useOscIpAddress(); - const { updateOscPort } = useOscPort(); - const { - updateEnableWebsocket, - updateWebsocketHost, - updateWebsocketPort, - } = useWebsocket(); - - - - const { showNotification_Success, showNotification_Error } = useNotificationStatus(); - - const { handleNetworkConnection } = useHandleNetworkConnection(); - - const { - errorHandling_Backend, - } = _useBackendErrorHandling(); - - const routes = { - // Common - "/run/feed_watchdog": () => {}, - "/run/initialization_progress": updateInitProgress, - "/run/enable_ai_models": (is_ai_models_available) => { - if (is_ai_models_available === false) { - updateIsVrctAvailable(false); - showNotification_Error("AI models have not been detected. Check the network connection and restart VRCT (it will download automatically, normally).", { hide_duration: null }); - } - }, - "/get/data/compute_mode": updateComputeMode, - "/get/data/main_window_geometry": restoreWindowGeometry, - "/set/data/main_window_geometry": () => {}, - "/run/open_filepath_logs": () => console.log("Opened Directory, Message Logs"), - "/run/open_filepath_config_file": () => console.log("Opened Directory, Config File"), - "/run/software_update_info": (payload) => { - updateLatestSoftwareVersionInfo(prev => ({ - is_update_available: payload.is_update_available, - new_version: payload.new_version || prev.data.new_version, - })); - }, - "/run/connected_network": handleNetworkConnection, - "/run/enable_osc_query": ({data, disabled_functions}) => { - handleOscQuery({ - is_osc_query_enabled: data, - disabled_functions: disabled_functions, - }); - }, - - // Main Page - // Page Controls - "/get/data/main_window_sidebar_compact_mode": updateIsMainPageCompactMode, - "/set/enable/main_window_sidebar_compact_mode": updateIsMainPageCompactMode, - "/set/disable/main_window_sidebar_compact_mode": updateIsMainPageCompactMode, - // Main Functions - "/set/enable/translation": updateTranslationStatus, - "/set/disable/translation": updateTranslationStatus, - "/set/enable/transcription_send": updateTranscriptionSendStatus, - "/set/disable/transcription_send": updateTranscriptionSendStatus, - "/set/enable/transcription_receive": updateTranscriptionReceiveStatus, - "/set/disable/transcription_receive": updateTranscriptionReceiveStatus, - - // Language Settings - "/get/data/selected_tab_no": updateSelectedPresetTabNumber, - "/set/data/selected_tab_no": updateSelectedPresetTabNumber, - "/get/data/multi_language_translation": updateEnableMultiTranslation, - "/get/data/selected_your_languages": updateSelectedYourLanguages, - "/set/data/selected_your_languages": updateSelectedYourLanguages, - "/get/data/selected_target_languages": updateSelectedTargetLanguages, - "/set/data/selected_target_languages": updateSelectedTargetLanguages, - - "/get/data/translation_engines": (payload) => { - const updateTranslatorAvailability = (keys) => { - return translator_status.map(translator => ({ - ...translator, - is_available: keys.includes(translator.id), - })); - }; - const updated_list = updateTranslatorAvailability(payload); - updateTranslationEngines(updated_list); - }, - "/run/translation_engines": (payload) => { - const updateTranslatorAvailability = (keys) => { - return translator_status.map(translator => ({ - ...translator, - is_available: keys.includes(translator.id), - })); - }; - const updated_list = updateTranslatorAvailability(payload); - updateTranslationEngines(updated_list); - }, - "/get/data/selected_translation_engines": updateSelectedTranslationEngines, - "/set/data/selected_translation_engines": updateSelectedTranslationEngines, - "/run/selected_translation_engines": updateSelectedTranslationEngines, - - "/run/swap_your_language_and_target_language": (payload) => { - updateSelectedYourLanguages(payload.your); - updateSelectedTargetLanguages(payload.target); - }, - - - // Language Selector - "/get/data/selectable_language_list": updateSelectableLanguageList, - - // Message - "/run/send_message_box": updateSentMessageLogById, - "/run/typing_message_box": ()=>{}, - "/run/stop_typing_message_box": ()=>{}, - "/run/transcription_send_mic_message": addSentMessageLog, - "/run/transcription_receive_speaker_message": addReceivedMessageLog, - - // Message Box - "/get/data/message_box_ratio": updateMessageInputBoxRatio, - "/set/data/message_box_ratio": updateMessageInputBoxRatio, - - - // Config Page - // Common - "/get/data/version": updateSoftwareVersion, - - // Device Tab - "/get/data/auto_mic_select": updateEnableAutoMicSelect, - "/set/enable/auto_mic_select": updateEnableAutoMicSelect, - "/set/disable/auto_mic_select": updateEnableAutoMicSelect, - "/get/data/auto_speaker_select": updateEnableAutoSpeakerSelect, - "/set/enable/auto_speaker_select": updateEnableAutoSpeakerSelect, - "/set/disable/auto_speaker_select": updateEnableAutoSpeakerSelect, - - "/get/data/mic_host_list": (payload) => updateMicHostList(arrayToObject(payload)), - "/run/mic_host_list": (payload) => updateMicHostList(arrayToObject(payload)), - "/get/data/selected_mic_host": updateSelectedMicHost, - "/set/data/selected_mic_host": (payload) => { - updateSelectedMicHost(payload.host); - updateSelectedMicDevice(payload.device); - }, - - "/get/data/mic_device_list": (payload) => updateMicDeviceList(arrayToObject(payload)), - "/run/mic_device_list": (payload) => updateMicDeviceList(arrayToObject(payload)), - "/get/data/selected_mic_device": updateSelectedMicDevice, - "/set/data/selected_mic_device": updateSelectedMicDevice, - - "/run/selected_mic_device": (payload) => { - - updateSelectedMicHost(payload.host); - updateSelectedMicDevice(payload.device); - }, - - "/get/data/speaker_device_list": (payload) => updateSpeakerDeviceList(arrayToObject(payload)), - "/run/speaker_device_list": (payload) => updateSpeakerDeviceList(arrayToObject(payload)), - "/get/data/selected_speaker_device": updateSelectedSpeakerDevice, - "/set/data/selected_speaker_device": updateSelectedSpeakerDevice, - "/run/selected_speaker_device": updateSelectedSpeakerDevice, - - "/run/check_mic_volume": updateVolumeVariable_Mic, - "/run/check_speaker_volume": updateVolumeVariable_Speaker, - "/set/enable/check_mic_threshold": updateMicThresholdCheckStatus, - "/set/disable/check_mic_threshold": updateMicThresholdCheckStatus, - "/set/enable/check_speaker_threshold": updateSpeakerThresholdCheckStatus, - "/set/disable/check_speaker_threshold": updateSpeakerThresholdCheckStatus, - - "/get/data/mic_threshold": updateMicThreshold, - "/set/data/mic_threshold": updateMicThreshold, - "/get/data/speaker_threshold": updateSpeakerThreshold, - "/set/data/speaker_threshold": updateSpeakerThreshold, - - "/get/data/mic_automatic_threshold": updateEnableAutomaticMicThreshold, - "/set/enable/mic_automatic_threshold": updateEnableAutomaticMicThreshold, - "/set/disable/mic_automatic_threshold": updateEnableAutomaticMicThreshold, - "/get/data/speaker_automatic_threshold": updateEnableAutomaticSpeakerThreshold, - "/set/enable/speaker_automatic_threshold": updateEnableAutomaticSpeakerThreshold, - "/set/disable/speaker_automatic_threshold": updateEnableAutomaticSpeakerThreshold, - - // Appearance - "/get/data/ui_language": updateUiLanguage, - "/set/data/ui_language": updateUiLanguage, - - "/get/data/ui_scaling": updateUiScaling, - "/set/data/ui_scaling": updateUiScaling, - - "/get/data/textbox_ui_scaling": updateMessageLogUiScaling, - "/set/data/textbox_ui_scaling": updateMessageLogUiScaling, - - "/get/data/send_message_button_type": updateSendMessageButtonType, - "/set/data/send_message_button_type": updateSendMessageButtonType, - - "/get/data/font_family": updateSelectedFontFamily, - "/set/data/font_family": updateSelectedFontFamily, - - "/get/data/transparency": updateTransparency, - "/set/data/transparency": updateTransparency, - - // Translation - "/get/data/deepl_auth_key": updateDeepLAuthKey, - "/set/data/deepl_auth_key": savedDeepLAuthKey, - "/delete/data/deepl_auth_key": () => updateDeepLAuthKey(""), - - "/get/data/ctranslate2_weight_type": updateSelectedCTranslate2WeightType, - "/set/data/ctranslate2_weight_type": updateSelectedCTranslate2WeightType, - - "/get/data/selectable_ctranslate2_weight_type_dict": updateDownloadedCTranslate2WeightTypeStatus, - - "/get/data/translation_compute_device_list": (payload) => updateSelectableCTranslate2ComputeDeviceList(transformToIndexedArray(payload)), - "/get/data/selected_translation_compute_device": updateSelectedCTranslate2ComputeDevice, - "/set/data/selected_translation_compute_device": updateSelectedCTranslate2ComputeDevice, - - "/run/downloaded_ctranslate2_weight": downloadedCTranslate2WeightType, - "/run/download_ctranslate2_weight": () => {}, - "/run/download_progress_ctranslate2_weight": updateDownloadProgressCTranslate2WeightTypeStatus, - - // Transcription - "/get/data/mic_record_timeout": updateMicRecordTimeout, - "/set/data/mic_record_timeout": updateMicRecordTimeout, - - "/get/data/mic_phrase_timeout": updateMicPhraseTimeout, - "/set/data/mic_phrase_timeout": updateMicPhraseTimeout, - - "/get/data/mic_max_phrases": updateMicMaxWords, - "/set/data/mic_max_phrases": updateMicMaxWords, - - "/get/data/mic_word_filter": (payload) => { - updateMicWordFilterList((prev_list) => { - const updated_list = [...prev_list.data]; - for (const value of payload) { - const existing_item = updated_list.find(item => item.value === value); - if (existing_item) { - existing_item.is_redoable = false; - } else { - updated_list.push({ value, is_redoable: false }); - } - } - return updated_list; - }); - }, - "/set/data/mic_word_filter": (payload) => { - updateMicWordFilterList((prev_list) => { - const updated_list = [...prev_list.data]; - for (const value of payload) { - const existing_item = updated_list.find(item => item.value === value); - if (existing_item) { - existing_item.is_redoable = false; - } else { - updated_list.push({ value, is_redoable: false }); - } - } - return updated_list; - }); - }, - "/run/word_filter": (payload) => addSystemMessageLog(payload.message), - - - "/get/data/speaker_record_timeout": updateSpeakerRecordTimeout, - "/set/data/speaker_record_timeout": updateSpeakerRecordTimeout, - - "/get/data/speaker_phrase_timeout": updateSpeakerPhraseTimeout, - "/set/data/speaker_phrase_timeout": updateSpeakerPhraseTimeout, - - "/get/data/speaker_max_phrases": updateSpeakerMaxWords, - "/set/data/speaker_max_phrases": updateSpeakerMaxWords, - - "/get/data/selected_transcription_engine": updateSelectedTranscriptionEngine, - "/set/data/selected_transcription_engine": updateSelectedTranscriptionEngine, - - "/get/data/whisper_weight_type": updateSelectedWhisperWeightType, - "/set/data/whisper_weight_type": updateSelectedWhisperWeightType, - - "/get/data/selectable_whisper_weight_type_dict": updateDownloadedWhisperWeightTypeStatus, - - "/run/downloaded_whisper_weight": downloadedWhisperWeightType, - "/run/download_whisper_weight": () => {}, - "/run/download_progress_whisper_weight": updateDownloadProgressWhisperWeightTypeStatus, - - "/get/data/transcription_compute_device_list": (payload) => updateSelectableWhisperComputeDeviceList(transformToIndexedArray(payload)), - "/get/data/selected_transcription_compute_device": updateSelectedWhisperComputeDevice, - "/set/data/selected_transcription_compute_device": updateSelectedWhisperComputeDevice, - - // VR - "/get/data/overlay_small_log": updateIsEnabledOverlaySmallLog, - "/set/enable/overlay_small_log": updateIsEnabledOverlaySmallLog, - "/set/disable/overlay_small_log": updateIsEnabledOverlaySmallLog, - - "/get/data/overlay_small_log_settings": updateOverlaySmallLogSettings, - "/set/data/overlay_small_log_settings": updateOverlaySmallLogSettings, - - "/get/data/overlay_large_log": updateIsEnabledOverlayLargeLog, - "/set/enable/overlay_large_log": updateIsEnabledOverlayLargeLog, - "/set/disable/overlay_large_log": updateIsEnabledOverlayLargeLog, - - "/get/data/overlay_large_log_settings": updateOverlayLargeLogSettings, - "/set/data/overlay_large_log_settings": updateOverlayLargeLogSettings, - - "/get/data/overlay_show_only_translated_messages": updateOverlayShowOnlyTranslatedMessages, - "/set/enable/overlay_show_only_translated_messages": updateOverlayShowOnlyTranslatedMessages, - "/set/disable/overlay_show_only_translated_messages": updateOverlayShowOnlyTranslatedMessages, - - "/run/send_text_overlay": () => {}, - - // Others Tab - "/get/data/auto_clear_message_box": updateEnableAutoClearMessageInputBox, - "/set/enable/auto_clear_message_box": updateEnableAutoClearMessageInputBox, - "/set/disable/auto_clear_message_box": updateEnableAutoClearMessageInputBox, - - "/get/data/send_only_translated_messages": updateEnableSendOnlyTranslatedMessages, - "/set/enable/send_only_translated_messages": updateEnableSendOnlyTranslatedMessages, - "/set/disable/send_only_translated_messages": updateEnableSendOnlyTranslatedMessages, - - "/get/data/logger_feature": updateEnableAutoExportMessageLogs, - "/set/enable/logger_feature": updateEnableAutoExportMessageLogs, - "/set/disable/logger_feature": updateEnableAutoExportMessageLogs, - - "/get/data/vrc_mic_mute_sync": (payload) => updateEnableVrcMicMuteSync((old_value) => { - return {...old_value.data, is_enabled: payload}; - }), - "/set/enable/vrc_mic_mute_sync": (payload) => updateEnableVrcMicMuteSync((old_value) => { - return {...old_value.data, is_enabled: payload}; - }), - "/set/disable/vrc_mic_mute_sync": (payload) => updateEnableVrcMicMuteSync((old_value) => { - return {...old_value.data, is_enabled: payload}; - }), - - "/get/data/send_message_to_vrc": updateEnableSendMessageToVrc, - "/set/enable/send_message_to_vrc": updateEnableSendMessageToVrc, - "/set/disable/send_message_to_vrc": updateEnableSendMessageToVrc, - - "/get/data/send_received_message_to_vrc": updateEnableSendReceivedMessageToVrc, - "/set/enable/send_received_message_to_vrc": updateEnableSendReceivedMessageToVrc, - "/set/disable/send_received_message_to_vrc": updateEnableSendReceivedMessageToVrc, - - "/get/data/notification_vrc_sfx": updateEnableNotificationVrcSfx, - "/set/enable/notification_vrc_sfx": updateEnableNotificationVrcSfx, - "/set/disable/notification_vrc_sfx": updateEnableNotificationVrcSfx, - - // Hotkeys - "/get/data/hotkeys": updateHotkeys, - "/set/data/hotkeys": updateHotkeys, - - // Plugins - "/get/data/plugins_status": updateSavedPluginsStatus, - "/set/data/plugins_status": updateSavedPluginsStatus, - - // Advanced Settings - "/get/data/osc_ip_address": updateOscIpAddress, - "/set/data/osc_ip_address": updateOscIpAddress, - - "/get/data/osc_port": updateOscPort, - "/set/data/osc_port": updateOscPort, - - "/get/data/websocket_server": updateEnableWebsocket, - "/set/enable/websocket_server": updateEnableWebsocket, - "/set/disable/websocket_server": updateEnableWebsocket, - - "/get/data/websocket_host": updateWebsocketHost, - "/set/data/websocket_host": updateWebsocketHost, - - "/get/data/websocket_port": updateWebsocketPort, - "/set/data/websocket_port": updateWebsocketPort, - - "/get/data/mic_avg_logprob": ()=>{}, // Not implemented on UI yet - "/get/data/mic_no_speech_prob": ()=>{}, // Not implemented on UI yet - "/get/data/speaker_avg_logprob": ()=>{}, // Not implemented on UI yet - "/get/data/speaker_no_speech_prob": ()=>{}, // Not implemented on UI yet - "/get/data/convert_message_to_romaji": ()=>{}, // Not implemented on UI yet - "/get/data/convert_message_to_hiragana": ()=>{}, // Not implemented on UI yet - "/get/data/transcription_engines": ()=>{}, // Not implemented on UI yet. (if ai_models has not been detected, this will be blank array[]. if the ai_models are ok but just network has not connected, it'l be only ["Whisper"]) + const handleInvalidEndpoint = (parsed_data) => { + console.error(`Invalid endpoint: ${parsed_data.endpoint}\nresult: ${JSON.stringify(parsed_data.result)}`); }; + const hook_results = {}; + ROUTE_META_LIST.forEach(({ ns, hook_name }) => { + if (ns && hook_name && !(hook_name in hook_results)) { + hook_results[hook_name] = ns[hook_name](); + } + }); + + const noop = () => {}; + + const routes = Object.fromEntries( + ROUTE_META_LIST.map(({ endpoint, hook_name, method_name }) => { + const result_obj = hook_results[hook_name] || {}; + const fn = result_obj[method_name]; + return [endpoint, typeof fn === "function" ? fn : noop]; + }) + ); + + const receiveRoutes = (parsed_data) => { - const initDataSyncProcess = (payload) => { - for (const [endpoint, value] of Object.entries(payload)) { - const route = routes[endpoint]; - (route) ? route(value) : console.error(`Invalid endpoint: ${endpoint}\nvalue: ${JSON.stringify(value)}`); - } - }; + const { endpoint, status, result } = parsed_data; - const handleInvalidEndpoint = (parsed_data) => { - console.error(`Invalid endpoint: ${parsed_data.endpoint}\nresult: ${JSON.stringify(parsed_data.result)}`); - }; - - if (parsed_data.endpoint === "/run/initialization_complete") { - initDataSyncProcess(parsed_data.result); + if (endpoint === "/run/initialization_complete") { + Object.entries(result).forEach(([ep, value]) => { + if (ep in routes) { + routes[ep](value); + } else { + handleInvalidEndpoint({ endpoint: ep, result: value }); + } + }); updateIsBackendReady(true); return; - }; + } - switch (parsed_data.status) { + + switch (status) { case 200: - const route = routes[parsed_data.endpoint]; - if (route) { - route(parsed_data.result); + if (endpoint in routes) { + routes[endpoint](result); } else { handleInvalidEndpoint(parsed_data); } @@ -580,31 +364,24 @@ export const useReceiveRoutes = () => { result: parsed_data.result, }); break; - case 500: - showNotification_Error( - `An error occurred. Please restart VRCT or contact the developers. ${JSON.stringify(parsed_data.result)}`, { hide_duration: null }); - break; case 348: // console.log(`from backend: %c ${JSON.stringify(parsed_data)}`, style_348); break; + case 500: + showNotification_Error( + `An error occurred. Please restart VRCT or contact the developers. ${JSON.stringify(parsed_data.result)}`, { hide_duration: null }); + break; + default: console.log("Received data status does not match.", parsed_data); - break; } - }; + return { receiveRoutes }; }; const style_348 = [ "color: gray", -].join(";"); - -const transformToIndexedArray = (devices) => { - return devices.reduce((result, device, index) => { - result[index] = device; - return result; - }, {}); -}; \ No newline at end of file +].join(";"); \ No newline at end of file diff --git a/src-ui/store.js b/src-ui/store.js index fcd4c0fd..159385ae 100644 --- a/src-ui/store.js +++ b/src-ui/store.js @@ -153,7 +153,6 @@ export const { atomInstance: Atom_TranscriptionReceiveStatus, useHook: useStore_ export const { atomInstance: Atom_ForegroundStatus, useHook: useStore_ForegroundStatus } = createAtomWithHook(false, "ForegroundStatus", {is_state_ok: true}); export const { atomInstance: Atom_SelectedPresetTabNumber, useHook: useStore_SelectedPresetTabNumber } = createAtomWithHook("1", "SelectedPresetTabNumber"); -export const { atomInstance: Atom_EnableMultiTranslation, useHook: useStore_EnableMultiTranslation } = createAtomWithHook(false, "EnableMultiTranslation"); export const { atomInstance: Atom_SelectedYourLanguages, useHook: useStore_SelectedYourLanguages } = createAtomWithHook({}, "SelectedYourLanguages"); export const { atomInstance: Atom_SelectedTargetLanguages, useHook: useStore_SelectedTargetLanguages } = createAtomWithHook({}, "SelectedTargetLanguages"); diff --git a/src-ui/utils.js b/src-ui/utils.js index 96a87c75..2f5f8bdc 100644 --- a/src-ui/utils.js +++ b/src-ui/utils.js @@ -57,4 +57,12 @@ export const genNumArray = (count, start_from = 0) => { export const genNumObjArray = (count, start_from = 0) => { return arrayToObject(genNumArray(count, start_from)); +}; + +// This is using for only AI models compute device list, currently. (CTranslate2, Whisper) +export const transformToIndexedArray = (devices) => { + return devices.reduce((result, device, index) => { + result[index] = device; + return result; + }, {}); }; \ No newline at end of file From 488655263919d85e41d98b7923f91bae4198fee9 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 14 Jun 2025 03:24:39 +0900 Subject: [PATCH 23/41] [Refactor] Put together device-related logic into useDevice. --- .../ThresholdComponent.jsx | 7 +- .../slider_and_meter/SliderAndMeter.jsx | 7 +- .../setting_box/device/Device.jsx | 44 +-- src-ui/logics/configs/device/useDevice.js | 257 ++++++++++++++++++ .../configs/device/useEnableAutoMicSelect.js | 28 -- .../device/useEnableAutoSpeakerSelect.js | 28 -- .../logics/configs/device/useMicDeviceList.js | 27 -- .../logics/configs/device/useMicHostList.js | 25 -- .../logics/configs/device/useMicThreshold.js | 42 --- .../configs/device/useSelectedMicDevice.js | 24 -- .../configs/device/useSelectedMicHost.js | 37 --- .../device/useSelectedSpeakerDevice.js | 24 -- .../configs/device/useSpeakerDeviceList.js | 26 -- .../configs/device/useSpeakerThreshold.js | 42 --- src-ui/logics/configs/index.js | 11 +- src-ui/logics/useReceiveRoutes.js | 60 ++-- 16 files changed, 318 insertions(+), 371 deletions(-) create mode 100644 src-ui/logics/configs/device/useDevice.js delete mode 100644 src-ui/logics/configs/device/useEnableAutoMicSelect.js delete mode 100644 src-ui/logics/configs/device/useEnableAutoSpeakerSelect.js delete mode 100644 src-ui/logics/configs/device/useMicDeviceList.js delete mode 100644 src-ui/logics/configs/device/useMicHostList.js delete mode 100644 src-ui/logics/configs/device/useMicThreshold.js delete mode 100644 src-ui/logics/configs/device/useSelectedMicDevice.js delete mode 100644 src-ui/logics/configs/device/useSelectedMicHost.js delete mode 100644 src-ui/logics/configs/device/useSelectedSpeakerDevice.js delete mode 100644 src-ui/logics/configs/device/useSpeakerDeviceList.js delete mode 100644 src-ui/logics/configs/device/useSpeakerThreshold.js diff --git a/src-ui/app/config_page/setting_section/setting_box/_components/threshold_component/ThresholdComponent.jsx b/src-ui/app/config_page/setting_section/setting_box/_components/threshold_component/ThresholdComponent.jsx index 018f3845..e9fb29fb 100644 --- a/src-ui/app/config_page/setting_section/setting_box/_components/threshold_component/ThresholdComponent.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/_components/threshold_component/ThresholdComponent.jsx @@ -7,8 +7,7 @@ import { useVolume } from "@logics_common"; import MicSvg from "@images/mic.svg?react"; import HeadphonesSvg from "@images/headphones.svg?react"; import { - useMicThreshold, - useSpeakerThreshold, + useDevice, } from "@logics_configs"; export const ThresholdComponent = (props) => { @@ -27,7 +26,7 @@ const MicComponent = (props) => { currentMicThreshold, setMicThreshold, currentEnableAutomaticMicThreshold, - } = useMicThreshold(); + } = useDevice(); const [ui_threshold, setUiThreshold] = useState(currentMicThreshold.data); const { volumeCheckStart_Mic, @@ -84,7 +83,7 @@ const SpeakerComponent = (props) => { currentSpeakerThreshold, setSpeakerThreshold, currentEnableAutomaticSpeakerThreshold, - } = useSpeakerThreshold(); + } = useDevice(); const [ui_threshold, setUiThreshold] = useState(currentSpeakerThreshold.data); const { volumeCheckStart_Speaker, diff --git a/src-ui/app/config_page/setting_section/setting_box/_components/threshold_component/slider_and_meter/SliderAndMeter.jsx b/src-ui/app/config_page/setting_section/setting_box/_components/threshold_component/slider_and_meter/SliderAndMeter.jsx index 8c67637c..475f2410 100644 --- a/src-ui/app/config_page/setting_section/setting_box/_components/threshold_component/slider_and_meter/SliderAndMeter.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/_components/threshold_component/slider_and_meter/SliderAndMeter.jsx @@ -4,8 +4,7 @@ import { useStore_SpeakerVolume, } from "@store"; import { - useMicThreshold, - useSpeakerThreshold, + useDevice, } from "@logics_configs"; export const SliderAndMeter = (props) => { @@ -24,7 +23,7 @@ export const SliderAndMeter = (props) => { const ThresholdVolumeMeter_Mic = (props) => { const { currentMicVolume } = useStore_MicVolume(); - const { currentEnableAutomaticMicThreshold } = useMicThreshold(); + const { currentEnableAutomaticMicThreshold } = useDevice(); const currentVolumeVariable = Math.min(currentMicVolume.data, props.max); const volume_width_percentage = (currentVolumeVariable / props.max) * 100; @@ -50,7 +49,7 @@ const ThresholdVolumeMeter_Mic = (props) => { const ThresholdVolumeMeter_Speaker = (props) => { const { currentSpeakerVolume } = useStore_SpeakerVolume(); - const { currentEnableAutomaticSpeakerThreshold } = useSpeakerThreshold(); + const { currentEnableAutomaticSpeakerThreshold } = useDevice(); const currentVolumeVariable = Math.min(currentSpeakerVolume.data, props.max); const volume_width_percentage = (currentVolumeVariable / props.max) * 100; diff --git a/src-ui/app/config_page/setting_section/setting_box/device/Device.jsx b/src-ui/app/config_page/setting_section/setting_box/device/Device.jsx index 56b11398..d3f20645 100644 --- a/src-ui/app/config_page/setting_section/setting_box/device/Device.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/device/Device.jsx @@ -4,16 +4,7 @@ import clsx from "clsx"; import { useStore_IsBreakPoint } from "@store"; import { ui_configs } from "@ui_configs"; import { - useEnableAutoMicSelect, - useMicHostList, - useSelectedMicHost, - useMicDeviceList, - useSelectedMicDevice, - useMicThreshold, - useEnableAutoSpeakerSelect, - useSpeakerDeviceList, - useSelectedSpeakerDevice, - useSpeakerThreshold, + useDevice, } from "@logics_configs"; import { @@ -38,13 +29,21 @@ export const Device = () => { const Mic_Container = () => { const { t } = useTranslation(); - const { currentEnableAutoMicSelect, toggleEnableAutoMicSelect } = useEnableAutoMicSelect(); - const { currentSelectedMicHost, setSelectedMicHost } = useSelectedMicHost(); - const { currentMicHostList } = useMicHostList(); - const { currentSelectedMicDevice, setSelectedMicDevice } = useSelectedMicDevice(); - const { currentMicDeviceList } = useMicDeviceList(); + const { + currentEnableAutoMicSelect, + toggleEnableAutoMicSelect, + currentMicDeviceList, + currentMicHostList, + + currentSelectedMicHost, + setSelectedMicHost, + currentSelectedMicDevice, + setSelectedMicDevice, + + currentEnableAutomaticMicThreshold, + toggleEnableAutomaticMicThreshold, + } = useDevice(); const { onMouseLeaveFunction } = useOnMouseLeaveDropdownMenu(); - const { currentEnableAutomaticMicThreshold, toggleEnableAutomaticMicThreshold } = useMicThreshold(); const selectFunction_host = (selected_data) => { setSelectedMicHost(selected_data.selected_id); @@ -139,11 +138,16 @@ const Mic_Container = () => { const Speaker_Container = () => { const { t } = useTranslation(); - const { currentEnableAutoSpeakerSelect, toggleEnableAutoSpeakerSelect } = useEnableAutoSpeakerSelect(); - const { currentSelectedSpeakerDevice, setSelectedSpeakerDevice } = useSelectedSpeakerDevice(); - const { currentSpeakerDeviceList } = useSpeakerDeviceList(); + const { + currentEnableAutoSpeakerSelect, + toggleEnableAutoSpeakerSelect, + currentSpeakerDeviceList, + currentSelectedSpeakerDevice, + setSelectedSpeakerDevice, + currentEnableAutomaticSpeakerThreshold, + toggleEnableAutomaticSpeakerThreshold, + } = useDevice(); const { onMouseLeaveFunction } = useOnMouseLeaveDropdownMenu(); - const { currentEnableAutomaticSpeakerThreshold, toggleEnableAutomaticSpeakerThreshold } = useSpeakerThreshold(); const selectFunction = (selected_data) => { setSelectedSpeakerDevice(selected_data.selected_id); diff --git a/src-ui/logics/configs/device/useDevice.js b/src-ui/logics/configs/device/useDevice.js new file mode 100644 index 00000000..25a05f1c --- /dev/null +++ b/src-ui/logics/configs/device/useDevice.js @@ -0,0 +1,257 @@ +import { + useStore_EnableAutoMicSelect, + useStore_EnableAutoSpeakerSelect, + + useStore_MicDeviceList, + useStore_MicHostList, + useStore_SpeakerDeviceList, + + useStore_SelectedMicHost, + useStore_SelectedMicDevice, + + useStore_SelectedSpeakerDevice, + + useStore_MicThreshold, + useStore_EnableAutomaticMicThreshold, + useStore_SpeakerThreshold, + useStore_EnableAutomaticSpeakerThreshold, +} from "@store"; +import { useStdoutToPython } from "@useStdoutToPython"; +import { arrayToObject } from "@utils"; + +export const useDevice = () => { + const { asyncStdoutToPython } = useStdoutToPython(); + + const { currentEnableAutoMicSelect, updateEnableAutoMicSelect, pendingEnableAutoMicSelect } = useStore_EnableAutoMicSelect(); + const { currentEnableAutoSpeakerSelect, updateEnableAutoSpeakerSelect, pendingEnableAutoSpeakerSelect } = useStore_EnableAutoSpeakerSelect(); + + const { currentMicDeviceList, updateMicDeviceList, pendingMicDeviceList } = useStore_MicDeviceList(); + const { currentMicHostList, updateMicHostList, pendingMicHostList } = useStore_MicHostList(); + const { currentSpeakerDeviceList, updateSpeakerDeviceList, pendingSpeakerDeviceList } = useStore_SpeakerDeviceList(); + + const { currentSelectedMicHost, updateSelectedMicHost, pendingSelectedMicHost } = useStore_SelectedMicHost(); + const { currentSelectedMicDevice, updateSelectedMicDevice, pendingSelectedMicDevice } = useStore_SelectedMicDevice(); + + const { currentSelectedSpeakerDevice, updateSelectedSpeakerDevice, pendingSelectedSpeakerDevice } = useStore_SelectedSpeakerDevice(); + + const { updateMicThreshold, currentMicThreshold } = useStore_MicThreshold(); + const { updateEnableAutomaticMicThreshold, currentEnableAutomaticMicThreshold, pendingEnableAutomaticMicThreshold } = useStore_EnableAutomaticMicThreshold(); + + const { updateSpeakerThreshold, currentSpeakerThreshold } = useStore_SpeakerThreshold(); + const { updateEnableAutomaticSpeakerThreshold, currentEnableAutomaticSpeakerThreshold, pendingEnableAutomaticSpeakerThreshold } = useStore_EnableAutomaticSpeakerThreshold(); + + // Auto Select (Mic) + const getEnableAutoMicSelect = () => { + pendingEnableAutoMicSelect(); + asyncStdoutToPython("/get/data/auto_mic_select"); + }; + + const toggleEnableAutoMicSelect = () => { + pendingEnableAutoMicSelect(); + if (currentEnableAutoMicSelect.data) { + asyncStdoutToPython("/set/disable/auto_mic_select"); + } else { + asyncStdoutToPython("/set/enable/auto_mic_select"); + } + }; + // Auto Select (Speaker) + const getEnableAutoSpeakerSelect = () => { + pendingEnableAutoSpeakerSelect(); + asyncStdoutToPython("/get/data/auto_speaker_select"); + }; + + const toggleEnableAutoSpeakerSelect = () => { + pendingEnableAutoSpeakerSelect(); + if (currentEnableAutoSpeakerSelect.data) { + asyncStdoutToPython("/set/disable/auto_speaker_select"); + } else { + asyncStdoutToPython("/set/enable/auto_speaker_select"); + } + }; + + + // List (Mic device) + const getMicDeviceList = () => { + pendingMicDeviceList(); + asyncStdoutToPython("/get/data/mic_device_list"); + }; + + const updateMicDeviceList_FromBackend = (payload) => { + updateMicDeviceList(arrayToObject(payload)); + }; + // List (Mic host) + const getMicHostList = () => { + pendingMicHostList(); + asyncStdoutToPython("/get/data/mic_host_list"); + }; + + const updateMicHostList_FromBackend = (payload) => { + updateMicHostList(arrayToObject(payload)); + }; + // List (Speaker device) + const getSpeakerDeviceList = () => { + pendingSpeakerDeviceList(); + asyncStdoutToPython("/get/data/speaker_device_list"); + }; + + const updateSpeakerDeviceList_FromBackend = (payload) => { + updateSpeakerDeviceList(arrayToObject(payload)); + }; + + + // Selected (Mic host) + const getSelectedMicHost = () => { + pendingSelectedMicHost(); + asyncStdoutToPython("/get/data/selected_mic_host"); + }; + + const setSelectedMicHost = (selected_mic_host) => { + pendingSelectedMicHost(); + asyncStdoutToPython("/set/data/selected_mic_host", selected_mic_host); + }; + // Selected (Mic device) + const getSelectedMicDevice = () => { + pendingSelectedMicDevice(); + asyncStdoutToPython("/get/data/selected_mic_device"); + }; + + const setSelectedMicDevice = (selected_mic_device) => { + pendingSelectedMicDevice(); + asyncStdoutToPython("/set/data/selected_mic_device", selected_mic_device); + }; + + // Selected (Mic and Host) + const updateSelectedMicHostAndDevice = (payload) => { + updateSelectedMicHost(payload.host); + updateSelectedMicDevice(payload.device); + }; + + // Selected (Speaker device) + const getSelectedSpeakerDevice = () => { + pendingSelectedSpeakerDevice(); + asyncStdoutToPython("/get/data/selected_speaker_device"); + }; + + const setSelectedSpeakerDevice = (selected_speaker_device) => { + pendingSelectedSpeakerDevice(); + asyncStdoutToPython("/set/data/selected_speaker_device", selected_speaker_device); + }; + + + // Threshold (Mic) + const getMicThreshold = () => { + asyncStdoutToPython("/get/data/mic_threshold"); + }; + + const setMicThreshold = (mic_threshold) => { + asyncStdoutToPython("/set/data/mic_threshold", mic_threshold); + }; + + const getEnableAutomaticMicThreshold = () => { + pendingEnableAutomaticMicThreshold(); + asyncStdoutToPython("/get/data/mic_automatic_threshold"); + }; + + const toggleEnableAutomaticMicThreshold = () => { + pendingEnableAutomaticMicThreshold(); + if (currentEnableAutomaticMicThreshold.data) { + asyncStdoutToPython("/set/disable/mic_automatic_threshold"); + } else { + asyncStdoutToPython("/set/enable/mic_automatic_threshold"); + } + }; + // Threshold (Speaker) + const getSpeakerThreshold = () => { + asyncStdoutToPython("/get/data/speaker_threshold"); + }; + + const setSpeakerThreshold = (speaker_threshold) => { + asyncStdoutToPython("/set/data/speaker_threshold", speaker_threshold); + }; + + const getEnableAutomaticSpeakerThreshold = () => { + pendingEnableAutomaticSpeakerThreshold(); + asyncStdoutToPython("/get/data/speaker_automatic_threshold"); + }; + + const toggleEnableAutomaticSpeakerThreshold = () => { + pendingEnableAutomaticSpeakerThreshold(); + if (currentEnableAutomaticSpeakerThreshold.data) { + asyncStdoutToPython("/set/disable/speaker_automatic_threshold"); + } else { + asyncStdoutToPython("/set/enable/speaker_automatic_threshold"); + } + }; + + + + return { + currentEnableAutoMicSelect, + getEnableAutoMicSelect, + updateEnableAutoMicSelect, + toggleEnableAutoMicSelect, + + currentEnableAutoSpeakerSelect, + getEnableAutoSpeakerSelect, + updateEnableAutoSpeakerSelect, + toggleEnableAutoSpeakerSelect, + + + currentMicDeviceList, + getMicDeviceList, + updateMicDeviceList, + updateMicDeviceList_FromBackend, + + currentMicHostList, + getMicHostList, + updateMicHostList, + updateMicHostList_FromBackend, + + currentSpeakerDeviceList, + getSpeakerDeviceList, + updateSpeakerDeviceList, + updateSpeakerDeviceList_FromBackend, + + + currentSelectedMicHost, + getSelectedMicHost, + updateSelectedMicHost, + setSelectedMicHost, + + currentSelectedMicDevice, + getSelectedMicDevice, + updateSelectedMicDevice, + setSelectedMicDevice, + + updateSelectedMicHostAndDevice, + + + currentSelectedSpeakerDevice, + getSelectedSpeakerDevice, + updateSelectedSpeakerDevice, + setSelectedSpeakerDevice, + + + currentMicThreshold, + getMicThreshold, + setMicThreshold, + updateMicThreshold, + + currentEnableAutomaticMicThreshold, + getEnableAutomaticMicThreshold, + toggleEnableAutomaticMicThreshold, + updateEnableAutomaticMicThreshold, + + currentSpeakerThreshold, + getSpeakerThreshold, + setSpeakerThreshold, + updateSpeakerThreshold, + + currentEnableAutomaticSpeakerThreshold, + getEnableAutomaticSpeakerThreshold, + toggleEnableAutomaticSpeakerThreshold, + updateEnableAutomaticSpeakerThreshold, + + + }; +}; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useEnableAutoMicSelect.js b/src-ui/logics/configs/device/useEnableAutoMicSelect.js deleted file mode 100644 index c9f7e5d6..00000000 --- a/src-ui/logics/configs/device/useEnableAutoMicSelect.js +++ /dev/null @@ -1,28 +0,0 @@ -import { useStore_EnableAutoMicSelect } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useEnableAutoMicSelect = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentEnableAutoMicSelect, updateEnableAutoMicSelect, pendingEnableAutoMicSelect } = useStore_EnableAutoMicSelect(); - - const getEnableAutoMicSelect = () => { - pendingEnableAutoMicSelect(); - asyncStdoutToPython("/get/data/auto_mic_select"); - }; - - const toggleEnableAutoMicSelect = () => { - pendingEnableAutoMicSelect(); - if (currentEnableAutoMicSelect.data) { - asyncStdoutToPython("/set/disable/auto_mic_select"); - } else { - asyncStdoutToPython("/set/enable/auto_mic_select"); - } - }; - - return { - currentEnableAutoMicSelect, - getEnableAutoMicSelect, - updateEnableAutoMicSelect, - toggleEnableAutoMicSelect, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useEnableAutoSpeakerSelect.js b/src-ui/logics/configs/device/useEnableAutoSpeakerSelect.js deleted file mode 100644 index 406cbf25..00000000 --- a/src-ui/logics/configs/device/useEnableAutoSpeakerSelect.js +++ /dev/null @@ -1,28 +0,0 @@ -import { useStore_EnableAutoSpeakerSelect } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useEnableAutoSpeakerSelect = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentEnableAutoSpeakerSelect, updateEnableAutoSpeakerSelect, pendingEnableAutoSpeakerSelect } = useStore_EnableAutoSpeakerSelect(); - - const getEnableAutoSpeakerSelect = () => { - pendingEnableAutoSpeakerSelect(); - asyncStdoutToPython("/get/data/auto_speaker_select"); - }; - - const toggleEnableAutoSpeakerSelect = () => { - pendingEnableAutoSpeakerSelect(); - if (currentEnableAutoSpeakerSelect.data) { - asyncStdoutToPython("/set/disable/auto_speaker_select"); - } else { - asyncStdoutToPython("/set/enable/auto_speaker_select"); - } - }; - - return { - currentEnableAutoSpeakerSelect, - getEnableAutoSpeakerSelect, - updateEnableAutoSpeakerSelect, - toggleEnableAutoSpeakerSelect, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useMicDeviceList.js b/src-ui/logics/configs/device/useMicDeviceList.js deleted file mode 100644 index d145a890..00000000 --- a/src-ui/logics/configs/device/useMicDeviceList.js +++ /dev/null @@ -1,27 +0,0 @@ -import { useStore_MicDeviceList } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; -import { arrayToObject } from "@utils"; - -export const useMicDeviceList = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentMicDeviceList, updateMicDeviceList, pendingMicDeviceList } = useStore_MicDeviceList(); - - const getMicDeviceList = () => { - pendingMicDeviceList(); - asyncStdoutToPython("/get/data/mic_device_list"); - }; - - - const updateMicDeviceList_FromBackend = (payload) => { - updateMicDeviceList(arrayToObject(payload)); - }; - - - return { - currentMicDeviceList, - getMicDeviceList, - updateMicDeviceList, - - updateMicDeviceList_FromBackend, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useMicHostList.js b/src-ui/logics/configs/device/useMicHostList.js deleted file mode 100644 index 898f348c..00000000 --- a/src-ui/logics/configs/device/useMicHostList.js +++ /dev/null @@ -1,25 +0,0 @@ -import { useStore_MicHostList } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; -import { arrayToObject } from "@utils"; - -export const useMicHostList = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentMicHostList, updateMicHostList, pendingMicHostList } = useStore_MicHostList(); - - const getMicHostList = () => { - pendingMicHostList(); - asyncStdoutToPython("/get/data/mic_host_list"); - }; - - const updateMicHostList_FromBackend = (payload) => { - updateMicHostList(arrayToObject(payload)); - }; - - return { - currentMicHostList, - getMicHostList, - updateMicHostList, - - updateMicHostList_FromBackend, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useMicThreshold.js b/src-ui/logics/configs/device/useMicThreshold.js deleted file mode 100644 index a6224c38..00000000 --- a/src-ui/logics/configs/device/useMicThreshold.js +++ /dev/null @@ -1,42 +0,0 @@ -import { useStore_MicThreshold, useStore_EnableAutomaticMicThreshold } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useMicThreshold = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { updateMicThreshold, currentMicThreshold } = useStore_MicThreshold(); - const { updateEnableAutomaticMicThreshold, currentEnableAutomaticMicThreshold, pendingEnableAutomaticMicThreshold } = useStore_EnableAutomaticMicThreshold(); - - const getMicThreshold = () => { - asyncStdoutToPython("/get/data/mic_threshold"); - }; - - const setMicThreshold = (mic_threshold) => { - asyncStdoutToPython("/set/data/mic_threshold", mic_threshold); - }; - - const getEnableAutomaticMicThreshold = () => { - pendingEnableAutomaticMicThreshold(); - asyncStdoutToPython("/get/data/mic_automatic_threshold"); - }; - - const toggleEnableAutomaticMicThreshold = () => { - pendingEnableAutomaticMicThreshold(); - if (currentEnableAutomaticMicThreshold.data) { - asyncStdoutToPython("/set/disable/mic_automatic_threshold"); - } else { - asyncStdoutToPython("/set/enable/mic_automatic_threshold"); - } - }; - - return { - currentMicThreshold, - getMicThreshold, - setMicThreshold, - updateMicThreshold, - - currentEnableAutomaticMicThreshold, - getEnableAutomaticMicThreshold, - toggleEnableAutomaticMicThreshold, - updateEnableAutomaticMicThreshold, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useSelectedMicDevice.js b/src-ui/logics/configs/device/useSelectedMicDevice.js deleted file mode 100644 index 6bd7d11a..00000000 --- a/src-ui/logics/configs/device/useSelectedMicDevice.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_SelectedMicDevice } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useSelectedMicDevice = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSelectedMicDevice, updateSelectedMicDevice, pendingSelectedMicDevice } = useStore_SelectedMicDevice(); - - const getSelectedMicDevice = () => { - pendingSelectedMicDevice(); - asyncStdoutToPython("/get/data/selected_mic_device"); - }; - - const setSelectedMicDevice = (selected_mic_device) => { - pendingSelectedMicDevice(); - asyncStdoutToPython("/set/data/selected_mic_device", selected_mic_device); - }; - - return { - currentSelectedMicDevice, - getSelectedMicDevice, - updateSelectedMicDevice, - setSelectedMicDevice, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useSelectedMicHost.js b/src-ui/logics/configs/device/useSelectedMicHost.js deleted file mode 100644 index 0197cfc8..00000000 --- a/src-ui/logics/configs/device/useSelectedMicHost.js +++ /dev/null @@ -1,37 +0,0 @@ -import { useStore_SelectedMicHost } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; -import { useSelectedMicDevice } from "@logics_configs"; - -export const useSelectedMicHost = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSelectedMicHost, updateSelectedMicHost, pendingSelectedMicHost } = useStore_SelectedMicHost(); - - const { updateSelectedMicDevice } = useSelectedMicDevice(); - - const getSelectedMicHost = () => { - pendingSelectedMicHost(); - asyncStdoutToPython("/get/data/selected_mic_host"); - }; - - const setSelectedMicHost = (selected_mic_host) => { - pendingSelectedMicHost(); - asyncStdoutToPython("/set/data/selected_mic_host", selected_mic_host); - }; - - - // Need refactoring (Duplicated, Host, Device) - const updateSelectedMicHostAndDevice = (payload) => { - updateSelectedMicHost(payload.host); - updateSelectedMicDevice(payload.device); - }; - - - return { - currentSelectedMicHost, - getSelectedMicHost, - updateSelectedMicHost, - setSelectedMicHost, - - updateSelectedMicHostAndDevice, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useSelectedSpeakerDevice.js b/src-ui/logics/configs/device/useSelectedSpeakerDevice.js deleted file mode 100644 index 672a9267..00000000 --- a/src-ui/logics/configs/device/useSelectedSpeakerDevice.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_SelectedSpeakerDevice } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useSelectedSpeakerDevice = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSelectedSpeakerDevice, updateSelectedSpeakerDevice, pendingSelectedSpeakerDevice } = useStore_SelectedSpeakerDevice(); - - const getSelectedSpeakerDevice = () => { - pendingSelectedSpeakerDevice(); - asyncStdoutToPython("/get/data/selected_speaker_device"); - }; - - const setSelectedSpeakerDevice = (selected_speaker_device) => { - pendingSelectedSpeakerDevice(); - asyncStdoutToPython("/set/data/selected_speaker_device", selected_speaker_device); - }; - - return { - currentSelectedSpeakerDevice, - getSelectedSpeakerDevice, - updateSelectedSpeakerDevice, - setSelectedSpeakerDevice, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useSpeakerDeviceList.js b/src-ui/logics/configs/device/useSpeakerDeviceList.js deleted file mode 100644 index b88ed285..00000000 --- a/src-ui/logics/configs/device/useSpeakerDeviceList.js +++ /dev/null @@ -1,26 +0,0 @@ -import { useStore_SpeakerDeviceList } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; -import { arrayToObject } from "@utils"; - -export const useSpeakerDeviceList = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSpeakerDeviceList, updateSpeakerDeviceList, pendingSpeakerDeviceList } = useStore_SpeakerDeviceList(); - - const getSpeakerDeviceList = () => { - pendingSpeakerDeviceList(); - asyncStdoutToPython("/get/data/speaker_device_list"); - }; - - const updateSpeakerDeviceList_FromBackend = (payload) => { - updateSpeakerDeviceList(arrayToObject(payload)); - }; - - - return { - currentSpeakerDeviceList, - getSpeakerDeviceList, - updateSpeakerDeviceList, - - updateSpeakerDeviceList_FromBackend, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useSpeakerThreshold.js b/src-ui/logics/configs/device/useSpeakerThreshold.js deleted file mode 100644 index c21fe2ef..00000000 --- a/src-ui/logics/configs/device/useSpeakerThreshold.js +++ /dev/null @@ -1,42 +0,0 @@ -import { useStore_SpeakerThreshold, useStore_EnableAutomaticSpeakerThreshold } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useSpeakerThreshold = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { updateSpeakerThreshold, currentSpeakerThreshold } = useStore_SpeakerThreshold(); - const { updateEnableAutomaticSpeakerThreshold, currentEnableAutomaticSpeakerThreshold, pendingEnableAutomaticSpeakerThreshold } = useStore_EnableAutomaticSpeakerThreshold(); - - const getSpeakerThreshold = () => { - asyncStdoutToPython("/get/data/speaker_threshold"); - }; - - const setSpeakerThreshold = (speaker_threshold) => { - asyncStdoutToPython("/set/data/speaker_threshold", speaker_threshold); - }; - - const getEnableAutomaticSpeakerThreshold = () => { - pendingEnableAutomaticSpeakerThreshold(); - asyncStdoutToPython("/get/data/speaker_automatic_threshold"); - }; - - const toggleEnableAutomaticSpeakerThreshold = () => { - pendingEnableAutomaticSpeakerThreshold(); - if (currentEnableAutomaticSpeakerThreshold.data) { - asyncStdoutToPython("/set/disable/speaker_automatic_threshold"); - } else { - asyncStdoutToPython("/set/enable/speaker_automatic_threshold"); - } - }; - - return { - currentSpeakerThreshold, - getSpeakerThreshold, - setSpeakerThreshold, - updateSpeakerThreshold, - - currentEnableAutomaticSpeakerThreshold, - getEnableAutomaticSpeakerThreshold, - toggleEnableAutomaticSpeakerThreshold, - updateEnableAutomaticSpeakerThreshold, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/index.js b/src-ui/logics/configs/index.js index 03214771..aadb1519 100644 --- a/src-ui/logics/configs/index.js +++ b/src-ui/logics/configs/index.js @@ -1,13 +1,4 @@ -export { useEnableAutoMicSelect } from "./device/useEnableAutoMicSelect"; -export { useEnableAutoSpeakerSelect } from "./device/useEnableAutoSpeakerSelect"; -export { useMicDeviceList } from "./device/useMicDeviceList"; -export { useMicHostList } from "./device/useMicHostList"; -export { useMicThreshold } from "./device/useMicThreshold"; -export { useSelectedMicDevice } from "./device/useSelectedMicDevice"; -export { useSelectedMicHost } from "./device/useSelectedMicHost"; -export { useSelectedSpeakerDevice } from "./device/useSelectedSpeakerDevice"; -export { useSpeakerDeviceList } from "./device/useSpeakerDeviceList"; -export { useSpeakerThreshold } from "./device/useSpeakerThreshold"; +export { useDevice } from "./device/useDevice"; export { useMessageLogUiScaling } from "./appearance/useMessageLogUiScaling"; export { useSelectedFontFamily } from "./appearance/useSelectedFontFamily"; diff --git a/src-ui/logics/useReceiveRoutes.js b/src-ui/logics/useReceiveRoutes.js index 54f49203..8961c2cf 100644 --- a/src-ui/logics/useReceiveRoutes.js +++ b/src-ui/logics/useReceiveRoutes.js @@ -91,49 +91,49 @@ export const ROUTE_META_LIST = [ // Config Page // Device - { endpoint: "/get/data/auto_mic_select", ns: configs, hook_name: "useEnableAutoMicSelect", method_name: "updateEnableAutoMicSelect" }, - { endpoint: "/set/enable/auto_mic_select", ns: configs, hook_name: "useEnableAutoMicSelect", method_name: "updateEnableAutoMicSelect" }, - { endpoint: "/set/disable/auto_mic_select", ns: configs, hook_name: "useEnableAutoMicSelect", method_name: "updateEnableAutoMicSelect" }, - { endpoint: "/get/data/auto_speaker_select", ns: configs, hook_name: "useEnableAutoSpeakerSelect", method_name: "updateEnableAutoSpeakerSelect" }, - { endpoint: "/set/enable/auto_speaker_select", ns: configs, hook_name: "useEnableAutoSpeakerSelect", method_name: "updateEnableAutoSpeakerSelect" }, - { endpoint: "/set/disable/auto_speaker_select", ns: configs, hook_name: "useEnableAutoSpeakerSelect", method_name: "updateEnableAutoSpeakerSelect" }, + { endpoint: "/get/data/auto_mic_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoMicSelect" }, + { endpoint: "/set/enable/auto_mic_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoMicSelect" }, + { endpoint: "/set/disable/auto_mic_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoMicSelect" }, + { endpoint: "/get/data/auto_speaker_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoSpeakerSelect" }, + { endpoint: "/set/enable/auto_speaker_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoSpeakerSelect" }, + { endpoint: "/set/disable/auto_speaker_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoSpeakerSelect" }, // Device (Mic) - { endpoint: "/get/data/mic_host_list", ns: configs, hook_name: "useMicHostList", method_name: "updateMicHostList_FromBackend" }, - { endpoint: "/run/mic_host_list", ns: configs, hook_name: "useMicHostList", method_name: "updateMicHostList_FromBackend" }, + { endpoint: "/get/data/mic_host_list", ns: configs, hook_name: "useDevice", method_name: "updateMicHostList_FromBackend" }, + { endpoint: "/run/mic_host_list", ns: configs, hook_name: "useDevice", method_name: "updateMicHostList_FromBackend" }, - { endpoint: "/get/data/selected_mic_host", ns: configs, hook_name: "useSelectedMicHost", method_name: "updateSelectedMicHost" }, - { endpoint: "/set/data/selected_mic_host", ns: configs, hook_name: "useSelectedMicHost", method_name: "updateSelectedMicHostAndDevice" }, // Need refactoring (Duplicated, Host, Device) + { endpoint: "/get/data/selected_mic_host", ns: configs, hook_name: "useDevice", method_name: "updateSelectedMicHost" }, + { endpoint: "/set/data/selected_mic_host", ns: configs, hook_name: "useDevice", method_name: "updateSelectedMicHostAndDevice" }, - { endpoint: "/get/data/mic_device_list", ns: configs, hook_name: "useMicDeviceList", method_name: "updateMicDeviceList_FromBackend" }, - { endpoint: "/run/mic_device_list", ns: configs, hook_name: "useMicDeviceList", method_name: "updateMicDeviceList_FromBackend" }, + { endpoint: "/get/data/mic_device_list", ns: configs, hook_name: "useDevice", method_name: "updateMicDeviceList_FromBackend" }, + { endpoint: "/run/mic_device_list", ns: configs, hook_name: "useDevice", method_name: "updateMicDeviceList_FromBackend" }, - { endpoint: "/get/data/selected_mic_device", ns: configs, hook_name: "useSelectedMicDevice", method_name: "updateSelectedMicDevice" }, - { endpoint: "/set/data/selected_mic_device", ns: configs, hook_name: "useSelectedMicDevice", method_name: "updateSelectedMicDevice" }, + { endpoint: "/get/data/selected_mic_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedMicDevice" }, + { endpoint: "/set/data/selected_mic_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedMicDevice" }, - { endpoint: "/run/selected_mic_device", ns: configs, hook_name: "useSelectedMicHost", method_name: "updateSelectedMicHostAndDevice" }, // Need refactoring (Duplicated, Host, Device) + { endpoint: "/run/selected_mic_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedMicHostAndDevice" }, // Device (Speaker) - { endpoint: "/get/data/speaker_device_list", ns: configs, hook_name: "useSpeakerDeviceList", method_name: "updateSpeakerDeviceList_FromBackend" }, - { endpoint: "/run/speaker_device_list", ns: configs, hook_name: "useSpeakerDeviceList", method_name: "updateSpeakerDeviceList_FromBackend" }, + { endpoint: "/get/data/speaker_device_list", ns: configs, hook_name: "useDevice", method_name: "updateSpeakerDeviceList_FromBackend" }, + { endpoint: "/run/speaker_device_list", ns: configs, hook_name: "useDevice", method_name: "updateSpeakerDeviceList_FromBackend" }, - { endpoint: "/get/data/selected_speaker_device", ns: configs, hook_name: "useSelectedSpeakerDevice", method_name: "updateSelectedSpeakerDevice" }, - { endpoint: "/set/data/selected_speaker_device", ns: configs, hook_name: "useSelectedSpeakerDevice", method_name: "updateSelectedSpeakerDevice" }, - { endpoint: "/run/selected_speaker_device", ns: configs, hook_name: "useSelectedSpeakerDevice", method_name: "updateSelectedSpeakerDevice" }, + { endpoint: "/get/data/selected_speaker_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedSpeakerDevice" }, + { endpoint: "/set/data/selected_speaker_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedSpeakerDevice" }, + { endpoint: "/run/selected_speaker_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedSpeakerDevice" }, // Device (Threshold) - { endpoint: "/get/data/mic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateMicThreshold" }, - { endpoint: "/set/data/mic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateMicThreshold" }, - { endpoint: "/get/data/speaker_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateSpeakerThreshold" }, - { endpoint: "/set/data/speaker_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateSpeakerThreshold" }, + { endpoint: "/get/data/mic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateMicThreshold" }, + { endpoint: "/set/data/mic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateMicThreshold" }, + { endpoint: "/get/data/speaker_threshold", ns: configs, hook_name: "useDevice", method_name: "updateSpeakerThreshold" }, + { endpoint: "/set/data/speaker_threshold", ns: configs, hook_name: "useDevice", method_name: "updateSpeakerThreshold" }, - { endpoint: "/get/data/mic_automatic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateEnableAutomaticMicThreshold" }, - { endpoint: "/set/enable/mic_automatic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateEnableAutomaticMicThreshold" }, - { endpoint: "/set/disable/mic_automatic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateEnableAutomaticMicThreshold" }, - { endpoint: "/get/data/speaker_automatic_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateEnableAutomaticSpeakerThreshold" }, - { endpoint: "/set/enable/speaker_automatic_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateEnableAutomaticSpeakerThreshold" }, - { endpoint: "/set/disable/speaker_automatic_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateEnableAutomaticSpeakerThreshold" }, + { endpoint: "/get/data/mic_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticMicThreshold" }, + { endpoint: "/set/enable/mic_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticMicThreshold" }, + { endpoint: "/set/disable/mic_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticMicThreshold" }, + { endpoint: "/get/data/speaker_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticSpeakerThreshold" }, + { endpoint: "/set/enable/speaker_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticSpeakerThreshold" }, + { endpoint: "/set/disable/speaker_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticSpeakerThreshold" }, // Appearance From acae7644ebbf4854a98514c2d7e668d10e337b48 Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Sun, 15 Jun 2025 15:54:41 +0900 Subject: [PATCH 24/41] =?UTF-8?q?[bugfix]=20ttf=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=81=AE=E3=83=90=E3=82=B9=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-python/model.py | 12 +++---- src-python/models/overlay/overlay_image.py | 40 ++++++++++++++-------- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/src-python/model.py b/src-python/model.py index b40936b5..6646ee1e 100644 --- a/src-python/model.py +++ b/src-python/model.py @@ -96,7 +96,7 @@ class Model: "large": overlay_large_log_settings, } self.overlay = Overlay(overlay_settings) - self.overlay_image = OverlayImage() + self.overlay_image = OverlayImage(config.PATH_LOCAL) self.mic_audio_queue = None self.mic_mute_status = None self.kks = kakasi() @@ -725,13 +725,13 @@ class Model: def createOverlayImageSmallMessage(self, message): ui_language = config.UI_LANGUAGE convert_languages = { - "en": "Japanese", + "en": "Default", "jp": "Japanese", "ko":"Korean", "zh-Hans":"Chinese Simplified", "zh-Hant":"Chinese Traditional", } - language = convert_languages.get(ui_language, "Japanese") + language = convert_languages.get(ui_language, "Default") return self.overlay_image.createOverlayImageSmallLog(message, language) def clearOverlayImageSmallLog(self): @@ -777,14 +777,14 @@ class Model: def createOverlayImageLargeMessage(self, message): ui_language = config.UI_LANGUAGE convert_languages = { - "en": "Japanese", + "en": "Default", "jp": "Japanese", "ko":"Korean", "zh-Hans":"Chinese Simplified", "zh-Hant":"Chinese Traditional", } - language = convert_languages.get(ui_language, "Japanese") - overlay_image = OverlayImage() + language = convert_languages.get(ui_language, "Default") + overlay_image = OverlayImage(config.PATH_LOCAL) for _ in range(2): overlay_image.createOverlayImageLargeLog("send", message, language) diff --git a/src-python/models/overlay/overlay_image.py b/src-python/models/overlay/overlay_image.py index 52fd242d..39de7f83 100644 --- a/src-python/models/overlay/overlay_image.py +++ b/src-python/models/overlay/overlay_image.py @@ -11,14 +11,20 @@ except ImportError: class OverlayImage: LANGUAGES = { - "Japanese": "NotoSansJP-Regular", - "Korean": "NotoSansKR-Regular", - "Chinese Simplified": "NotoSansSC-Regular", - "Chinese Traditional": "NotoSansTC-Regular", + "Default": "NotoSansJP-Regular.ttf", + "Japanese": "NotoSansJP-Regular.ttf", + "Korean": "NotoSansKR-Regular.ttf", + "Chinese Simplified": "NotoSansSC-Regular.ttf", + "Chinese Traditional": "NotoSansTC-Regular.ttf", } - def __init__(self): + def __init__(self, root_path: str=None): self.message_log = [] + if root_path is None: + self.root_path = os_path.join(os_path.dirname(__file__), "..", "..", "..", "fonts") + else: + self.root_path = os_path.join(root_path, "_internal", "fonts") + print(self.root_path) @staticmethod def concatenateImagesVertically(img1: Image, img2: Image, margin: int = 0) -> Image: @@ -54,16 +60,16 @@ class OverlayImage: return colors def createTextboxSmallLog(self, text:str, language:str, text_color:tuple, base_width:int, base_height:int, font_size:int) -> Image: - font_family = self.LANGUAGES.get(language, "NotoSansJP-Regular") + font_family = self.LANGUAGES.get(language, self.LANGUAGES["Default"]) img = Image.new("RGBA", (base_width, base_height), (0, 0, 0, 0)) draw = ImageDraw.Draw(img) try: - font_path = os_path.join(os_path.dirname(os_path.dirname(os_path.dirname(__file__))), "fonts", f"{font_family}.ttf") + font_path = os_path.join(self.root_path, font_family) font = ImageFont.truetype(font_path, font_size) except Exception: errorLogging() - font_path = os_path.join(os_path.dirname(__file__), "..", "..", "..", "fonts", f"{font_family}.ttf") + font_path = os_path.join(os_path.dirname(__file__), "..", "..", "..", "fonts", font_family) font = ImageFont.truetype(font_path, font_size) text_width = draw.textlength(text, font) @@ -98,7 +104,9 @@ class OverlayImage: draw = ImageDraw.Draw(background) draw.rounded_rectangle([(0, 0), img.size], radius=50, fill=background_color, outline=background_outline_color, width=5) - return Image.alpha_composite(background, img) + img = Image.alpha_composite(background, img) + img.save("overlay_small.png") + return img @staticmethod def getUiSizeLargeLog() -> dict: @@ -131,17 +139,17 @@ class OverlayImage: anchor = "lm" if message_type == "receive" else "rm" text_x = 0 if message_type == "receive" else ui_size["width"] align = "left" if message_type == "receive" else "right" - font_family = self.LANGUAGES.get(language, "NotoSansJP-Regular") + font_family = self.LANGUAGES.get(language, self.LANGUAGES["Default"]) img = Image.new("RGBA", (0, 0), (0, 0, 0, 0)) draw = ImageDraw.Draw(img) try: - font_path = os_path.join(os_path.dirname(os_path.dirname(os_path.dirname(__file__))), "fonts", f"{font_family}.ttf") + font_path = os_path.join(self.root_path, font_family) font = ImageFont.truetype(font_path, font_size) except Exception: errorLogging() - font_path = os_path.join(os_path.dirname(__file__), "..", "..", "..", "fonts", f"{font_family}.ttf") + font_path = os_path.join(os_path.dirname(__file__), "..", "..", "..", "fonts", font_family) font = ImageFont.truetype(font_path, font_size) text_width = draw.textlength(text, font) @@ -172,11 +180,11 @@ class OverlayImage: draw = ImageDraw.Draw(img) try: - font_path = os_path.join(os_path.dirname(os_path.dirname(os_path.dirname(__file__))), "fonts", "NotoSansJP-Regular.ttf") + font_path = os_path.join(self.root_path, self.LANGUAGES["Default"]) font = ImageFont.truetype(font_path, font_size) except Exception: errorLogging() - font_path = os_path.join(os_path.dirname(__file__), "..", "..", "..", "fonts", "NotoSansJP-Regular.ttf") + font_path = os_path.join(os_path.dirname(__file__), "..", "..", "..", "fonts", self.LANGUAGES["Default"]) font = ImageFont.truetype(font_path, font_size) text_height = font_size + ui_padding @@ -242,7 +250,9 @@ class OverlayImage: background = Image.new("RGBA", (width, height), (0, 0, 0, 0)) draw = ImageDraw.Draw(background) draw.rounded_rectangle([(0, 0), (width, height)], radius=ui_radius, fill=background_color, outline=background_outline_color, width=5) - return Image.alpha_composite(background, img) + img = Image.alpha_composite(background, img) + img.save("overlay_large.png") + return img if __name__ == "__main__": overlay = OverlayImage() From 3f38bfbba801f5c94cf4f97570082a1e456c0f7d Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 15 Jun 2025 17:49:42 +0900 Subject: [PATCH 25/41] [Update] Resend Message Button: To be store-able the status. Move to Appearance settings. --- locales/en.yml | 4 ++- locales/ja.yml | 4 ++- locales/ko.yml | 1 - locales/zh-Hans.yml | 1 - locales/zh-Hant.yml | 1 - src-python/config.py | 12 ++++++++ src-python/controller.py | 14 ++++++++++ src-python/mainloop.py | 4 +++ .../setting_box/appearance/Appearance.jsx | 17 +++++++++++ .../message_container/MessageContainer.jsx | 6 ++-- .../MessageLogSettingsContainer.jsx | 17 ----------- .../configs/appearance/useShowResendButton.js | 28 +++++++++++++++++++ src-ui/logics/configs/index.js | 1 + src-ui/logics/main/index.js | 1 - .../logics/main/useIsVisibleResendButton.js | 15 ---------- src-ui/logics/useReceiveRoutes.js | 4 +++ src-ui/store.js | 2 +- 17 files changed, 90 insertions(+), 42 deletions(-) create mode 100644 src-ui/logics/configs/appearance/useShowResendButton.js delete mode 100644 src-ui/logics/main/useIsVisibleResendButton.js diff --git a/locales/en.yml b/locales/en.yml index 5138f697..24bb73a8 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -50,7 +50,6 @@ main_page: received: "Received" system: "System" - show_resend_button: "Show Resend Button" resend_button_on_hover_desc: "Press And Hold To Send" state_text_enabled: "Enabled" @@ -120,6 +119,9 @@ config_page: hide: "Hide (Use Enter key to send)" show: "Show" show_and_disable_enter_key: "Show and disable sending using the Enter key." + show_resend_button: + label: "Show Resend Button" + desc: "When hovering over a sent message log, the resend button appears. Click to edit, long press to resend." font_family: label: "Font Family" ui_language: diff --git a/locales/ja.yml b/locales/ja.yml index a9a6901b..bd0ffe60 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -50,7 +50,6 @@ main_page: received: "受信" system: "システム" - show_resend_button: "再送信ボタンを表示する" resend_button_on_hover_desc: "長押しで送信" state_text_enabled: "有効" @@ -120,6 +119,9 @@ config_page: hide: "非表示 (エンターキーを使って送信)" show: "表示" show_and_disable_enter_key: "表示し、エンターキーでの送信を無効" + show_resend_button: + label: "再送信ボタンを表示する" + desc: "送信済メッセージログにマウスホバーすると、再送信ボタンが表示されます。クリックで編集モード、長押しで再送信します。" font_family: label: "使用フォント" ui_language: diff --git a/locales/ko.yml b/locales/ko.yml index 139f41a7..39df6d4a 100644 --- a/locales/ko.yml +++ b/locales/ko.yml @@ -47,7 +47,6 @@ main_page: received: "수신" system: "시스템" - show_resend_button: resend_button_on_hover_desc: state_text_enabled: "Enabled" diff --git a/locales/zh-Hans.yml b/locales/zh-Hans.yml index 0a13c7f8..dd1dafc7 100644 --- a/locales/zh-Hans.yml +++ b/locales/zh-Hans.yml @@ -47,7 +47,6 @@ main_page: received: "接受" system: "系统" - show_resend_button: resend_button_on_hover_desc: state_text_enabled: "启用" diff --git a/locales/zh-Hant.yml b/locales/zh-Hant.yml index 4fd2fce4..08210a7d 100644 --- a/locales/zh-Hant.yml +++ b/locales/zh-Hant.yml @@ -47,7 +47,6 @@ main_page: received: "已接收" system: "系統" - show_resend_button: resend_button_on_hover_desc: state_text_enabled: "啟用" diff --git a/src-python/config.py b/src-python/config.py index 64c09440..e7df74e5 100644 --- a/src-python/config.py +++ b/src-python/config.py @@ -407,6 +407,17 @@ class Config: self._MESSAGE_BOX_RATIO = value self.saveConfig(inspect.currentframe().f_code.co_name, value, immediate_save=True) + @property + @json_serializable('SHOW_RESEND_BUTTON') + def SHOW_RESEND_BUTTON(self): + return self._SHOW_RESEND_BUTTON + + @SHOW_RESEND_BUTTON.setter + def SHOW_RESEND_BUTTON(self, value): + if isinstance(value, bool): + self._SHOW_RESEND_BUTTON = value + self.saveConfig(inspect.currentframe().f_code.co_name, value) + @property @json_serializable('FONT_FAMILY') def FONT_FAMILY(self): @@ -1090,6 +1101,7 @@ class Config: self._UI_SCALING = 100 self._TEXTBOX_UI_SCALING = 100 self._MESSAGE_BOX_RATIO = 10 + self._SHOW_RESEND_BUTTON = False self._FONT_FAMILY = "Yu Gothic UI" self._UI_LANGUAGE = "en" self._MAIN_WINDOW_GEOMETRY = { diff --git a/src-python/controller.py b/src-python/controller.py index 969fff98..760166f1 100644 --- a/src-python/controller.py +++ b/src-python/controller.py @@ -832,6 +832,20 @@ class Controller: config.MESSAGE_BOX_RATIO = data return {"status":200, "result":config.MESSAGE_BOX_RATIO} + @staticmethod + def getShowResendButton(*args, **kwargs) -> dict: + return {"status":200, "result":config.SHOW_RESEND_BUTTON} + + @staticmethod + def setEnableShowResendButton(*args, **kwargs) -> dict: + config.SHOW_RESEND_BUTTON = True + return {"status":200, "result":config.SHOW_RESEND_BUTTON} + + @staticmethod + def setDisableShowResendButton(*args, **kwargs) -> dict: + config.SHOW_RESEND_BUTTON = False + return {"status":200, "result":config.SHOW_RESEND_BUTTON} + @staticmethod def getFontFamily(*args, **kwargs) -> dict: return {"status":200, "result":config.FONT_FAMILY} diff --git a/src-python/mainloop.py b/src-python/mainloop.py index 28207de5..fa1b0da9 100644 --- a/src-python/mainloop.py +++ b/src-python/mainloop.py @@ -131,6 +131,10 @@ mapping = { "/get/data/message_box_ratio": {"status": True, "variable":controller.getMessageBoxRatio}, "/set/data/message_box_ratio": {"status": True, "variable":controller.setMessageBoxRatio}, + "/get/data/show_resend_button": {"status": True, "variable":controller.getShowResendButton}, + "/set/enable/show_resend_button": {"status": True, "variable":controller.setEnableShowResendButton}, + "/set/disable/show_resend_button": {"status": True, "variable":controller.setDisableShowResendButton}, + "/get/data/font_family": {"status": True, "variable":controller.getFontFamily}, "/set/data/font_family": {"status": True, "variable":controller.setFontFamily}, diff --git a/src-ui/app/config_page/setting_section/setting_box/appearance/Appearance.jsx b/src-ui/app/config_page/setting_section/setting_box/appearance/Appearance.jsx index d9ecb7c6..29a300cb 100644 --- a/src-ui/app/config_page/setting_section/setting_box/appearance/Appearance.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/appearance/Appearance.jsx @@ -14,6 +14,7 @@ import { useUiScaling, useMessageLogUiScaling, useSendMessageButtonType, + useShowResendButton, useSelectedFontFamily, useTransparency, } from "@logics_configs"; @@ -22,6 +23,7 @@ import { SliderContainer, DropdownMenuContainer, RadioButtonContainer, + CheckboxContainer, } from "../_templates/Templates"; export const Appearance = () => { @@ -31,6 +33,7 @@ export const Appearance = () => { + @@ -160,6 +163,20 @@ const SendMessageButtonTypeContainer = () => { ); }; +const ShowResendButtonContainer = () => { + const { t } = useTranslation(); + const { currentShowResendButton, toggleShowResendButton } = useShowResendButton(); + + return ( + + ); +}; + const FontFamilyContainer = () => { const { t } = useTranslation(); const { currentSelectedFontFamily, setSelectedFontFamily } = useSelectedFontFamily(); diff --git a/src-ui/app/main_page/main_section/message_container/log_box/message_container/MessageContainer.jsx b/src-ui/app/main_page/main_section/message_container/log_box/message_container/MessageContainer.jsx index 1298c8da..1dbc7607 100644 --- a/src-ui/app/main_page/main_section/message_container/log_box/message_container/MessageContainer.jsx +++ b/src-ui/app/main_page/main_section/message_container/log_box/message_container/MessageContainer.jsx @@ -4,7 +4,7 @@ import clsx from "clsx"; import styles from "./MessageContainer.module.scss"; import { MessageSubMenuContainer } from "./message_sub_menu_container/MessageSubMenuContainer"; import { useMessage } from "@logics_common"; -import { useIsVisibleResendButton } from "@logics_main"; +import { useShowResendButton } from "@logics_configs"; export const MessageContainer = ({ messages, status, category, created_at }) => { const { t } = useTranslation(); @@ -12,7 +12,7 @@ export const MessageContainer = ({ messages, status, category, created_at }) => sendMessage, updateMessageInputValue, } = useMessage(); - const { currentIsVisibleResendButton } = useIsVisibleResendButton(); + const { currentShowResendButton } = useShowResendButton(); const [is_hovered, setIsHovered] = useState(false); const [is_locked, setIsLocked] = useState(false); @@ -77,7 +77,7 @@ export const MessageContainer = ({ messages, status, category, created_at }) => )} - {currentIsVisibleResendButton.data && is_sent_message && is_hovered ? ( + {currentShowResendButton.data && is_sent_message && is_hovered ? ( { @@ -13,18 +11,12 @@ export const MessageLogSettingsContainer = (props) => { const [is_opened, setIsOpened] = useState(false); const [is_hovered, setIsHovered] = useState(false); - const { currentIsVisibleResendButton, toggleIsVisibleResendButton } = useIsVisibleResendButton(); - const container_class_name = clsx(styles.container, { [styles.to_visible_toggle_bar]: props.to_visible_toggle_bar, [styles.is_hovered]: is_hovered, [styles.is_opened]: is_opened }); - const toggleVisibleResendButton = () => { - toggleIsVisibleResendButton(); - }; - return (
setIsHovered(true)} @@ -38,15 +30,6 @@ export const MessageLogSettingsContainer = (props) => {
-
-

{t("main_page.message_log.show_resend_button")}

- -
); diff --git a/src-ui/logics/configs/appearance/useShowResendButton.js b/src-ui/logics/configs/appearance/useShowResendButton.js new file mode 100644 index 00000000..10a9fd00 --- /dev/null +++ b/src-ui/logics/configs/appearance/useShowResendButton.js @@ -0,0 +1,28 @@ +import { useStore_ShowResendButton } from "@store"; +import { useStdoutToPython } from "@useStdoutToPython"; + +export const useShowResendButton = () => { + const { asyncStdoutToPython } = useStdoutToPython(); + const { currentShowResendButton, updateShowResendButton, pendingShowResendButton } = useStore_ShowResendButton(); + + const getShowResendButton = () => { + pendingShowResendButton(); + asyncStdoutToPython("/get/data/show_resend_button"); + }; + + const toggleShowResendButton = () => { + pendingShowResendButton(); + if (currentShowResendButton.data) { + asyncStdoutToPython("/set/disable/show_resend_button"); + } else { + asyncStdoutToPython("/set/enable/show_resend_button"); + } + }; + + return { + currentShowResendButton, + getShowResendButton, + updateShowResendButton, + toggleShowResendButton, + }; +}; \ No newline at end of file diff --git a/src-ui/logics/configs/index.js b/src-ui/logics/configs/index.js index aadb1519..f2552bd4 100644 --- a/src-ui/logics/configs/index.js +++ b/src-ui/logics/configs/index.js @@ -4,6 +4,7 @@ export { useMessageLogUiScaling } from "./appearance/useMessageLogUiScaling"; export { useSelectedFontFamily } from "./appearance/useSelectedFontFamily"; export { useTransparency } from "./appearance/useTransparency"; export { useSendMessageButtonType } from "./others/useSendMessageButtonType"; +export { useShowResendButton } from "./appearance/useShowResendButton"; export { useUiLanguage } from "./appearance/useUiLanguage"; export { useUiScaling } from "./appearance/useUiScaling"; diff --git a/src-ui/logics/main/index.js b/src-ui/logics/main/index.js index 14e817dc..827e8cef 100644 --- a/src-ui/logics/main/index.js +++ b/src-ui/logics/main/index.js @@ -1,4 +1,3 @@ -export { useIsVisibleResendButton } from "./useIsVisibleResendButton"; export { useIsMainPageCompactMode } from "./useIsMainPageCompactMode"; export { useLanguageSettings } from "./useLanguageSettings"; export { useMainFunction } from "./useMainFunction"; diff --git a/src-ui/logics/main/useIsVisibleResendButton.js b/src-ui/logics/main/useIsVisibleResendButton.js deleted file mode 100644 index c479af0b..00000000 --- a/src-ui/logics/main/useIsVisibleResendButton.js +++ /dev/null @@ -1,15 +0,0 @@ -import { useStore_IsVisibleResendButton } from "@store"; - -export const useIsVisibleResendButton = () => { - const { currentIsVisibleResendButton, updateIsVisibleResendButton } = useStore_IsVisibleResendButton(); - - const toggleIsVisibleResendButton = () => { - updateIsVisibleResendButton(!currentIsVisibleResendButton.data); - }; - - return { - currentIsVisibleResendButton, - toggleIsVisibleResendButton, - updateIsVisibleResendButton, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/useReceiveRoutes.js b/src-ui/logics/useReceiveRoutes.js index 8961c2cf..a4a1ad87 100644 --- a/src-ui/logics/useReceiveRoutes.js +++ b/src-ui/logics/useReceiveRoutes.js @@ -149,6 +149,10 @@ export const ROUTE_META_LIST = [ { endpoint: "/get/data/send_message_button_type", ns: configs, hook_name: "useSendMessageButtonType", method_name: "updateSendMessageButtonType" }, { endpoint: "/set/data/send_message_button_type", ns: configs, hook_name: "useSendMessageButtonType", method_name: "updateSendMessageButtonType" }, + { endpoint: "/get/data/show_resend_button", ns: configs, hook_name: "useShowResendButton", method_name: "updateShowResendButton" }, + { endpoint: "/set/enable/show_resend_button", ns: configs, hook_name: "useShowResendButton", method_name: "updateShowResendButton" }, + { endpoint: "/set/disable/show_resend_button", ns: configs, hook_name: "useShowResendButton", method_name: "updateShowResendButton" }, + { endpoint: "/get/data/font_family", ns: configs, hook_name: "useSelectedFontFamily", method_name: "updateSelectedFontFamily" }, { endpoint: "/set/data/font_family", ns: configs, hook_name: "useSelectedFontFamily", method_name: "updateSelectedFontFamily" }, diff --git a/src-ui/store.js b/src-ui/store.js index 159385ae..23b865a4 100644 --- a/src-ui/store.js +++ b/src-ui/store.js @@ -172,7 +172,6 @@ export const { atomInstance: Atom_MessageLogs, useHook: useStore_MessageLogs } = // export const { atomInstance: Atom_MessageLogs, useHook: useStore_MessageLogs } = createAtomWithHook(generateTestConversationData(20), "MessageLogs"); // For testing export const { atomInstance: Atom_MessageInputBoxRatio, useHook: useStore_MessageInputBoxRatio } = createAtomWithHook(20, "MessageInputBoxRatio"); export const { atomInstance: Atom_MessageInputValue, useHook: useStore_MessageInputValue } = createAtomWithHook("", "MessageInputValue"); -export const { atomInstance: Atom_IsVisibleResendButton, useHook: useStore_IsVisibleResendButton } = createAtomWithHook(false, "IsVisibleResendButton", {is_state_ok: true}); @@ -213,6 +212,7 @@ export const { atomInstance: Atom_UiLanguage, useHook: useStore_UiLanguage } = c export const { atomInstance: Atom_UiScaling, useHook: useStore_UiScaling } = createAtomWithHook(100, "UiScaling"); export const { atomInstance: Atom_MessageLogUiScaling, useHook: useStore_MessageLogUiScaling } = createAtomWithHook(100, "MessageLogUiScaling"); export const { atomInstance: Atom_SendMessageButtonType, useHook: useStore_SendMessageButtonType } = createAtomWithHook("show", "SendMessageButtonType"); +export const { atomInstance: Atom_ShowResendButton, useHook: useStore_ShowResendButton } = createAtomWithHook(false, "ShowResendButton"); export const { atomInstance: Atom_SelectedFontFamily, useHook: useStore_SelectedFontFamily } = createAtomWithHook("Yu Gothic UI", "SelectedFontFamily"); export const { atomInstance: Atom_SelectableFontFamilyList, useHook: useStore_SelectableFontFamilyList } = createAtomWithHook({}, "SelectableFontFamilyList"); export const { atomInstance: Atom_Transparency, useHook: useStore_Transparency } = createAtomWithHook(100, "Transparency"); From d96c9a5151663161576944e2c7b028b623219b3a Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 15 Jun 2025 17:53:41 +0900 Subject: [PATCH 26/41] [Chore] Fix typo in test code. '/set/data/mic_word_filter' --- src-python/mainloop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-python/mainloop.py b/src-python/mainloop.py index fa1b0da9..126330e1 100644 --- a/src-python/mainloop.py +++ b/src-python/mainloop.py @@ -559,7 +559,7 @@ if __name__ == "__main__": data = 5 case "/set/data/mic_max_phrases": data = 5 - case "/set//data/mic_word_filter": + case "/set/data/mic_word_filter": data = "test0, test1, test2" case "/set/data/selected_speaker_device": data = "スピーカー (Realtek High Definition Audio)" From cbfce55c169943795bb808b2098d37c92eed419a Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 15 Jun 2025 18:11:07 +0900 Subject: [PATCH 27/41] [Refactor] Move the code that is related with Send Message Button Type. (It was remained at Others section but it should've move to Appearance section so.) --- src-python/config.py | 26 +++++++++---------- src-python/controller.py | 18 ++++++------- src-python/mainloop.py | 10 +++---- .../appearance/useSendMessageButtonType.js | 4 +-- src-ui/logics/configs/index.js | 2 +- .../others/useSendMessageButtonType.js | 24 ----------------- 6 files changed, 30 insertions(+), 54 deletions(-) delete mode 100644 src-ui/logics/configs/others/useSendMessageButtonType.js diff --git a/src-python/config.py b/src-python/config.py index e7df74e5..f177ca9f 100644 --- a/src-python/config.py +++ b/src-python/config.py @@ -407,6 +407,18 @@ class Config: self._MESSAGE_BOX_RATIO = value self.saveConfig(inspect.currentframe().f_code.co_name, value, immediate_save=True) + @property + @json_serializable('SEND_MESSAGE_BUTTON_TYPE') + def SEND_MESSAGE_BUTTON_TYPE(self): + return self._SEND_MESSAGE_BUTTON_TYPE + + @SEND_MESSAGE_BUTTON_TYPE.setter + def SEND_MESSAGE_BUTTON_TYPE(self, value): + if isinstance(value, str): + if value in self.SEND_MESSAGE_BUTTON_TYPE_LIST: + self._SEND_MESSAGE_BUTTON_TYPE = value + self.saveConfig(inspect.currentframe().f_code.co_name, value) + @property @json_serializable('SHOW_RESEND_BUTTON') def SHOW_RESEND_BUTTON(self): @@ -815,18 +827,6 @@ class Config: self._SEND_ONLY_TRANSLATED_MESSAGES = value self.saveConfig(inspect.currentframe().f_code.co_name, value) - @property - @json_serializable('SEND_MESSAGE_BUTTON_TYPE') - def SEND_MESSAGE_BUTTON_TYPE(self): - return self._SEND_MESSAGE_BUTTON_TYPE - - @SEND_MESSAGE_BUTTON_TYPE.setter - def SEND_MESSAGE_BUTTON_TYPE(self, value): - if isinstance(value, str): - if value in self.SEND_MESSAGE_BUTTON_TYPE_LIST: - self._SEND_MESSAGE_BUTTON_TYPE = value - self.saveConfig(inspect.currentframe().f_code.co_name, value) - @property @json_serializable('OVERLAY_SMALL_LOG') def OVERLAY_SMALL_LOG(self): @@ -1101,6 +1101,7 @@ class Config: self._UI_SCALING = 100 self._TEXTBOX_UI_SCALING = 100 self._MESSAGE_BOX_RATIO = 10 + self._SEND_MESSAGE_BUTTON_TYPE = "show" self._SHOW_RESEND_BUTTON = False self._FONT_FAMILY = "Yu Gothic UI" self._UI_LANGUAGE = "en" @@ -1149,7 +1150,6 @@ class Config: self._WHISPER_WEIGHT_TYPE = "base" self._AUTO_CLEAR_MESSAGE_BOX = True self._SEND_ONLY_TRANSLATED_MESSAGES = False - self._SEND_MESSAGE_BUTTON_TYPE = "show" self._OVERLAY_SMALL_LOG = False self._OVERLAY_SMALL_LOG_SETTINGS = { "x_pos": 0.0, diff --git a/src-python/controller.py b/src-python/controller.py index 760166f1..a90d8b40 100644 --- a/src-python/controller.py +++ b/src-python/controller.py @@ -832,6 +832,15 @@ class Controller: config.MESSAGE_BOX_RATIO = data return {"status":200, "result":config.MESSAGE_BOX_RATIO} + @staticmethod + def getSendMessageButtonType(*args, **kwargs) -> dict: + return {"status":200, "result":config.SEND_MESSAGE_BUTTON_TYPE} + + @staticmethod + def setSendMessageButtonType(data, *args, **kwargs) -> dict: + config.SEND_MESSAGE_BUTTON_TYPE = data + return {"status":200, "result":config.SEND_MESSAGE_BUTTON_TYPE} + @staticmethod def getShowResendButton(*args, **kwargs) -> dict: return {"status":200, "result":config.SHOW_RESEND_BUTTON} @@ -1420,15 +1429,6 @@ class Controller: config.SEND_ONLY_TRANSLATED_MESSAGES = False return {"status":200, "result":config.SEND_ONLY_TRANSLATED_MESSAGES} - @staticmethod - def getSendMessageButtonType(*args, **kwargs) -> dict: - return {"status":200, "result":config.SEND_MESSAGE_BUTTON_TYPE} - - @staticmethod - def setSendMessageButtonType(data, *args, **kwargs) -> dict: - config.SEND_MESSAGE_BUTTON_TYPE = data - return {"status":200, "result":config.SEND_MESSAGE_BUTTON_TYPE} - @staticmethod def getOverlaySmallLog(*args, **kwargs) -> dict: return {"status":200, "result":config.OVERLAY_SMALL_LOG} diff --git a/src-python/mainloop.py b/src-python/mainloop.py index 126330e1..61040535 100644 --- a/src-python/mainloop.py +++ b/src-python/mainloop.py @@ -131,6 +131,9 @@ mapping = { "/get/data/message_box_ratio": {"status": True, "variable":controller.getMessageBoxRatio}, "/set/data/message_box_ratio": {"status": True, "variable":controller.setMessageBoxRatio}, + "/get/data/send_message_button_type": {"status": True, "variable":controller.getSendMessageButtonType}, + "/set/data/send_message_button_type": {"status": True, "variable":controller.setSendMessageButtonType}, + "/get/data/show_resend_button": {"status": True, "variable":controller.getShowResendButton}, "/set/enable/show_resend_button": {"status": True, "variable":controller.setEnableShowResendButton}, "/set/disable/show_resend_button": {"status": True, "variable":controller.setDisableShowResendButton}, @@ -290,9 +293,6 @@ mapping = { "/set/enable/send_only_translated_messages": {"status": True, "variable":controller.setEnableSendOnlyTranslatedMessages}, "/set/disable/send_only_translated_messages": {"status": True, "variable":controller.setDisableSendOnlyTranslatedMessages}, - "/get/data/send_message_button_type": {"status": True, "variable":controller.getSendMessageButtonType}, - "/set/data/send_message_button_type": {"status": True, "variable":controller.setSendMessageButtonType}, - "/get/data/logger_feature": {"status": True, "variable":controller.getLoggerFeature}, "/set/enable/logger_feature": {"status": True, "variable":controller.setEnableLoggerFeature}, "/set/disable/logger_feature": {"status": True, "variable":controller.setDisableLoggerFeature}, @@ -539,6 +539,8 @@ if __name__ == "__main__": data = 1.5 case "/set/data/message_box_ratio": data = 0.5 + case "/set/data/send_message_button_type": + data = "show" case "/set/data/font_family": data = "Yu Gothic UI" case "/set/data/ui_language": @@ -589,8 +591,6 @@ if __name__ == "__main__": "display_duration": 5, "fadeout_duration": 0.5, } - case "/set/data/send_message_button_type": - data = "show" case "/set/data/send_message_format": data = "[message]" case "/set/data/send_message_format_with_t": diff --git a/src-ui/logics/configs/appearance/useSendMessageButtonType.js b/src-ui/logics/configs/appearance/useSendMessageButtonType.js index e92c9b21..621c7dbc 100644 --- a/src-ui/logics/configs/appearance/useSendMessageButtonType.js +++ b/src-ui/logics/configs/appearance/useSendMessageButtonType.js @@ -10,9 +10,9 @@ export const useSendMessageButtonType = () => { asyncStdoutToPython("/get/data/send_message_button_type"); }; - const setSendMessageButtonType = (selected_type) => { + const setSendMessageButtonType = (send_message_button_type) => { pendingSendMessageButtonType(); - asyncStdoutToPython("/set/data/send_message_button_type", selected_type); + asyncStdoutToPython("/set/data/send_message_button_type", send_message_button_type); }; return { diff --git a/src-ui/logics/configs/index.js b/src-ui/logics/configs/index.js index f2552bd4..9ffc7145 100644 --- a/src-ui/logics/configs/index.js +++ b/src-ui/logics/configs/index.js @@ -3,7 +3,7 @@ export { useDevice } from "./device/useDevice"; export { useMessageLogUiScaling } from "./appearance/useMessageLogUiScaling"; export { useSelectedFontFamily } from "./appearance/useSelectedFontFamily"; export { useTransparency } from "./appearance/useTransparency"; -export { useSendMessageButtonType } from "./others/useSendMessageButtonType"; +export { useSendMessageButtonType } from "./appearance/useSendMessageButtonType"; export { useShowResendButton } from "./appearance/useShowResendButton"; export { useUiLanguage } from "./appearance/useUiLanguage"; export { useUiScaling } from "./appearance/useUiScaling"; diff --git a/src-ui/logics/configs/others/useSendMessageButtonType.js b/src-ui/logics/configs/others/useSendMessageButtonType.js deleted file mode 100644 index 621c7dbc..00000000 --- a/src-ui/logics/configs/others/useSendMessageButtonType.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_SendMessageButtonType } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useSendMessageButtonType = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSendMessageButtonType, updateSendMessageButtonType, pendingSendMessageButtonType } = useStore_SendMessageButtonType(); - - const getSendMessageButtonType = () => { - pendingSendMessageButtonType(); - asyncStdoutToPython("/get/data/send_message_button_type"); - }; - - const setSendMessageButtonType = (send_message_button_type) => { - pendingSendMessageButtonType(); - asyncStdoutToPython("/set/data/send_message_button_type", send_message_button_type); - }; - - return { - currentSendMessageButtonType, - getSendMessageButtonType, - setSendMessageButtonType, - updateSendMessageButtonType, - }; -}; \ No newline at end of file From ab5c6b7bb55a16e047080a40fd76ef06976e5da8 Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Mon, 16 Jun 2025 06:45:13 +0900 Subject: [PATCH 28/41] [Refactor] Improve overlay image creation logic for large logs and translations --- src-python/controller.py | 65 ++++++++++++++++++---- src-python/model.py | 7 +-- src-python/models/overlay/overlay_image.py | 40 +++++++++---- 3 files changed, 86 insertions(+), 26 deletions(-) diff --git a/src-python/controller.py b/src-python/controller.py index 969fff98..6fc96071 100644 --- a/src-python/controller.py +++ b/src-python/controller.py @@ -340,11 +340,25 @@ class Controller: model.logger.info(f"[SENT] {message}{translation}") if config.OVERLAY_LARGE_LOG is True and model.overlay.initialized is True: - if config.OVERLAY_SHOW_ONLY_TRANSLATED_MESSAGES is True and len(translation) > 0: - overlay_image = model.createOverlayImageLargeLog("send", translation[0], "") + if config.OVERLAY_SHOW_ONLY_TRANSLATED_MESSAGES is True: + if len(translation) > 0: + overlay_image = model.createOverlayImageLargeLog( + "send", + None, + None, + translation, + config.SELECTED_TARGET_LANGUAGES[config.SELECTED_TAB_NO] + ) + model.updateOverlayLargeLog(overlay_image) else: - overlay_image = model.createOverlayImageLargeLog("send", message, translation[0] if len(translation) > 0 else "") - model.updateOverlayLargeLog(overlay_image) + overlay_image = model.createOverlayImageLargeLog( + "send", + message, + config.SELECTED_YOUR_LANGUAGES[config.SELECTED_TAB_NO]["1"]["language"], + translation, + config.SELECTED_TARGET_LANGUAGES[config.SELECTED_TAB_NO] + ) + model.updateOverlayLargeLog(overlay_image) def speakerMessage(self, result:dict) -> None: message = result["text"] @@ -425,11 +439,24 @@ class Controller: model.updateOverlaySmallLog(overlay_image) if config.OVERLAY_LARGE_LOG is True and model.overlay.initialized is True: - if config.OVERLAY_SHOW_ONLY_TRANSLATED_MESSAGES is True and len(translation) > 0: - overlay_image = model.createOverlayImageLargeLog("receive", translation[0], "") + if config.OVERLAY_SHOW_ONLY_TRANSLATED_MESSAGES is True: + if len(translation) > 0: + overlay_image = model.createOverlayImageLargeLog( + "receive", + None, + None, + translation, + ) + model.updateOverlayLargeLog(overlay_image) else: - overlay_image = model.createOverlayImageLargeLog("receive", message, translation[0] if len(translation) > 0 else "") - model.updateOverlayLargeLog(overlay_image) + overlay_image = model.createOverlayImageLargeLog( + "receive", + message, + language, + translation, + config.SELECTED_YOUR_LANGUAGES[config.SELECTED_TAB_NO] + ) + model.updateOverlayLargeLog(overlay_image) if config.SEND_RECEIVED_MESSAGE_TO_VRC is True: osc_message = self.messageFormatter("RECEIVED", translation, [message]) @@ -544,11 +571,25 @@ class Controller: model.oscSendMessage(osc_message) if config.OVERLAY_LARGE_LOG is True: - if config.OVERLAY_SHOW_ONLY_TRANSLATED_MESSAGES is True and len(translation) > 0: - overlay_image = model.createOverlayImageLargeLog("send", translation[0], "") + if config.OVERLAY_SHOW_ONLY_TRANSLATED_MESSAGES is True: + if len(translation) > 0: + overlay_image = model.createOverlayImageLargeLog( + "send", + None, + None, + translation, + config.SELECTED_TARGET_LANGUAGES[config.SELECTED_TAB_NO], + ) + model.updateOverlayLargeLog(overlay_image) else: - overlay_image = model.createOverlayImageLargeLog("send", message, translation[0] if len(translation) > 0 else "") - model.updateOverlayLargeLog(overlay_image) + overlay_image = model.createOverlayImageLargeLog( + "send", + message, + config.SELECTED_YOUR_LANGUAGES[config.SELECTED_TAB_NO]["1"]["language"], + translation, + config.SELECTED_TARGET_LANGUAGES[config.SELECTED_TAB_NO], + ) + model.updateOverlayLargeLog(overlay_image) if model.checkWebSocketServerAlive() is True: model.websocketSendMessage( diff --git a/src-python/model.py b/src-python/model.py index 6646ee1e..8b0ba6c1 100644 --- a/src-python/model.py +++ b/src-python/model.py @@ -769,10 +769,9 @@ class Model: if (self.overlay.settings[size]["ui_scaling"] != config.OVERLAY_SMALL_LOG_SETTINGS["ui_scaling"]): self.overlay.updateUiScaling(config.OVERLAY_SMALL_LOG_SETTINGS["ui_scaling"], size) - def createOverlayImageLargeLog(self, message_type:str, message:str, translation:str): - your_language = config.SELECTED_TARGET_LANGUAGES[config.SELECTED_TAB_NO]["1"]["language"] - target_language = config.SELECTED_YOUR_LANGUAGES[config.SELECTED_TAB_NO]["1"]["language"] - return self.overlay_image.createOverlayImageLargeLog(message_type, message, your_language, translation, target_language) + def createOverlayImageLargeLog(self, message_type:str, message:str, your_language:str, translation:list, target_languages:dict): + target_languages = [data["language"] for data in target_languages.values() if data["enable"] is True] + return self.overlay_image.createOverlayImageLargeLog(message_type, message, your_language, translation, target_languages) def createOverlayImageLargeMessage(self, message): ui_language = config.UI_LANGUAGE diff --git a/src-python/models/overlay/overlay_image.py b/src-python/models/overlay/overlay_image.py index 39de7f83..ec943475 100644 --- a/src-python/models/overlay/overlay_image.py +++ b/src-python/models/overlay/overlay_image.py @@ -199,17 +199,37 @@ class OverlayImage: draw.text((text_x, text_y), text, text_color, anchor=anchor, stroke_width=0, font=font) return img - def createTextboxLargeLog(self, message_type:str, message:str, your_language:str, translation:str, target_language:str, date_time:str) -> Image: - message_type_img = self.createTextImageMessageType(message_type, date_time) - if translation and target_language: - img = self.createTextImageLargeLog(message_type, "small", message, your_language) - translation_img = self.createTextImageLargeLog(message_type, "large", translation, target_language) - img = self.concatenateImagesVertically(img, translation_img) - else: - img = self.createTextImageLargeLog(message_type, "large", message, your_language) - return self.concatenateImagesVertically(message_type_img, img) + def createTextboxLargeLog(self, message_type: str, message: str = None, your_language: str = None, translation: list = [], target_language: list = [], date_time: str = None) -> Image: + # テキスト画像のリストを作成 + images = [self.createTextImageMessageType(message_type, date_time)] - def createOverlayImageLargeLog(self, message_type:str, message:str, your_language:str, translation:str="", target_language:str=None) -> Image: + # 翻訳がある場合 + if translation and target_language: + # 元のメッセージがある場合は小さいサイズで追加 + if message is not None: + images.append( + self.createTextImageLargeLog(message_type, "small", message, your_language) + ) + + # 翻訳をすべて大きいサイズで追加 + for trans, lang in zip(translation, target_language): + images.append( + self.createTextImageLargeLog(message_type, "large", trans, lang) + ) + else: + # 翻訳がない場合は元のメッセージのみ + images.append( + self.createTextImageLargeLog(message_type, "large", message, your_language) + ) + + # すべてのテキスト画像を縦に結合 + combined_img = images[0] + for img in images[1:]: + combined_img = self.concatenateImagesVertically(combined_img, img) + + return combined_img + + def createOverlayImageLargeLog(self, message_type:str, message:str=None, your_language:str=None, translation:list=[], target_language:list=[]) -> Image: ui_color = self.getUiColorLargeLog() background_color = ui_color["background_color"] background_outline_color = ui_color["background_outline_color"] From e25cd62891ff19e342e5804df85af472d592bb1f Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Mon, 16 Jun 2025 11:29:54 +0900 Subject: [PATCH 29/41] [Refactor] Improve overlay image creation logic for small logs and translations --- src-python/controller.py | 20 +++++++++--- src-python/model.py | 11 +++---- src-python/models/overlay/overlay_image.py | 37 ++++++++++++++++++---- 3 files changed, 51 insertions(+), 17 deletions(-) diff --git a/src-python/controller.py b/src-python/controller.py index 6fc96071..fcae50b6 100644 --- a/src-python/controller.py +++ b/src-python/controller.py @@ -432,11 +432,23 @@ class Controller: if config.ENABLE_TRANSCRIPTION_RECEIVE is True: if config.OVERLAY_SMALL_LOG is True and model.overlay.initialized is True: - if config.OVERLAY_SHOW_ONLY_TRANSLATED_MESSAGES is True and len(translation) > 0: - overlay_image = model.createOverlayImageSmallLog(translation[0], "") + if config.OVERLAY_SHOW_ONLY_TRANSLATED_MESSAGES is True: + if len(translation) > 0: + overlay_image = model.createOverlayImageSmallLog( + None, + None, + translation, + config.SELECTED_YOUR_LANGUAGES[config.SELECTED_TAB_NO], + ) + model.updateOverlaySmallLog(overlay_image) else: - overlay_image = model.createOverlayImageSmallLog(message, translation[0] if len(translation) > 0 else "") - model.updateOverlaySmallLog(overlay_image) + overlay_image = model.createOverlayImageSmallLog( + message, + language, + translation, + config.SELECTED_YOUR_LANGUAGES[config.SELECTED_TAB_NO], + ) + model.updateOverlaySmallLog(overlay_image) if config.OVERLAY_LARGE_LOG is True and model.overlay.initialized is True: if config.OVERLAY_SHOW_ONLY_TRANSLATED_MESSAGES is True: diff --git a/src-python/model.py b/src-python/model.py index 8b0ba6c1..9f905ec3 100644 --- a/src-python/model.py +++ b/src-python/model.py @@ -717,9 +717,8 @@ class Model: self.speaker_energy_recorder.stop() self.speaker_energy_recorder = None - def createOverlayImageSmallLog(self, message, translation): - your_language = config.SELECTED_TARGET_LANGUAGES[config.SELECTED_TAB_NO]["1"]["language"] - target_language = config.SELECTED_YOUR_LANGUAGES[config.SELECTED_TAB_NO]["1"]["language"] + def createOverlayImageSmallLog(self, message:str, your_language:str, translation:list, target_language:dict): + target_language = [data["language"] for data in target_language.values() if data["enable"] is True] return self.overlay_image.createOverlayImageSmallLog(message, your_language, translation, target_language) def createOverlayImageSmallMessage(self, message): @@ -769,9 +768,9 @@ class Model: if (self.overlay.settings[size]["ui_scaling"] != config.OVERLAY_SMALL_LOG_SETTINGS["ui_scaling"]): self.overlay.updateUiScaling(config.OVERLAY_SMALL_LOG_SETTINGS["ui_scaling"], size) - def createOverlayImageLargeLog(self, message_type:str, message:str, your_language:str, translation:list, target_languages:dict): - target_languages = [data["language"] for data in target_languages.values() if data["enable"] is True] - return self.overlay_image.createOverlayImageLargeLog(message_type, message, your_language, translation, target_languages) + def createOverlayImageLargeLog(self, message_type:str, message:str, your_language:str, translation:list, target_language:dict): + target_language = [data["language"] for data in target_language.values() if data["enable"] is True] + return self.overlay_image.createOverlayImageLargeLog(message_type, message, your_language, translation, target_language) def createOverlayImageLargeMessage(self, message): ui_language = config.UI_LANGUAGE diff --git a/src-python/models/overlay/overlay_image.py b/src-python/models/overlay/overlay_image.py index ec943475..11d8cf06 100644 --- a/src-python/models/overlay/overlay_image.py +++ b/src-python/models/overlay/overlay_image.py @@ -86,7 +86,8 @@ class OverlayImage: draw.text((text_x, text_y), text, text_color, anchor="mm", stroke_width=0, font=font, align="center") return img - def createOverlayImageSmallLog(self, message:str, your_language:str, translation:str="", target_language:str=None) -> Image: + def createOverlayImageSmallLog(self, message: str, your_language: str, translation: list = [], target_language: list = []) -> Image: + # UI設定を取得 ui_size = self.getUiSizeSmallLog() width, height, font_size = ui_size["width"], ui_size["height"], ui_size["font_size"] @@ -95,17 +96,40 @@ class OverlayImage: background_color = ui_colors["background_color"] background_outline_color = ui_colors["background_outline_color"] - img = self.createTextboxSmallLog(message, your_language, text_color, width, height, font_size) - if translation and target_language: - translation_img = self.createTextboxSmallLog(translation, target_language, text_color, width, height, font_size) - img = self.concatenateImagesVertically(img, translation_img) + # テキストボックス画像のリストを作成 + textbox_images = [] + # 翻訳がある場合 + if translation and target_language: + # 元のメッセージがある場合は追加 + if message: + textbox_images.append( + self.createTextboxSmallLog(message, your_language, text_color, width, height, font_size) + ) + + # 翻訳をすべて追加 + for trans, lang in zip(translation, target_language): + textbox_images.append( + self.createTextboxSmallLog(trans, lang, text_color, width, height, font_size) + ) + else: + # 翻訳がない場合は元のメッセージのみ + textbox_images.append( + self.createTextboxSmallLog(message, your_language, text_color, width, height, font_size) + ) + + # すべてのテキストボックスを縦に結合 + img = textbox_images[0] + for textbox_img in textbox_images[1:]: + img = self.concatenateImagesVertically(img, textbox_img) + + # 角丸背景を作成 background = Image.new("RGBA", img.size, (0, 0, 0, 0)) draw = ImageDraw.Draw(background) draw.rounded_rectangle([(0, 0), img.size], radius=50, fill=background_color, outline=background_outline_color, width=5) + # 背景とテキストを合成 img = Image.alpha_composite(background, img) - img.save("overlay_small.png") return img @staticmethod @@ -271,7 +295,6 @@ class OverlayImage: draw = ImageDraw.Draw(background) draw.rounded_rectangle([(0, 0), (width, height)], radius=ui_radius, fill=background_color, outline=background_outline_color, width=5) img = Image.alpha_composite(background, img) - img.save("overlay_large.png") return img if __name__ == "__main__": From c12f51f80284582670628c8b6996eabf545e89f7 Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Mon, 16 Jun 2025 18:59:37 +0900 Subject: [PATCH 30/41] [bugfix] remove print root path --- src-python/models/overlay/overlay_image.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src-python/models/overlay/overlay_image.py b/src-python/models/overlay/overlay_image.py index 11d8cf06..2be5b0af 100644 --- a/src-python/models/overlay/overlay_image.py +++ b/src-python/models/overlay/overlay_image.py @@ -24,7 +24,6 @@ class OverlayImage: self.root_path = os_path.join(os_path.dirname(__file__), "..", "..", "..", "fonts") else: self.root_path = os_path.join(root_path, "_internal", "fonts") - print(self.root_path) @staticmethod def concatenateImagesVertically(img1: Image, img2: Image, margin: int = 0) -> Image: From c1157d30cf751f22a40d9e5f221579fb4084b48f Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Tue, 17 Jun 2025 15:05:24 +0900 Subject: [PATCH 31/41] [Refactor] Move WebSocket message sending and logging to the correct position in the flow --- src-python/controller.py | 42 ++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/src-python/controller.py b/src-python/controller.py index fb84126e..f0c3d55b 100644 --- a/src-python/controller.py +++ b/src-python/controller.py @@ -322,23 +322,6 @@ class Controller: "transliteration":transliteration }) - if model.checkWebSocketServerAlive() is True: - model.websocketSendMessage( - { - "type":"SENT", - "src_languages":config.SELECTED_YOUR_LANGUAGES[config.SELECTED_TAB_NO], - "dst_languages":config.SELECTED_TARGET_LANGUAGES[config.SELECTED_TAB_NO], - "message":message, - "translation":translation, - "transliteration":transliteration - } - ) - - if config.LOGGER_FEATURE is True: - if len(translation) > 0: - translation = " (" + "/".join(translation) + ")" - model.logger.info(f"[SENT] {message}{translation}") - if config.OVERLAY_LARGE_LOG is True and model.overlay.initialized is True: if config.OVERLAY_SHOW_ONLY_TRANSLATED_MESSAGES is True: if len(translation) > 0: @@ -360,6 +343,22 @@ class Controller: ) model.updateOverlayLargeLog(overlay_image) + if model.checkWebSocketServerAlive() is True: + model.websocketSendMessage( + { + "type":"SENT", + "src_languages":config.SELECTED_YOUR_LANGUAGES[config.SELECTED_TAB_NO], + "dst_languages":config.SELECTED_TARGET_LANGUAGES[config.SELECTED_TAB_NO], + "message":message, + "translation":translation, + "transliteration":transliteration + } + ) + + if config.LOGGER_FEATURE is True: + translation_text = f" ({'/'.join(translation)})" if translation else "" + model.logger.info(f"[SENT] {message}{translation_text}") + def speakerMessage(self, result:dict) -> None: message = result["text"] language = result["language"] @@ -497,9 +496,8 @@ class Controller: ) if config.LOGGER_FEATURE is True: - if len(translation) > 0: - translation = " (" + "/".join(translation) + ")" - model.logger.info(f"[RECEIVED] {message}{translation}") + translation_text = f" ({'/'.join(translation)})" if translation else "" + model.logger.info(f"[RECEIVED] {message}{translation_text}") def chatMessage(self, data) -> None: id = data["id"] @@ -615,10 +613,8 @@ class Controller: } ) - # update textbox message log (Chat) if config.LOGGER_FEATURE is True: - if len(translation) > 0: - translation_text = " (" + "/".join(translation) + ")" + translation_text = f" ({'/'.join(translation)})" if translation else "" model.logger.info(f"[CHAT] {message}{translation_text}") return {"status":200, From 5813ede67b917f56bcd6abd4f99b06dd6dd88f92 Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Tue, 17 Jun 2025 15:06:30 +0900 Subject: [PATCH 32/41] [Refactor] Simplify conditional checks for transcript retrieval in Model class --- src-python/model.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src-python/model.py b/src-python/model.py index 9f905ec3..333f1394 100644 --- a/src-python/model.py +++ b/src-python/model.py @@ -452,9 +452,9 @@ class Model: config.MIC_AVG_LOGPROB, config.MIC_NO_SPEECH_PROB ) - if res: - result = self.mic_transcriber.getTranscript() - fnc(result) + if res: + result = self.mic_transcriber.getTranscript() + fnc(result) except Exception: errorLogging() @@ -635,9 +635,9 @@ class Model: config.SPEAKER_AVG_LOGPROB, config.SPEAKER_NO_SPEECH_PROB ) - if res: - result = self.speaker_transcriber.getTranscript() - fnc(result) + if res: + result = self.speaker_transcriber.getTranscript() + fnc(result) except Exception: errorLogging() From 172617a52393bed1471a27f81a62b89f4cf921e6 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 18 Jun 2025 14:47:17 +0000 Subject: [PATCH 33/41] Fix: Enhance logging for OSError and prevent AttributeError This commit addresses two potential issues related to issue #50: 1. Enhanced `OSError` Logging in `utils.py`: The `printResponse` function in `src-python/utils.py` has been modified to include more robust error handling around the `json.dumps()` call. If an `OSError` (such as `[Errno 22] Invalid argument`) occurs during JSON serialization, the function will now: - Log the full traceback of the OSError. - Log the specific problematic response dictionary that caused the error. - Print a fallback JSON error message to stdout. This change aims to help diagnose the root cause of the `OSError` reported by you by capturing the exact data that triggers it. 2. Prevent `AttributeError` for `.close()` calls: Added checks in `src-python/models/osc/osc.py` and `src-python/models/websocket/websocket_server.py` to ensure that objects are not `None` before their `.close()` or `.cancel()` methods are called. This specifically addresses: - `self.browser.zc.close()` and `self.browser.browser.cancel()` in `osc.py`. - `self._loop.close()` in `websocket_server.py`. These changes prevent potential `AttributeError: 'NoneType' object has no attribute 'close'` errors if these objects are not fully initialized before cleanup. --- src-python/models/osc/osc.py | 12 +++++++---- .../models/websocket/websocket_server.py | 3 ++- src-python/utils.py | 21 ++++++++++++++++--- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src-python/models/osc/osc.py b/src-python/models/osc/osc.py index ef4e1152..a47f1f8d 100644 --- a/src-python/models/osc/osc.py +++ b/src-python/models/osc/osc.py @@ -90,8 +90,10 @@ class OSCHandler: # エラー発生時にbrowserをリセットして次回再初期化 if self.browser is not None: try: - self.browser.zc.close() - self.browser.browser.cancel() + if hasattr(self.browser, 'zc') and self.browser.zc is not None: + self.browser.zc.close() + if hasattr(self.browser, 'browser') and self.browser.browser is not None: + self.browser.browser.cancel() except Exception: pass self.browser = None @@ -140,8 +142,10 @@ class OSCHandler: # browserがある場合はクリーンアップ if self.browser is not None: try: - self.browser.zc.close() - self.browser.browser.cancel() + if hasattr(self.browser, 'zc') and self.browser.zc is not None: + self.browser.zc.close() + if hasattr(self.browser, 'browser') and self.browser.browser is not None: + self.browser.browser.cancel() except Exception: pass self.browser = None diff --git a/src-python/models/websocket/websocket_server.py b/src-python/models/websocket/websocket_server.py index 34762e55..299e7032 100644 --- a/src-python/models/websocket/websocket_server.py +++ b/src-python/models/websocket/websocket_server.py @@ -138,7 +138,8 @@ class WebSocketServer: finally: # 停止指示が出たらすべての接続を閉じ、イベントループを終了 self._loop.run_until_complete(self._shutdown()) - self._loop.close() + if self._loop is not None: + self._loop.close() async def _shutdown(self): """ diff --git a/src-python/utils.py b/src-python/utils.py index 7bc0997b..2676d591 100644 --- a/src-python/utils.py +++ b/src-python/utils.py @@ -115,9 +115,24 @@ def printResponse(status:int, endpoint:str, result:Any=None) -> None: "endpoint": endpoint, "result": result, } - process_logger.info(response) - response = json.dumps(response) - print(response, flush=True) + process_logger.info(response) # Log the unserialized response + + try: + serialized_response = json.dumps(response) + except OSError as e: + errorLogging() # Log the full traceback of the OSError + process_logger.error(f"Problematic response object before json.dumps: {response}") + process_logger.error(f"OSError during json.dumps: {e}") + # Optionally, print a generic error JSON to stdout if needed, or re-raise + # For now, we'll print a simple error message to stdout as a fallback + error_json = json.dumps({ + "status": 500, + "endpoint": endpoint, + "result": {"error": "Failed to serialize response due to OSError", "details": str(e)} + }) + print(error_json, flush=True) + else: + print(serialized_response, flush=True) error_logger = None def errorLogging() -> None: From 65b5ffb2fada2364f73a16dc2ece24d298f9a961 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Thu, 19 Jun 2025 00:34:46 +0900 Subject: [PATCH 34/41] [Refactor] Remove unused codes and a file. Rename file format .jsx to .js that was not intended. --- .../appearance/useRestoreWindowGeometry.js | 28 ------------------- .../{useSupporters.jsx => useSupporters.js} | 0 src-ui/store.js | 3 -- 3 files changed, 31 deletions(-) delete mode 100644 src-ui/logics/configs/appearance/useRestoreWindowGeometry.js rename src-ui/logics/configs/supporters/{useSupporters.jsx => useSupporters.js} (100%) diff --git a/src-ui/logics/configs/appearance/useRestoreWindowGeometry.js b/src-ui/logics/configs/appearance/useRestoreWindowGeometry.js deleted file mode 100644 index 76a01a4b..00000000 --- a/src-ui/logics/configs/appearance/useRestoreWindowGeometry.js +++ /dev/null @@ -1,28 +0,0 @@ -// import { useStore_RestoreWindowGeometry } from "@store"; -// import { useStdoutToPython } from "@useStdoutToPython"; - -// export const useRestoreWindowGeometry = () => { -// const { asyncStdoutToPython } = useStdoutToPython(); -// const { currentRestoreWindowGeometry, updateRestoreWindowGeometry, pendingRestoreWindowGeometry } = useStore_RestoreWindowGeometry(); - -// const getRestoreWindowGeometry = () => { -// pendingRestoreWindowGeometry(); -// asyncStdoutToPython("/get/data/restore_main_window_geometry"); -// }; - -// const toggleRestoreWindowGeometry = () => { -// pendingRestoreWindowGeometry(); -// if (currentRestoreWindowGeometry.data) { -// asyncStdoutToPython("/set/disable/restore_main_window_geometry"); -// } else { -// asyncStdoutToPython("/set/enable/restore_main_window_geometry"); -// } -// }; - -// return { -// currentRestoreWindowGeometry, -// getRestoreWindowGeometry, -// toggleRestoreWindowGeometry, -// updateRestoreWindowGeometry, -// }; -// }; \ No newline at end of file diff --git a/src-ui/logics/configs/supporters/useSupporters.jsx b/src-ui/logics/configs/supporters/useSupporters.js similarity index 100% rename from src-ui/logics/configs/supporters/useSupporters.jsx rename to src-ui/logics/configs/supporters/useSupporters.js diff --git a/src-ui/store.js b/src-ui/store.js index 23b865a4..67b52a81 100644 --- a/src-ui/store.js +++ b/src-ui/store.js @@ -32,10 +32,7 @@ const generatePropertyNames = (base_name) => ({ pending: `pending${base_name}`, current: `current${base_name}`, update: `update${base_name}`, - updatePart: `updatePart${base_name}`, - async_update: `asyncUpdate${base_name}`, add: `add${base_name}`, - async_add: `asyncAdd${base_name}`, }); From e480c373cd0ac05df4f6ea2eadcffaf2577e297e Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Thu, 19 Jun 2025 08:40:45 +0900 Subject: [PATCH 35/41] [Refactor] (Huge Refactoring 2) Consolidated all logic into category-specific files. Renamed useTranslation from react-i18next to useI18n to avoid a name conflict with our own function. --- locales/useI18n.js | 11 + src-ui/app/App.jsx | 4 +- .../_app_controllers/FontFamilyController.jsx | 4 +- .../TransparencyController.jsx | 4 +- .../_app_controllers/UiLanguageController.jsx | 8 +- .../app/_app_controllers/UiSizeController.jsx | 4 +- .../MergePluginsController.jsx | 4 +- .../_download_button/_DownloadButton.jsx | 4 +- .../deepl_auth_key/DeeplAuthKey.jsx | 6 +- .../EntryWithSaveButton.jsx | 4 +- .../volume_check_button/VolumeCheckButton.jsx | 4 +- .../_components/word_filter/WordFilter.jsx | 12 +- .../setting_box/about_vrct/AboutVrct.jsx | 4 +- .../advanced_settings/AdvancedSettings.jsx | 30 +- .../setting_box/appearance/Appearance.jsx | 38 +-- .../setting_box/device/Device.jsx | 6 +- .../setting_box/hotkeys/Hotkeys.jsx | 4 +- .../setting_box/others/Others.jsx | 40 +-- .../setting_box/plugins/Plugins.jsx | 4 +- .../PluginsControlComponent.jsx | 8 +- .../transcription/Transcription.jsx | 65 ++-- .../setting_box/translation/Translation.jsx | 26 +- .../setting_section/setting_box/vr/Vr.jsx | 41 +-- .../sidebar_section/SidebarSection.jsx | 4 +- src-ui/app/config_page/topbar/Topbar.jsx | 4 +- .../compact_switch_box/CompactSwitchBox.jsx | 4 +- .../section_title_box/SectionTitleBox.jsx | 4 +- .../config_page/topbar/title_box/TitleBox.jsx | 4 +- .../version_label/VersionLabel.jsx | 4 +- .../main_page/main_section/MainSection.jsx | 4 +- .../language_selector/LanguageSelector.jsx | 4 +- .../LanguageSelectorTopBar.jsx | 4 +- .../message_container/log_box/LogBox.jsx | 4 +- .../message_container/MessageContainer.jsx | 8 +- .../MessageSubMenuContainer.jsx | 4 +- .../message_input_box/MessageInputBox.jsx | 6 +- .../MessageLogSettingsContainer.jsx | 4 +- .../RightSideComponents.jsx | 20 +- .../_buttons/OpenQuickSettingButton.jsx | 4 +- .../language_settings/LanguageSettings.jsx | 6 +- .../LanguageSelectorOpenButton.jsx | 4 +- .../LanguageSwapButton.jsx | 4 +- .../TranslatorSelectorOpenButton.jsx | 4 +- .../TranslatorSelector.jsx | 7 +- .../MainFunctionSwitch.jsx | 4 +- .../update_modal/UpdateModal.jsx | 6 +- .../DownloadModelsContainer.jsx | 8 +- .../updating_component/UpdatingComponent.jsx | 4 +- src-ui/logics/_useBackendErrorHandling.js | 49 ++- src-ui/logics/common/useHandleOscQuery.js | 8 +- src-ui/logics/common/useWindow.js | 4 +- ...useWebsocket.js => useAdvancedSettings.js} | 56 +++- .../advanced_settings/useOscIpAddress.js | 24 -- .../configs/advanced_settings/useOscPort.js | 33 -- .../configs/appearance/useAppearance.js | 156 ++++++++++ .../appearance/useMessageLogUiScaling.js | 24 -- .../appearance/useSelectedFontFamily.js | 24 -- .../appearance/useSendMessageButtonType.js | 24 -- .../configs/appearance/useShowResendButton.js | 28 -- .../configs/appearance/useTransparency.js | 24 -- .../configs/appearance/useUiLanguage.js | 24 -- .../logics/configs/appearance/useUiScaling.js | 24 -- src-ui/logics/configs/index.js | 58 +--- .../useEnableAutoClearMessageInputBox.js | 28 -- .../others/useEnableAutoExportMessageLogs.js | 28 -- .../others/useEnableNotificationVrcSfx.js | 28 -- .../others/useEnableSendMessageToVrc.js | 28 -- .../useEnableSendOnlyTranslatedMessages.js | 28 -- .../useEnableSendReceivedMessageToVrc.js | 28 -- .../configs/others/useEnableVrcMicMuteSync.js | 36 --- src-ui/logics/configs/others/useOthers.js | 192 ++++++++++++ src-ui/logics/configs/plugins/usePlugins.js | 6 +- .../configs/transcription/useMicMaxWords.js | 24 -- .../transcription/useMicPhraseTimeout.js | 24 -- .../transcription/useMicRecordTimeout.js | 24 -- .../transcription/useMicWordFilterList.js | 41 --- .../useSelectableWhisperComputeDeviceList.js | 25 -- .../useSelectedTranscriptionEngine.js | 24 -- .../useSelectedWhisperComputeDevice.js | 24 -- .../useSelectedWhisperWeightType.js | 24 -- .../transcription/useSpeakerMaxWords.js | 24 -- .../transcription/useSpeakerPhraseTimeout.js | 24 -- .../transcription/useSpeakerRecordTimeout.js | 24 -- .../configs/transcription/useTranscription.js | 292 ++++++++++++++++++ .../useWhisperWeightTypeStatus.js | 60 ---- .../useCTranslate2WeightTypeStatus.js | 60 ---- .../configs/translation/useDeepLAuthKey.js | 45 --- ...eSelectableCTranslate2ComputeDeviceList.js | 25 -- .../useSelectedCTranslate2ComputeDevice.js | 24 -- .../useSelectedCTranslate2WeightType.js | 24 -- .../configs/translation/useTranslation.js | 155 ++++++++++ .../configs/vr/useIsEnabledOverlayLargeLog.js | 28 -- .../configs/vr/useIsEnabledOverlaySmallLog.js | 28 -- .../configs/vr/useOverlayLargeLogSettings.js | 24 -- .../useOverlayShowOnlyTranslatedMessages.js | 28 -- .../configs/vr/useOverlaySmallLogSettings.js | 24 -- .../logics/configs/vr/useSendTextToOverlay.js | 13 - src-ui/logics/configs/vr/useVr.js | 120 +++++++ src-ui/logics/useReceiveRoutes.js | 195 ++++++------ vite.config.js | 2 + 100 files changed, 1334 insertions(+), 1525 deletions(-) create mode 100644 locales/useI18n.js rename src-ui/logics/configs/advanced_settings/{useWebsocket.js => useAdvancedSettings.js} (54%) delete mode 100644 src-ui/logics/configs/advanced_settings/useOscIpAddress.js delete mode 100644 src-ui/logics/configs/advanced_settings/useOscPort.js create mode 100644 src-ui/logics/configs/appearance/useAppearance.js delete mode 100644 src-ui/logics/configs/appearance/useMessageLogUiScaling.js delete mode 100644 src-ui/logics/configs/appearance/useSelectedFontFamily.js delete mode 100644 src-ui/logics/configs/appearance/useSendMessageButtonType.js delete mode 100644 src-ui/logics/configs/appearance/useShowResendButton.js delete mode 100644 src-ui/logics/configs/appearance/useTransparency.js delete mode 100644 src-ui/logics/configs/appearance/useUiLanguage.js delete mode 100644 src-ui/logics/configs/appearance/useUiScaling.js delete mode 100644 src-ui/logics/configs/others/useEnableAutoClearMessageInputBox.js delete mode 100644 src-ui/logics/configs/others/useEnableAutoExportMessageLogs.js delete mode 100644 src-ui/logics/configs/others/useEnableNotificationVrcSfx.js delete mode 100644 src-ui/logics/configs/others/useEnableSendMessageToVrc.js delete mode 100644 src-ui/logics/configs/others/useEnableSendOnlyTranslatedMessages.js delete mode 100644 src-ui/logics/configs/others/useEnableSendReceivedMessageToVrc.js delete mode 100644 src-ui/logics/configs/others/useEnableVrcMicMuteSync.js create mode 100644 src-ui/logics/configs/others/useOthers.js delete mode 100644 src-ui/logics/configs/transcription/useMicMaxWords.js delete mode 100644 src-ui/logics/configs/transcription/useMicPhraseTimeout.js delete mode 100644 src-ui/logics/configs/transcription/useMicRecordTimeout.js delete mode 100644 src-ui/logics/configs/transcription/useMicWordFilterList.js delete mode 100644 src-ui/logics/configs/transcription/useSelectableWhisperComputeDeviceList.js delete mode 100644 src-ui/logics/configs/transcription/useSelectedTranscriptionEngine.js delete mode 100644 src-ui/logics/configs/transcription/useSelectedWhisperComputeDevice.js delete mode 100644 src-ui/logics/configs/transcription/useSelectedWhisperWeightType.js delete mode 100644 src-ui/logics/configs/transcription/useSpeakerMaxWords.js delete mode 100644 src-ui/logics/configs/transcription/useSpeakerPhraseTimeout.js delete mode 100644 src-ui/logics/configs/transcription/useSpeakerRecordTimeout.js create mode 100644 src-ui/logics/configs/transcription/useTranscription.js delete mode 100644 src-ui/logics/configs/transcription/useWhisperWeightTypeStatus.js delete mode 100644 src-ui/logics/configs/translation/useCTranslate2WeightTypeStatus.js delete mode 100644 src-ui/logics/configs/translation/useDeepLAuthKey.js delete mode 100644 src-ui/logics/configs/translation/useSelectableCTranslate2ComputeDeviceList.js delete mode 100644 src-ui/logics/configs/translation/useSelectedCTranslate2ComputeDevice.js delete mode 100644 src-ui/logics/configs/translation/useSelectedCTranslate2WeightType.js create mode 100644 src-ui/logics/configs/translation/useTranslation.js delete mode 100644 src-ui/logics/configs/vr/useIsEnabledOverlayLargeLog.js delete mode 100644 src-ui/logics/configs/vr/useIsEnabledOverlaySmallLog.js delete mode 100644 src-ui/logics/configs/vr/useOverlayLargeLogSettings.js delete mode 100644 src-ui/logics/configs/vr/useOverlayShowOnlyTranslatedMessages.js delete mode 100644 src-ui/logics/configs/vr/useOverlaySmallLogSettings.js delete mode 100644 src-ui/logics/configs/vr/useSendTextToOverlay.js create mode 100644 src-ui/logics/configs/vr/useVr.js diff --git a/locales/useI18n.js b/locales/useI18n.js new file mode 100644 index 00000000..d006367c --- /dev/null +++ b/locales/useI18n.js @@ -0,0 +1,11 @@ +// To avoid a name conflict with our own `useTranslation` function, +// rename the one from `react-i18next` to `useI18n`. +// This is aliased via `vite.config.js`, so it can be imported using `@useI18n`. +// Example: +// import { useI18n } from "@useI18n"; +// +// export const useTranslation = () => { +// const { t } = useI18n(); +// ... +// }; +export { useTranslation as useI18n } from "react-i18next"; \ No newline at end of file diff --git a/src-ui/app/App.jsx b/src-ui/app/App.jsx index ac9159e1..8280a857 100644 --- a/src-ui/app/App.jsx +++ b/src-ui/app/App.jsx @@ -1,4 +1,4 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import { KeyEventController, @@ -32,7 +32,7 @@ import { useIsBackendReady, useIsSoftwareUpdating, useIsVrctAvailable, useWindow export const App = () => { const { currentIsVrctAvailable } = useIsVrctAvailable(); const { currentIsBackendReady } = useIsBackendReady(); - const { i18n } = useTranslation(); + const { i18n } = useI18n(); return (
diff --git a/src-ui/app/_app_controllers/FontFamilyController.jsx b/src-ui/app/_app_controllers/FontFamilyController.jsx index f7110d1d..7d46425f 100644 --- a/src-ui/app/_app_controllers/FontFamilyController.jsx +++ b/src-ui/app/_app_controllers/FontFamilyController.jsx @@ -1,8 +1,8 @@ import { useEffect } from "react"; -import { useSelectedFontFamily } from "@logics_configs"; +import { useAppearance } from "@logics_configs"; export const FontFamilyController = () => { - const { currentSelectedFontFamily } = useSelectedFontFamily(); + const { currentSelectedFontFamily } = useAppearance(); useEffect(() => { document.documentElement.style.setProperty("--font_family", currentSelectedFontFamily.data); }, [currentSelectedFontFamily.data]); diff --git a/src-ui/app/_app_controllers/TransparencyController.jsx b/src-ui/app/_app_controllers/TransparencyController.jsx index 46982413..0ddbc62e 100644 --- a/src-ui/app/_app_controllers/TransparencyController.jsx +++ b/src-ui/app/_app_controllers/TransparencyController.jsx @@ -1,8 +1,8 @@ import { useEffect } from "react"; -import { useTransparency } from "@logics_configs"; +import { useAppearance } from "@logics_configs"; export const TransparencyController = () => { - const { currentTransparency } = useTransparency(); + const { currentTransparency } = useAppearance(); useEffect(() => { document.documentElement.style.setProperty("opacity", `${currentTransparency.data / 100}`); }, [currentTransparency.data]); diff --git a/src-ui/app/_app_controllers/UiLanguageController.jsx b/src-ui/app/_app_controllers/UiLanguageController.jsx index 5b45c503..215874cb 100644 --- a/src-ui/app/_app_controllers/UiLanguageController.jsx +++ b/src-ui/app/_app_controllers/UiLanguageController.jsx @@ -1,11 +1,11 @@ import { useEffect } from "react"; -import { useTranslation } from "react-i18next"; -import { useUiLanguage } from "@logics_configs"; +import { useI18n } from "@useI18n"; +import { useAppearance } from "@logics_configs"; export const UiLanguageController = () => { - const { currentUiLanguage } = useUiLanguage(); - const { i18n } = useTranslation(); + const { currentUiLanguage } = useAppearance(); + const { i18n } = useI18n(); useEffect(() => { i18n.changeLanguage(currentUiLanguage.data); diff --git a/src-ui/app/_app_controllers/UiSizeController.jsx b/src-ui/app/_app_controllers/UiSizeController.jsx index 8b970c0f..5ad6aa3f 100644 --- a/src-ui/app/_app_controllers/UiSizeController.jsx +++ b/src-ui/app/_app_controllers/UiSizeController.jsx @@ -1,8 +1,8 @@ import { useEffect } from "react"; -import { useUiScaling } from "@logics_configs"; +import { useAppearance } from "@logics_configs"; export const UiSizeController = () => { - const { currentUiScaling } = useUiScaling(); + const { currentUiScaling } = useAppearance(); const font_size = 62.5 * currentUiScaling.data / 100; useEffect(() => { diff --git a/src-ui/app/_app_controllers/plugins_controllers/MergePluginsController.jsx b/src-ui/app/_app_controllers/plugins_controllers/MergePluginsController.jsx index 8d2c1b4f..71aee84f 100644 --- a/src-ui/app/_app_controllers/plugins_controllers/MergePluginsController.jsx +++ b/src-ui/app/_app_controllers/plugins_controllers/MergePluginsController.jsx @@ -1,12 +1,12 @@ import { useEffect, useRef } from "react"; -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import { store } from "@store"; import { usePlugins } from "@logics_configs"; import { useSoftwareVersion } from "@logics_common"; import { useNotificationStatus } from "@logics_common"; export const MergePluginsController = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const { currentLoadedPlugins, updatePluginsData, diff --git a/src-ui/app/config_page/setting_section/setting_box/_components/_atoms/_download_button/_DownloadButton.jsx b/src-ui/app/config_page/setting_section/setting_box/_components/_atoms/_download_button/_DownloadButton.jsx index edaf7fa5..ac17b759 100644 --- a/src-ui/app/config_page/setting_section/setting_box/_components/_atoms/_download_button/_DownloadButton.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/_components/_atoms/_download_button/_DownloadButton.jsx @@ -1,9 +1,9 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import CircularProgress from "@mui/material/CircularProgress"; import styles from "./_DownloadButton.module.scss"; export const _DownloadButton = ({option, ...props}) => { - const { t } = useTranslation(); + const { t } = useI18n(); const renderContent = () => { const circular_progress = Math.floor(option.progress / 10) * 10; diff --git a/src-ui/app/config_page/setting_section/setting_box/_components/deepl_auth_key/DeeplAuthKey.jsx b/src-ui/app/config_page/setting_section/setting_box/_components/deepl_auth_key/DeeplAuthKey.jsx index e462998c..effdd2c9 100644 --- a/src-ui/app/config_page/setting_section/setting_box/_components/deepl_auth_key/DeeplAuthKey.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/_components/deepl_auth_key/DeeplAuthKey.jsx @@ -1,5 +1,5 @@ import styles from "./DeeplAuthKey.module.scss"; -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import clsx from "clsx"; import CircularProgress from "@mui/material/CircularProgress"; import ExternalLink from "@images/external_link.svg?react"; @@ -8,7 +8,7 @@ import { useState, useRef } from "react"; import { useEffect } from "react"; export const DeeplAuthKey = (props) => { - const { t } = useTranslation(); + const { t } = useI18n(); const [is_editable, seIsEditable] = useState(false); const entryRef = useRef(null); @@ -60,7 +60,7 @@ export const DeeplAuthKey = (props) => { export const OpenWebpage_DeeplAuthKey = () => { - const { t } = useTranslation(); + const { t } = useI18n(); return (
diff --git a/src-ui/app/config_page/setting_section/setting_box/_components/entry_with_save_button/EntryWithSaveButton.jsx b/src-ui/app/config_page/setting_section/setting_box/_components/entry_with_save_button/EntryWithSaveButton.jsx index 487d0e04..ca7d1a10 100644 --- a/src-ui/app/config_page/setting_section/setting_box/_components/entry_with_save_button/EntryWithSaveButton.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/_components/entry_with_save_button/EntryWithSaveButton.jsx @@ -1,11 +1,11 @@ import styles from "./EntryWithSaveButton.module.scss"; import { _Entry } from "../_atoms/_entry/_Entry"; import CircularProgress from "@mui/material/CircularProgress"; -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import { clsx } from "clsx"; export const EntryWithSaveButton = (props) => { - const { t } = useTranslation(); + const { t } = useI18n(); const onChangeFunction = (e) => { props.onChangeFunction?.(e.target.value); }; diff --git a/src-ui/app/config_page/setting_section/setting_box/_components/threshold_component/volume_check_button/VolumeCheckButton.jsx b/src-ui/app/config_page/setting_section/setting_box/_components/threshold_component/volume_check_button/VolumeCheckButton.jsx index 0f733b48..d3943bc0 100644 --- a/src-ui/app/config_page/setting_section/setting_box/_components/threshold_component/volume_check_button/VolumeCheckButton.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/_components/threshold_component/volume_check_button/VolumeCheckButton.jsx @@ -1,10 +1,10 @@ import React from "react"; -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import clsx from "clsx"; import styles from "./VolumeCheckButton.module.scss"; export const VolumeCheckButton = React.memo((props) => { - const { t } = useTranslation(); + const { t } = useI18n(); const getClassNames = (baseClass) => clsx(baseClass, { [styles.is_active]: (props.isChecking?.data === true), [styles.is_pending]: (props.isChecking.state === "pending"), diff --git a/src-ui/app/config_page/setting_section/setting_box/_components/word_filter/WordFilter.jsx b/src-ui/app/config_page/setting_section/setting_box/_components/word_filter/WordFilter.jsx index bc338d4b..fbc0bd05 100644 --- a/src-ui/app/config_page/setting_section/setting_box/_components/word_filter/WordFilter.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/_components/word_filter/WordFilter.jsx @@ -1,15 +1,15 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import styles from "./WordFilter.module.scss"; import { _Entry } from "../_atoms/_entry/_Entry"; import { useState } from "react"; import { useStore_IsOpenedMicWordFilterList } from "@store"; -import { useMicWordFilterList } from "@logics_configs"; +import { useTranscription } from "@logics_configs"; export const WordFilter = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const [input_value, setInputValue] = useState(""); - const { currentMicWordFilterList, updateMicWordFilterList, setMicWordFilterList } = useMicWordFilterList(); + const { currentMicWordFilterList, updateMicWordFilterList, setMicWordFilterList } = useTranscription(); const { currentIsOpenedMicWordFilterList, updateIsOpenedMicWordFilterList } = useStore_IsOpenedMicWordFilterList(); const extractRedoableFalseItem = (updated_list) => { @@ -126,9 +126,9 @@ const WordFilterItem = (props) => { import ArrowLeftSvg from "@images/arrow_left.svg?react"; export const WordFilterListToggleComponent = (props) => { - const { t } = useTranslation(); + const { t } = useI18n(); const { currentIsOpenedMicWordFilterList, updateIsOpenedMicWordFilterList } = useStore_IsOpenedMicWordFilterList(); - const { currentMicWordFilterList } = useMicWordFilterList(); + const { currentMicWordFilterList } = useTranscription(); const svg_class_names = clsx(styles["arrow_left_svg"], { diff --git a/src-ui/app/config_page/setting_section/setting_box/about_vrct/AboutVrct.jsx b/src-ui/app/config_page/setting_section/setting_box/about_vrct/AboutVrct.jsx index d64f4e3c..a04c02bd 100644 --- a/src-ui/app/config_page/setting_section/setting_box/about_vrct/AboutVrct.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/about_vrct/AboutVrct.jsx @@ -27,12 +27,12 @@ import special_thanks_message_ja from "@images/about_vrct/special_thanks_message import poster_showcase_section_title from "@images/about_vrct/poster_showcase_section_title.png"; import clsx from "clsx"; -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import { useStore_UiLanguage } from "@store"; import { PosterShowcaseContents } from "./poster_showcase_contents/PosterShowcaseContents"; export const AboutVrct = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const { currentUiLanguage } = useStore_UiLanguage(); return (
diff --git a/src-ui/app/config_page/setting_section/setting_box/advanced_settings/AdvancedSettings.jsx b/src-ui/app/config_page/setting_section/setting_box/advanced_settings/AdvancedSettings.jsx index 4e7d798f..df6f012a 100644 --- a/src-ui/app/config_page/setting_section/setting_box/advanced_settings/AdvancedSettings.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/advanced_settings/AdvancedSettings.jsx @@ -1,12 +1,10 @@ import { useEffect, useState } from "react"; -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import styles from "./AdvancedSettings.module.scss"; import { useOpenFolder } from "@logics_common"; import { - useOscIpAddress, - useOscPort, - useWebsocket, + useAdvancedSettings, } from "@logics_configs"; import { @@ -37,8 +35,8 @@ export const AdvancedSettings = () => { }; const OscIpAddressContainer = () => { - const { t } = useTranslation(); - const { currentOscIpAddress, setOscIpAddress } = useOscIpAddress(); + const { t } = useI18n(); + const { currentOscIpAddress, setOscIpAddress } = useAdvancedSettings(); const [input_value, setInputValue] = useState(currentOscIpAddress.data); const onChangeFunction = (value) => { @@ -67,8 +65,8 @@ const OscIpAddressContainer = () => { }; const OscPortContainer = () => { - const { t } = useTranslation(); - const { currentOscPort, setOscPort } = useOscPort(); + const { t } = useI18n(); + const { currentOscPort, setOscPort } = useAdvancedSettings(); const [input_value, setInputValue] = useState(currentOscPort.data); const onChangeFunction = (value) => { @@ -98,7 +96,7 @@ const OscPortContainer = () => { }; const OpenConfigFolderContainer = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const { openFolder_ConfigFile } = useOpenFolder(); return ( @@ -115,7 +113,7 @@ const OpenConfigFolderContainer = () => { // Duplicate import { useStore_OpenedQuickSetting } from "@store"; const OpenSwitchComputeDeviceModalContainer = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const { updateOpenedQuickSetting } = useStore_OpenedQuickSetting(); const onClickFunction = () => { updateOpenedQuickSetting("update_software"); @@ -145,8 +143,8 @@ const WebsocketContainer = () => { }; const EnableWebsocketContainer = () => { - const { t } = useTranslation(); - const { currentEnableWebsocket, toggleEnableWebsocket } = useWebsocket(); + const { t } = useI18n(); + const { currentEnableWebsocket, toggleEnableWebsocket } = useAdvancedSettings(); return ( { }; const WebsocketHostContainer = () => { - const { t } = useTranslation(); - const { currentWebsocketHost, setWebsocketHost } = useWebsocket(); + const { t } = useI18n(); + const { currentWebsocketHost, setWebsocketHost } = useAdvancedSettings(); const [input_value, setInputValue] = useState(currentWebsocketHost.data); const onChangeFunction = (value) => { @@ -188,8 +186,8 @@ const WebsocketHostContainer = () => { }; const WebsocketPortContainer = () => { - const { t } = useTranslation(); - const { currentWebsocketPort, setWebsocketPort } = useWebsocket(); + const { t } = useI18n(); + const { currentWebsocketPort, setWebsocketPort } = useAdvancedSettings(); const [input_value, setInputValue] = useState(currentWebsocketPort.data); const onChangeFunction = (value) => { diff --git a/src-ui/app/config_page/setting_section/setting_box/appearance/Appearance.jsx b/src-ui/app/config_page/setting_section/setting_box/appearance/Appearance.jsx index 29a300cb..1f2f9eb4 100644 --- a/src-ui/app/config_page/setting_section/setting_box/appearance/Appearance.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/appearance/Appearance.jsx @@ -1,6 +1,6 @@ import clsx from "clsx"; import { useEffect, useState } from "react"; -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import styles from "./Appearance.module.scss"; import { ui_configs } from "@ui_configs"; import { useStore_SelectableFontFamilyList } from "@store"; @@ -10,13 +10,7 @@ import { } from "@logics_common"; import { - useUiLanguage, - useUiScaling, - useMessageLogUiScaling, - useSendMessageButtonType, - useShowResendButton, - useSelectedFontFamily, - useTransparency, + useAppearance, } from "@logics_configs"; import { @@ -41,8 +35,8 @@ export const Appearance = () => { }; const UiLanguageContainer = () => { - const { t } = useTranslation(); - const { currentUiLanguage, setUiLanguage } = useUiLanguage(); + const { t } = useI18n(); + const { currentUiLanguage, setUiLanguage } = useAppearance(); const is_not_en_lang = currentUiLanguage.data !== "en" && currentUiLanguage.data !== undefined; return ( @@ -58,8 +52,8 @@ const UiLanguageContainer = () => { }; const UiScalingContainer = () => { - const { t } = useTranslation(); - const { currentUiScaling, setUiScaling } = useUiScaling(); + const { t } = useI18n(); + const { currentUiScaling, setUiScaling } = useAppearance(); const { asyncUpdateBreakPoint } = useWindow(); const [ui_ui_scaling, setUiUiScaling] = useState(currentUiScaling.data); @@ -103,8 +97,8 @@ const UiScalingContainer = () => { export const MessageLogUiScalingContainer = () => { - const { t } = useTranslation(); - const { currentMessageLogUiScaling, setMessageLogUiScaling } = useMessageLogUiScaling(); + const { t } = useI18n(); + const { currentMessageLogUiScaling, setMessageLogUiScaling } = useAppearance(); const [ui_message_log_ui_scaling, setUiMessageLogUiScaling] = useState(currentMessageLogUiScaling.data); const onchangeFunction = (value) => { @@ -144,8 +138,8 @@ export const MessageLogUiScalingContainer = () => { }; const SendMessageButtonTypeContainer = () => { - const { t } = useTranslation(); - const { currentSendMessageButtonType, setSendMessageButtonType } = useSendMessageButtonType(); + const { t } = useI18n(); + const { currentSendMessageButtonType, setSendMessageButtonType } = useAppearance(); return ( { }; const ShowResendButtonContainer = () => { - const { t } = useTranslation(); - const { currentShowResendButton, toggleShowResendButton } = useShowResendButton(); + const { t } = useI18n(); + const { currentShowResendButton, toggleShowResendButton } = useAppearance(); return ( { }; const FontFamilyContainer = () => { - const { t } = useTranslation(); - const { currentSelectedFontFamily, setSelectedFontFamily } = useSelectedFontFamily(); + const { t } = useI18n(); + const { currentSelectedFontFamily, setSelectedFontFamily } = useAppearance(); const selectFunction = (selected_data) => { setSelectedFontFamily(selected_data.selected_id); @@ -199,8 +193,8 @@ const FontFamilyContainer = () => { }; const TransparencyContainer = () => { - const { t } = useTranslation(); - const { currentTransparency, setTransparency } = useTransparency(); + const { t } = useI18n(); + const { currentTransparency, setTransparency } = useAppearance(); const [ui_message_log_ui_scaling, setUiTransparency] = useState(currentTransparency.data); const onchangeFunction = (value) => { diff --git a/src-ui/app/config_page/setting_section/setting_box/device/Device.jsx b/src-ui/app/config_page/setting_section/setting_box/device/Device.jsx index d3f20645..28240452 100644 --- a/src-ui/app/config_page/setting_section/setting_box/device/Device.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/device/Device.jsx @@ -1,4 +1,4 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import styles from "./Device.module.scss"; import clsx from "clsx"; import { useStore_IsBreakPoint } from "@store"; @@ -28,7 +28,7 @@ export const Device = () => { }; const Mic_Container = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const { currentEnableAutoMicSelect, toggleEnableAutoMicSelect, @@ -137,7 +137,7 @@ const Mic_Container = () => { }; const Speaker_Container = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const { currentEnableAutoSpeakerSelect, toggleEnableAutoSpeakerSelect, diff --git a/src-ui/app/config_page/setting_section/setting_box/hotkeys/Hotkeys.jsx b/src-ui/app/config_page/setting_section/setting_box/hotkeys/Hotkeys.jsx index 33d57923..66cf893c 100644 --- a/src-ui/app/config_page/setting_section/setting_box/hotkeys/Hotkeys.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/hotkeys/Hotkeys.jsx @@ -1,7 +1,7 @@ import { useHotkeys } from "@logics_configs"; import styles from "./Hotkeys.module.scss"; import { HotkeysEntryContainer } from "../_templates/Templates"; -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; export const Hotkeys = () => { return (
@@ -11,7 +11,7 @@ export const Hotkeys = () => { }; const HotkeysBoxContainer = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const { currentHotkeys, setHotkeys } = useHotkeys(); return ( diff --git a/src-ui/app/config_page/setting_section/setting_box/others/Others.jsx b/src-ui/app/config_page/setting_section/setting_box/others/Others.jsx index b6c9c9b6..1baf00a5 100644 --- a/src-ui/app/config_page/setting_section/setting_box/others/Others.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/others/Others.jsx @@ -1,15 +1,9 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import styles from "./Others.module.scss"; import { useOpenFolder } from "@logics_common"; import { - useEnableAutoClearMessageInputBox, - useEnableSendOnlyTranslatedMessages, - useEnableAutoExportMessageLogs, - useEnableVrcMicMuteSync, - useEnableSendMessageToVrc, - useEnableSendReceivedMessageToVrc, - useEnableNotificationVrcSfx, + useOthers, } from "@logics_configs"; import { @@ -26,7 +20,7 @@ import { Checkbox } from "@common_components"; import OpenFolderSvg from "@images/open_folder.svg?react"; export const Others = () => { - const { t } = useTranslation(); + const { t } = useI18n(); return (
@@ -50,8 +44,8 @@ export const Others = () => { }; const AutoClearMessageInputBoxContainer = () => { - const { t } = useTranslation(); - const { currentEnableAutoClearMessageInputBox, toggleEnableAutoClearMessageInputBox } = useEnableAutoClearMessageInputBox(); + const { t } = useI18n(); + const { currentEnableAutoClearMessageInputBox, toggleEnableAutoClearMessageInputBox } = useOthers(); return ( { ); }; const SendOnlyTranslatedMessagesContainer = () => { - const { t } = useTranslation(); - const { currentEnableSendOnlyTranslatedMessages, toggleEnableSendOnlyTranslatedMessages } = useEnableSendOnlyTranslatedMessages(); + const { t } = useI18n(); + const { currentEnableSendOnlyTranslatedMessages, toggleEnableSendOnlyTranslatedMessages } = useOthers(); return ( { ); }; const AutoExportMessageLogsContainer = () => { - const { t } = useTranslation(); - const { currentEnableAutoExportMessageLogs, toggleEnableAutoExportMessageLogs } = useEnableAutoExportMessageLogs(); + const { t } = useI18n(); + const { currentEnableAutoExportMessageLogs, toggleEnableAutoExportMessageLogs } = useOthers(); const { openFolder_MessageLogs } = useOpenFolder(); return ( @@ -98,8 +92,8 @@ const AutoExportMessageLogsContainer = () => { ); }; export const VrcMicMuteSyncContainer = () => { - const { t } = useTranslation(); - const { currentEnableVrcMicMuteSync, toggleEnableVrcMicMuteSync } = useEnableVrcMicMuteSync(); + const { t } = useI18n(); + const { currentEnableVrcMicMuteSync, toggleEnableVrcMicMuteSync } = useOthers(); const variable = { state: currentEnableVrcMicMuteSync.state, @@ -117,8 +111,8 @@ export const VrcMicMuteSyncContainer = () => { ); }; const SendMessageToVrcContainer = () => { - const { t } = useTranslation(); - const { currentEnableSendMessageToVrc, toggleEnableSendMessageToVrc } = useEnableSendMessageToVrc(); + const { t } = useI18n(); + const { currentEnableSendMessageToVrc, toggleEnableSendMessageToVrc } = useOthers(); return ( { const EnableNotificationVrcSfxContainer = () => { - const { t } = useTranslation(); - const { currentEnableNotificationVrcSfx, toggleEnableNotificationVrcSfx } = useEnableNotificationVrcSfx(); + const { t } = useI18n(); + const { currentEnableNotificationVrcSfx, toggleEnableNotificationVrcSfx } = useOthers(); return ( { }; const SendReceivedMessageToVrcContainer = () => { - const { t } = useTranslation(); - const { currentEnableSendReceivedMessageToVrc, toggleEnableSendReceivedMessageToVrc } = useEnableSendReceivedMessageToVrc(); + const { t } = useI18n(); + const { currentEnableSendReceivedMessageToVrc, toggleEnableSendReceivedMessageToVrc } = useOthers(); return ( { }; const PluginDownloadContainer = () => { - const { t, i18n } = useTranslation(); + const { t, i18n } = useI18n(); const { downloadAndExtractPlugin, currentPluginsData, diff --git a/src-ui/app/config_page/setting_section/setting_box/plugins/plugins_control_component/PluginsControlComponent.jsx b/src-ui/app/config_page/setting_section/setting_box/plugins/plugins_control_component/PluginsControlComponent.jsx index 94a90b50..addd08c1 100644 --- a/src-ui/app/config_page/setting_section/setting_box/plugins/plugins_control_component/PluginsControlComponent.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/plugins/plugins_control_component/PluginsControlComponent.jsx @@ -1,7 +1,7 @@ import { SwitchBox } from "../../_components"; import { _DownloadButton } from "../../_components/_atoms/_download_button/_DownloadButton"; import styles from "./PluginsControlComponent.module.scss"; -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; export const PluginsControlComponent = ({ variable_state, @@ -9,7 +9,7 @@ export const PluginsControlComponent = ({ toggleFunction, downloadStartFunction, }) => { - const { t } = useTranslation(); + const { t } = useI18n(); const option = { id: plugin_status.plugin_id, @@ -64,7 +64,7 @@ const DownloadedPluginControl = ({ downloaded_version_label, latest_version_label, }) => { - const { t } = useTranslation(); + const { t } = useI18n(); const togglePlugin = () => { toggleFunction(plugin_status.plugin_id); @@ -128,7 +128,7 @@ const NotDownloadedPluginControl = ({ downloaded_version_label, latest_version_label, }) => { - const { t } = useTranslation(); + const { t } = useI18n(); if (plugin_status.is_latest_version_available) { return ( diff --git a/src-ui/app/config_page/setting_section/setting_box/transcription/Transcription.jsx b/src-ui/app/config_page/setting_section/setting_box/transcription/Transcription.jsx index d881b330..279c1d9d 100644 --- a/src-ui/app/config_page/setting_section/setting_box/transcription/Transcription.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/transcription/Transcription.jsx @@ -1,22 +1,9 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import styles from "./Transcription.module.scss"; import { updateLabelsById, genNumObjArray } from "@utils"; import { - useMicRecordTimeout, - useMicPhraseTimeout, - useMicMaxWords, - - useSpeakerRecordTimeout, - useSpeakerPhraseTimeout, - useSpeakerMaxWords, - - useSelectedTranscriptionEngine, - useWhisperWeightTypeStatus, - useSelectedWhisperWeightType, - - useSelectedWhisperComputeDevice, - useSelectableWhisperComputeDeviceList, + useTranscription, } from "@logics_configs"; import { @@ -43,7 +30,7 @@ export const Transcription = () => { const Mic_Container = () => { - const { t } = useTranslation(); + const { t } = useI18n(); return (
@@ -56,8 +43,8 @@ const Mic_Container = () => { }; const MicRecordTimeout_Box = () => { - const { t } = useTranslation(); - const { currentMicRecordTimeout, setMicRecordTimeout } = useMicRecordTimeout(); + const { t } = useI18n(); + const { currentMicRecordTimeout, setMicRecordTimeout } = useTranscription(); const selectFunction = (selected_data) => { setMicRecordTimeout(selected_data.selected_id); @@ -76,8 +63,8 @@ const MicRecordTimeout_Box = () => { ); }; const MicPhraseTimeout_Box = () => { - const { t } = useTranslation(); - const { currentMicPhraseTimeout, setMicPhraseTimeout } = useMicPhraseTimeout(); + const { t } = useI18n(); + const { currentMicPhraseTimeout, setMicPhraseTimeout } = useTranscription(); const selectFunction = (selected_data) => { setMicPhraseTimeout(selected_data.selected_id); @@ -96,8 +83,8 @@ const MicPhraseTimeout_Box = () => { ); }; const MicMaxWords_Box = () => { - const { t } = useTranslation(); - const { currentMicMaxWords, setMicMaxWords } = useMicMaxWords(); + const { t } = useI18n(); + const { currentMicMaxWords, setMicMaxWords } = useTranscription(); const selectFunction = (selected_data) => { setMicMaxWords(selected_data.selected_id); @@ -117,7 +104,7 @@ const MicMaxWords_Box = () => { }; const MicWordFilter_Box = () => { - const { t } = useTranslation(); + const { t } = useI18n(); return ( { const Speaker_Container = () => { - const { t } = useTranslation(); + const { t } = useI18n(); return (
@@ -143,8 +130,8 @@ const Speaker_Container = () => { }; const SpeakerRecordTimeout_Box = () => { - const { t } = useTranslation(); - const { currentSpeakerRecordTimeout, setSpeakerRecordTimeout } = useSpeakerRecordTimeout(); + const { t } = useI18n(); + const { currentSpeakerRecordTimeout, setSpeakerRecordTimeout } = useTranscription(); const selectFunction = (selected_data) => { setSpeakerRecordTimeout(selected_data.selected_id); @@ -163,8 +150,8 @@ const SpeakerRecordTimeout_Box = () => { ); }; const SpeakerPhraseTimeout_Box = () => { - const { t } = useTranslation(); - const { currentSpeakerPhraseTimeout, setSpeakerPhraseTimeout } = useSpeakerPhraseTimeout(); + const { t } = useI18n(); + const { currentSpeakerPhraseTimeout, setSpeakerPhraseTimeout } = useTranscription(); const selectFunction = (selected_data) => { setSpeakerPhraseTimeout(selected_data.selected_id); @@ -182,8 +169,8 @@ const SpeakerPhraseTimeout_Box = () => { ); }; const SpeakerMaxWords_Box = () => { - const { t } = useTranslation(); - const { currentSpeakerMaxWords, setSpeakerMaxWords } = useSpeakerMaxWords(); + const { t } = useI18n(); + const { currentSpeakerMaxWords, setSpeakerMaxWords } = useTranscription(); const selectFunction = (selected_data) => { setSpeakerMaxWords(selected_data.selected_id); @@ -205,7 +192,7 @@ const SpeakerMaxWords_Box = () => { const TranscriptionEngine_Container = () => { - const { t } = useTranslation(); + const { t } = useI18n(); return (
@@ -217,8 +204,8 @@ const TranscriptionEngine_Container = () => { }; const TranscriptionEngine_Box = () => { - const { t } = useTranslation(); - const { currentSelectedTranscriptionEngine, setSelectedTranscriptionEngine } = useSelectedTranscriptionEngine(); + const { t } = useI18n(); + const { currentSelectedTranscriptionEngine, setSelectedTranscriptionEngine } = useTranscription(); return ( { }; const WhisperWeightType_Box = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const { currentWhisperWeightTypeStatus, pendingWhisperWeightType, downloadWhisperWeight, - } = useWhisperWeightTypeStatus(); - const { currentSelectedWhisperWeightType, setSelectedWhisperWeightType } = useSelectedWhisperWeightType(); + } = useTranscription(); + const { currentSelectedWhisperWeightType, setSelectedWhisperWeightType } = useTranscription(); const selectFunction = (id) => { setSelectedWhisperWeightType(id); @@ -288,9 +275,9 @@ const WhisperWeightType_Box = () => { // Duplicate import { useComputeMode } from "@logics_common"; const WhisperComputeDevice_Box = () => { - const { t } = useTranslation(); - const { currentSelectedWhisperComputeDevice, setSelectedWhisperComputeDevice } = useSelectedWhisperComputeDevice(); - const { currentSelectableWhisperComputeDeviceList } = useSelectableWhisperComputeDeviceList(); + const { t } = useI18n(); + const { currentSelectedWhisperComputeDevice, setSelectedWhisperComputeDevice } = useTranscription(); + const { currentSelectableWhisperComputeDeviceList } = useTranscription(); const selectFunction = (selected_data) => { const target_obj = currentSelectableWhisperComputeDeviceList.data[selected_data.selected_id]; diff --git a/src-ui/app/config_page/setting_section/setting_box/translation/Translation.jsx b/src-ui/app/config_page/setting_section/setting_box/translation/Translation.jsx index db11d169..38c5a1e3 100644 --- a/src-ui/app/config_page/setting_section/setting_box/translation/Translation.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/translation/Translation.jsx @@ -1,14 +1,10 @@ import { useEffect, useState } from "react"; -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import styles from "./Translation.module.scss"; import { updateLabelsById } from "@utils"; import { - useDeepLAuthKey, - useCTranslate2WeightTypeStatus, - useSelectedCTranslate2WeightType, - useSelectedCTranslate2ComputeDevice, - useSelectableCTranslate2ComputeDeviceList, + useTranslation, } from "@logics_configs"; import { @@ -29,13 +25,15 @@ export const Translation = () => { }; const CTranslate2WeightType_Box = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const { currentCTranslate2WeightTypeStatus, pendingCTranslate2WeightType, downloadCTranslate2Weight, - } = useCTranslate2WeightTypeStatus(); - const { currentSelectedCTranslate2WeightType, setSelectedCTranslate2WeightType } = useSelectedCTranslate2WeightType(); + + currentSelectedCTranslate2WeightType, + setSelectedCTranslate2WeightType, + } = useTranslation(); const selectFunction = (id) => { setSelectedCTranslate2WeightType(id); @@ -77,9 +75,9 @@ const CTranslate2WeightType_Box = () => { // Duplicate import { useComputeMode } from "@logics_common"; const CTranslation2ComputeDevice_Box = () => { - const { t } = useTranslation(); - const { currentSelectedCTranslate2ComputeDevice, setSelectedCTranslate2ComputeDevice } = useSelectedCTranslate2ComputeDevice(); - const { currentSelectableCTranslate2ComputeDeviceList } = useSelectableCTranslate2ComputeDeviceList(); + const { t } = useI18n(); + const { currentSelectedCTranslate2ComputeDevice, setSelectedCTranslate2ComputeDevice } = useTranslation(); + const { currentSelectableCTranslate2ComputeDeviceList } = useTranslation(); const selectFunction = (selected_data) => { const target_obj = currentSelectableCTranslate2ComputeDeviceList.data[selected_data.selected_id]; @@ -120,8 +118,8 @@ const CTranslation2ComputeDevice_Box = () => { }; const DeeplAuthKey_Box = () => { - const { t } = useTranslation(); - const { currentDeepLAuthKey, setDeepLAuthKey, deleteDeepLAuthKey } = useDeepLAuthKey(); + const { t } = useI18n(); + const { currentDeepLAuthKey, setDeepLAuthKey, deleteDeepLAuthKey } = useTranslation(); const [input_value, seInputValue] = useState(currentDeepLAuthKey.data); const onChangeFunction = (value) => { diff --git a/src-ui/app/config_page/setting_section/setting_box/vr/Vr.jsx b/src-ui/app/config_page/setting_section/setting_box/vr/Vr.jsx index b145bb44..31c38816 100644 --- a/src-ui/app/config_page/setting_section/setting_box/vr/Vr.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/vr/Vr.jsx @@ -1,5 +1,5 @@ import React, { useState, useEffect, useRef } from "react"; -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import clsx from "clsx"; import styles from "./Vr.module.scss"; import { ui_configs } from "@ui_configs"; @@ -15,12 +15,7 @@ import { } from "../_components/"; import { - useIsEnabledOverlaySmallLog, - useOverlaySmallLogSettings, - useIsEnabledOverlayLargeLog, - useOverlayLargeLogSettings, - useOverlayShowOnlyTranslatedMessages, - useSendTextToOverlay, + useVr, } from "@logics_configs"; import RedoSvg from "@images/redo.svg?react"; @@ -30,17 +25,23 @@ import TriangleSvg from "@images/triangle.svg?react"; import { randomIntMinMax } from "@utils"; export const Vr = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const [is_opened_small_settings, setIsOpenedSmallSettings] = useState(true); const toggleIsOpenedSmallSettings = () => { setIsOpenedSmallSettings(!is_opened_small_settings); }; - const { currentOverlaySmallLogSettings, setOverlaySmallLogSettings } = useOverlaySmallLogSettings(); - const { currentIsEnabledOverlaySmallLog, toggleIsEnabledOverlaySmallLog } = useIsEnabledOverlaySmallLog(); + const { + currentIsEnabledOverlayLargeLog, + toggleIsEnabledOverlayLargeLog, + currentIsEnabledOverlaySmallLog, + toggleIsEnabledOverlaySmallLog, + currentOverlayLargeLogSettings, + setOverlayLargeLogSettings, + currentOverlaySmallLogSettings, + setOverlaySmallLogSettings, + } = useVr(); - const { currentOverlayLargeLogSettings, setOverlayLargeLogSettings } = useOverlayLargeLogSettings(); - const { currentIsEnabledOverlayLargeLog, toggleIsEnabledOverlayLargeLog } = useIsEnabledOverlayLargeLog(); const restoreDefaultSettings = () => { setOverlaySmallLogSettings(ui_configs.overlay_small_log_default_settings); @@ -99,7 +100,7 @@ const OverlaySettingsContainer = ({ id }) => { - const { t } = useTranslation(); + const { t } = useI18n(); useEffect(() => { setSettings(current_overlay_settings); }, [current_overlay_settings]); @@ -193,7 +194,7 @@ const PageSwitcherContainer = (props) => { export const PositionControls = ({ settings, onchangeFunction, selectFunction, ui_configs, default_ui_configs }) => { - const { t } = useTranslation(); + const { t } = useI18n(); const { variable_display: x_variable_display, @@ -302,7 +303,7 @@ export const PositionControls = ({ settings, onchangeFunction, selectFunction, u }; export const RotationControls = ({ settings, onchangeFunction, selectFunction, ui_configs, default_ui_configs }) => { - const { t } = useTranslation(); + const { t } = useI18n(); const { variable_display: x_variable_display, @@ -443,7 +444,7 @@ const AdjustButtonContainer = ({ wrapper_class_name, is_max, is_min, countUp, co const OtherControls = ({settings, onchangeFunction, ui_configs}) => { - const { t } = useTranslation(); + const { t } = useI18n(); const ui_variable_opacity = (settings.opacity * 100).toFixed(0); const ui_variable_ui_scaling = (settings.ui_scaling * 100).toFixed(0); @@ -512,8 +513,8 @@ const OtherControls = ({settings, onchangeFunction, ui_configs}) => { const CommonSettingsContainer = () => { - const { t } = useTranslation(); - const { currentOverlayShowOnlyTranslatedMessages, toggleOverlayShowOnlyTranslatedMessages } = useOverlayShowOnlyTranslatedMessages(); + const { t } = useI18n(); + const { currentOverlayShowOnlyTranslatedMessages, toggleOverlayShowOnlyTranslatedMessages } = useVr(); return (
@@ -536,8 +537,8 @@ const ResetButton = ({onClickFunction}) => { }; const SendSampleTextToggleButton = () => { - const { t } = useTranslation(); - const { sendTextToOverlay } = useSendTextToOverlay(); + const { t } = useI18n(); + const { sendTextToOverlay } = useVr(); const [is_started, setIsStarted] = useState(false); useEffect(() => { diff --git a/src-ui/app/config_page/sidebar_section/SidebarSection.jsx b/src-ui/app/config_page/sidebar_section/SidebarSection.jsx index 341da4aa..b7d36272 100644 --- a/src-ui/app/config_page/sidebar_section/SidebarSection.jsx +++ b/src-ui/app/config_page/sidebar_section/SidebarSection.jsx @@ -26,11 +26,11 @@ export const SidebarSection = () => { import clsx from "clsx"; -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import { useStore_SelectedConfigTabId } from "@store"; const Tab = (props) => { - const { t } = useTranslation(); + const { t } = useI18n(); const { updateSelectedConfigTabId, currentSelectedConfigTabId } = useStore_SelectedConfigTabId(); const onclickFunction = () => { updateSelectedConfigTabId(props.tab_id); diff --git a/src-ui/app/config_page/topbar/Topbar.jsx b/src-ui/app/config_page/topbar/Topbar.jsx index 64c8f593..9bc588d8 100644 --- a/src-ui/app/config_page/topbar/Topbar.jsx +++ b/src-ui/app/config_page/topbar/Topbar.jsx @@ -1,4 +1,4 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import clsx from "clsx"; import styles from "./Topbar.module.scss"; @@ -10,7 +10,7 @@ import { SectionTitleBox } from "./section_title_box/SectionTitleBox"; import { CompactSwitchBox } from "./compact_switch_box/CompactSwitchBox"; export const Topbar = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const { currentIsOpenedConfigPage, setIsOpenedConfigPage } = useIsOpenedConfigPage(); const closeConfigPage = () => { setIsOpenedConfigPage(false); diff --git a/src-ui/app/config_page/topbar/compact_switch_box/CompactSwitchBox.jsx b/src-ui/app/config_page/topbar/compact_switch_box/CompactSwitchBox.jsx index 4d36a1e5..5fad848e 100644 --- a/src-ui/app/config_page/topbar/compact_switch_box/CompactSwitchBox.jsx +++ b/src-ui/app/config_page/topbar/compact_switch_box/CompactSwitchBox.jsx @@ -1,9 +1,9 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import styles from "./CompactSwitchBox.module.scss"; export const CompactSwitchBox = () => { - const { t } = useTranslation(); + const { t } = useI18n(); return (

{t("config_page.compact_mode")}

diff --git a/src-ui/app/config_page/topbar/section_title_box/SectionTitleBox.jsx b/src-ui/app/config_page/topbar/section_title_box/SectionTitleBox.jsx index 53bb6b16..df02935f 100644 --- a/src-ui/app/config_page/topbar/section_title_box/SectionTitleBox.jsx +++ b/src-ui/app/config_page/topbar/section_title_box/SectionTitleBox.jsx @@ -1,9 +1,9 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import styles from "./SectionTitleBox.module.scss"; import { useStore_SelectedConfigTabId } from "@store"; export const SectionTitleBox = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const { currentSelectedConfigTabId } = useStore_SelectedConfigTabId(); return (
diff --git a/src-ui/app/config_page/topbar/title_box/TitleBox.jsx b/src-ui/app/config_page/topbar/title_box/TitleBox.jsx index c2bb2355..61aad3eb 100644 --- a/src-ui/app/config_page/topbar/title_box/TitleBox.jsx +++ b/src-ui/app/config_page/topbar/title_box/TitleBox.jsx @@ -1,10 +1,10 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import styles from "./TitleBox.module.scss"; import chato_img from "@images/chato_white.png"; export const TitleBox = () => { - const { t } = useTranslation(); + const { t } = useI18n(); return (
VRCT logo chato diff --git a/src-ui/app/config_page/version_label/VersionLabel.jsx b/src-ui/app/config_page/version_label/VersionLabel.jsx index 95abd94d..32540cc2 100644 --- a/src-ui/app/config_page/version_label/VersionLabel.jsx +++ b/src-ui/app/config_page/version_label/VersionLabel.jsx @@ -1,4 +1,4 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import { useState } from "react"; import clsx from "clsx"; import styles from "./VersionLabel.module.scss"; @@ -10,7 +10,7 @@ import CheckMarkSvg from "@images/check_mark.svg?react"; export const VersionLabel = () => { const [is_copied, setIsCopied] = useState(false); - const { t } = useTranslation(); + const { t } = useI18n(); const { currentSoftwareVersion } = useSoftwareVersion(); const { currentComputeMode } = useComputeMode(); diff --git a/src-ui/app/main_page/main_section/MainSection.jsx b/src-ui/app/main_page/main_section/MainSection.jsx index b0ffb77c..5a9140df 100644 --- a/src-ui/app/main_page/main_section/MainSection.jsx +++ b/src-ui/app/main_page/main_section/MainSection.jsx @@ -1,4 +1,4 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import styles from "./MainSection.module.scss"; import { TopBar } from "./top_bar/TopBar"; @@ -37,7 +37,7 @@ export const MainSection = () => { const HandleLanguageSelector = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const { currentIsOpenedLanguageSelector, updateIsOpenedLanguageSelector } = useStore_IsOpenedLanguageSelector(); const { currentSelectedPresetTabNumber, diff --git a/src-ui/app/main_page/main_section/language_selector/LanguageSelector.jsx b/src-ui/app/main_page/main_section/language_selector/LanguageSelector.jsx index 3665df67..6d4be514 100644 --- a/src-ui/app/main_page/main_section/language_selector/LanguageSelector.jsx +++ b/src-ui/app/main_page/main_section/language_selector/LanguageSelector.jsx @@ -1,11 +1,11 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import { useLanguageSettings } from "@logics_main"; import styles from "./LanguageSelector.module.scss"; import { LanguageSelectorTopBar } from "./language_selector_top_bar/LanguageSelectorTopBar"; export const LanguageSelector = ({ title, onClickFunction }) => { - const { t } = useTranslation(); + const { t } = useI18n(); const { currentSelectableLanguageList } = useLanguageSettings(); const groupLanguagesByFirstLetter = (languages) => { diff --git a/src-ui/app/main_page/main_section/language_selector/language_selector_top_bar/LanguageSelectorTopBar.jsx b/src-ui/app/main_page/main_section/language_selector/language_selector_top_bar/LanguageSelectorTopBar.jsx index 1ea1c832..b0bdc8de 100644 --- a/src-ui/app/main_page/main_section/language_selector/language_selector_top_bar/LanguageSelectorTopBar.jsx +++ b/src-ui/app/main_page/main_section/language_selector/language_selector_top_bar/LanguageSelectorTopBar.jsx @@ -1,9 +1,9 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import styles from "./LanguageSelectorTopBar.module.scss"; import { useStore_IsOpenedLanguageSelector } from "@store"; export const LanguageSelectorTopBar = (props) => { - const { t } = useTranslation(); + const { t } = useI18n(); const { updateIsOpenedLanguageSelector } = useStore_IsOpenedLanguageSelector(); const closeLanguageSelector = () => { updateIsOpenedLanguageSelector({ diff --git a/src-ui/app/main_page/main_section/message_container/log_box/LogBox.jsx b/src-ui/app/main_page/main_section/message_container/log_box/LogBox.jsx index 8aa8d2ec..aa37ac12 100644 --- a/src-ui/app/main_page/main_section/message_container/log_box/LogBox.jsx +++ b/src-ui/app/main_page/main_section/message_container/log_box/LogBox.jsx @@ -27,9 +27,9 @@ export const LogBox = () => { ); }; -import { useMessageLogUiScaling } from "@logics_configs"; +import { useAppearance } from "@logics_configs"; const MessageLogUiSizeController = () => { - const { currentMessageLogUiScaling } = useMessageLogUiScaling(); + const { currentMessageLogUiScaling } = useAppearance(); const font_size = currentMessageLogUiScaling.data / 100; useEffect(() => { diff --git a/src-ui/app/main_page/main_section/message_container/log_box/message_container/MessageContainer.jsx b/src-ui/app/main_page/main_section/message_container/log_box/message_container/MessageContainer.jsx index 1dbc7607..d982f27c 100644 --- a/src-ui/app/main_page/main_section/message_container/log_box/message_container/MessageContainer.jsx +++ b/src-ui/app/main_page/main_section/message_container/log_box/message_container/MessageContainer.jsx @@ -1,18 +1,18 @@ import { useState } from "react"; -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import clsx from "clsx"; import styles from "./MessageContainer.module.scss"; import { MessageSubMenuContainer } from "./message_sub_menu_container/MessageSubMenuContainer"; import { useMessage } from "@logics_common"; -import { useShowResendButton } from "@logics_configs"; +import { useAppearance } from "@logics_configs"; export const MessageContainer = ({ messages, status, category, created_at }) => { - const { t } = useTranslation(); + const { t } = useI18n(); const { sendMessage, updateMessageInputValue, } = useMessage(); - const { currentShowResendButton } = useShowResendButton(); + const { currentShowResendButton } = useAppearance(); const [is_hovered, setIsHovered] = useState(false); const [is_locked, setIsLocked] = useState(false); diff --git a/src-ui/app/main_page/main_section/message_container/log_box/message_container/message_sub_menu_container/MessageSubMenuContainer.jsx b/src-ui/app/main_page/main_section/message_container/log_box/message_container/message_sub_menu_container/MessageSubMenuContainer.jsx index 6144ff37..7b2b2f3d 100644 --- a/src-ui/app/main_page/main_section/message_container/log_box/message_container/message_sub_menu_container/MessageSubMenuContainer.jsx +++ b/src-ui/app/main_page/main_section/message_container/log_box/message_container/message_sub_menu_container/MessageSubMenuContainer.jsx @@ -1,5 +1,5 @@ import React, { useState, useRef } from "react"; -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import Tooltip, { tooltipClasses } from '@mui/material/Tooltip'; import styles from "./MessageSubMenuContainer.module.scss"; import SendMessageSvg from "@images/send_message.svg?react"; @@ -68,6 +68,6 @@ export const MessageSubMenuContainer = (props) => { }; const Title_p = () => { - const { t } = useTranslation(); + const { t } = useI18n(); return

{t("main_page.message_log.resend_button_on_hover_desc")}

; }; diff --git a/src-ui/app/main_page/main_section/message_container/message_input_box/MessageInputBox.jsx b/src-ui/app/main_page/main_section/message_container/message_input_box/MessageInputBox.jsx index 765ea9e1..6aa32092 100644 --- a/src-ui/app/main_page/main_section/message_container/message_input_box/MessageInputBox.jsx +++ b/src-ui/app/main_page/main_section/message_container/message_input_box/MessageInputBox.jsx @@ -2,7 +2,7 @@ import { useState, useEffect, useLayoutEffect, useRef } from "react"; import styles from "./MessageInputBox.module.scss"; import SendMessageSvg from "@images/send_message.svg?react"; import { useMessage } from "@logics_common"; -import { useSendMessageButtonType, useEnableAutoClearMessageInputBox } from "@logics_configs"; +import { useAppearance, useOthers } from "@logics_configs"; import { useMessageLogScroll } from "@logics_main"; import { store } from "@store"; @@ -18,8 +18,8 @@ export const MessageInputBox = () => { stopTyping, } = useMessage(); - const { currentEnableAutoClearMessageInputBox } = useEnableAutoClearMessageInputBox(); - const { currentSendMessageButtonType } = useSendMessageButtonType(); + const { currentEnableAutoClearMessageInputBox } = useOthers(); + const { currentSendMessageButtonType } = useAppearance(); const { scrollToBottom } = useMessageLogScroll(); diff --git a/src-ui/app/main_page/main_section/message_container/message_log_settings_container/MessageLogSettingsContainer.jsx b/src-ui/app/main_page/main_section/message_container/message_log_settings_container/MessageLogSettingsContainer.jsx index 8b0bbc32..ddff4a51 100644 --- a/src-ui/app/main_page/main_section/message_container/message_log_settings_container/MessageLogSettingsContainer.jsx +++ b/src-ui/app/main_page/main_section/message_container/message_log_settings_container/MessageLogSettingsContainer.jsx @@ -1,13 +1,13 @@ import { useState } from "react"; import styles from "./MessageLogSettingsContainer.module.scss"; import clsx from "clsx"; -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import { MessageLogUiScalingContainer } from "@setting_box"; import ConfigSvg from "@images/configuration.svg?react"; export const MessageLogSettingsContainer = (props) => { - const { t } = useTranslation(); + const { t } = useI18n(); const [is_opened, setIsOpened] = useState(false); const [is_hovered, setIsHovered] = useState(false); diff --git a/src-ui/app/main_page/main_section/top_bar/right_side_components/RightSideComponents.jsx b/src-ui/app/main_page/main_section/top_bar/right_side_components/RightSideComponents.jsx index 3f8be6e2..6c1ff7d3 100644 --- a/src-ui/app/main_page/main_section/top_bar/right_side_components/RightSideComponents.jsx +++ b/src-ui/app/main_page/main_section/top_bar/right_side_components/RightSideComponents.jsx @@ -1,11 +1,11 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import styles from "./RightSideComponents.module.scss"; import RefreshSvg from "@images/refresh.svg?react"; import HelpSvg from "@images/help.svg?react"; import { useStore_OpenedQuickSetting } from "@store"; import { useSoftwareVersion } from "@logics_common"; -import { useIsEnabledOverlaySmallLog, useIsEnabledOverlayLargeLog, useEnableVrcMicMuteSync } from "@logics_configs"; +import { useVr, useOthers } from "@logics_configs"; import { OpenQuickSettingButton } from "./_buttons/OpenQuickSettingButton"; export const RightSideComponents = () => { @@ -30,10 +30,12 @@ export const RightSideComponents = () => { }; const OpenOverlayQuickSetting = () => { - // const { t } = useTranslation(); + // const { t } = useI18n(); const { updateOpenedQuickSetting } = useStore_OpenedQuickSetting(); - const { currentIsEnabledOverlaySmallLog } = useIsEnabledOverlaySmallLog(); - const { currentIsEnabledOverlayLargeLog } = useIsEnabledOverlayLargeLog(); + const { + currentIsEnabledOverlaySmallLog, + currentIsEnabledOverlayLargeLog, + } = useVr(); const onClickFunction = () => { updateOpenedQuickSetting("overlay"); @@ -50,7 +52,7 @@ const OpenOverlayQuickSetting = () => { ); }; const PluginsQuickSetting = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const { updateOpenedQuickSetting } = useStore_OpenedQuickSetting(); const onClickFunction = () => { @@ -66,9 +68,9 @@ const PluginsQuickSetting = () => { }; const OpenVrcMicMuteSyncQuickSetting = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const { updateOpenedQuickSetting } = useStore_OpenedQuickSetting(); - const { currentEnableVrcMicMuteSync } = useEnableVrcMicMuteSync(); + const { currentEnableVrcMicMuteSync } = useOthers(); const onClickFunction = () => { updateOpenedQuickSetting("vrc_mic_mute_sync"); @@ -85,7 +87,7 @@ const OpenVrcMicMuteSyncQuickSetting = () => { const SoftwareUpdateAvailableButton = () => { const { currentLatestSoftwareVersionInfo } = useSoftwareVersion(); - const { t } = useTranslation(); + const { t } = useI18n(); if (currentLatestSoftwareVersionInfo.data.is_update_available === false) return null; const { updateOpenedQuickSetting } = useStore_OpenedQuickSetting(); diff --git a/src-ui/app/main_page/main_section/top_bar/right_side_components/_buttons/OpenQuickSettingButton.jsx b/src-ui/app/main_page/main_section/top_bar/right_side_components/_buttons/OpenQuickSettingButton.jsx index abc779e3..c24f40f4 100644 --- a/src-ui/app/main_page/main_section/top_bar/right_side_components/_buttons/OpenQuickSettingButton.jsx +++ b/src-ui/app/main_page/main_section/top_bar/right_side_components/_buttons/OpenQuickSettingButton.jsx @@ -1,9 +1,9 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import clsx from "clsx"; import styles from "./OpenQuickSettingButton.module.scss"; export const OpenQuickSettingButton = (props) => { - const { t } = useTranslation(); + const { t } = useI18n(); const variable = (typeof props.variable === "boolean") ? props.variable : null; return (
diff --git a/src-ui/app/main_page/sidebar_section/language_settings/LanguageSettings.jsx b/src-ui/app/main_page/sidebar_section/language_settings/LanguageSettings.jsx index 7d90bdf4..4665896f 100644 --- a/src-ui/app/main_page/sidebar_section/language_settings/LanguageSettings.jsx +++ b/src-ui/app/main_page/sidebar_section/language_settings/LanguageSettings.jsx @@ -1,4 +1,4 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import styles from "./LanguageSettings.module.scss"; import { PresetTabSelector } from "./preset_tab_selector/PresetTabSelector"; import { LanguageSelectorOpenButton } from "./language_selector_open_button/LanguageSelectorOpenButton"; @@ -8,7 +8,7 @@ import { AddRemoveTargetLanguageButtons } from "./add_remove_target_language_but import { useStore_IsOpenedTranslatorSelector } from "@store"; export const LanguageSettings = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const { updateIsOpenedTranslatorSelector } = useStore_IsOpenedTranslatorSelector(); const closeTranslatorSelector = () => updateIsOpenedTranslatorSelector(false); @@ -26,7 +26,7 @@ import HeadphonesSvg from "@images/headphones.svg?react"; import { useMainFunction } from "@logics_main"; const PresetContainer = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const { currentTranscriptionSendStatus, currentTranscriptionReceiveStatus } = useMainFunction(); const yourLanguageSettings = { diff --git a/src-ui/app/main_page/sidebar_section/language_settings/language_selector_open_button/LanguageSelectorOpenButton.jsx b/src-ui/app/main_page/sidebar_section/language_settings/language_selector_open_button/LanguageSelectorOpenButton.jsx index eacbf8f4..e6098a3f 100644 --- a/src-ui/app/main_page/sidebar_section/language_settings/language_selector_open_button/LanguageSelectorOpenButton.jsx +++ b/src-ui/app/main_page/sidebar_section/language_settings/language_selector_open_button/LanguageSelectorOpenButton.jsx @@ -1,4 +1,4 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import clsx from "clsx"; import styles from "./LanguageSelectorOpenButton.module.scss"; import ArrowLeftSvg from "@images/arrow_left.svg?react"; @@ -8,7 +8,7 @@ import { } from "@logics_main"; export const LanguageSelectorOpenButton = ({ TurnedOnSvgComponent, is_turned_on, selector_key, target_key }) => { - const { t } = useTranslation(); + const { t } = useI18n(); const { updateIsOpenedLanguageSelector, currentIsOpenedLanguageSelector } = useStore_IsOpenedLanguageSelector(); const { diff --git a/src-ui/app/main_page/sidebar_section/language_settings/language_swap_button/LanguageSwapButton.jsx b/src-ui/app/main_page/sidebar_section/language_settings/language_swap_button/LanguageSwapButton.jsx index ef8d7c0b..0c953f96 100644 --- a/src-ui/app/main_page/sidebar_section/language_settings/language_swap_button/LanguageSwapButton.jsx +++ b/src-ui/app/main_page/sidebar_section/language_settings/language_swap_button/LanguageSwapButton.jsx @@ -1,6 +1,6 @@ import { useState } from "react"; import clsx from "clsx"; -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import styles from "./LanguageSwapButton.module.scss"; @@ -9,7 +9,7 @@ import { useLanguageSettings } from "@logics_main"; export const LanguageSwapButton = () => { const [isHovered, setIsHovered] = useState(false); - const { t } = useTranslation(); + const { t } = useI18n(); const { swapSelectedLanguages } = useLanguageSettings(); const label = isHovered diff --git a/src-ui/app/main_page/sidebar_section/language_settings/translator_selector_open_button/TranslatorSelectorOpenButton.jsx b/src-ui/app/main_page/sidebar_section/language_settings/translator_selector_open_button/TranslatorSelectorOpenButton.jsx index 7a869e8a..773aab96 100644 --- a/src-ui/app/main_page/sidebar_section/language_settings/translator_selector_open_button/TranslatorSelectorOpenButton.jsx +++ b/src-ui/app/main_page/sidebar_section/language_settings/translator_selector_open_button/TranslatorSelectorOpenButton.jsx @@ -1,4 +1,4 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import { updateLabelsById } from "@utils"; import styles from "./TranslatorSelectorOpenButton.module.scss"; import { TranslatorSelector } from "./translator_selector/TranslatorSelector"; @@ -7,7 +7,7 @@ import { useLanguageSettings } from "@logics_main"; import WarningSvg from "@images/warning.svg?react"; export const TranslatorSelectorOpenButton = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const { currentSelectedYourLanguages, currentSelectedTargetLanguages, diff --git a/src-ui/app/main_page/sidebar_section/language_settings/translator_selector_open_button/translator_selector/TranslatorSelector.jsx b/src-ui/app/main_page/sidebar_section/language_settings/translator_selector_open_button/translator_selector/TranslatorSelector.jsx index cdbc159e..094c9255 100644 --- a/src-ui/app/main_page/sidebar_section/language_settings/translator_selector_open_button/translator_selector/TranslatorSelector.jsx +++ b/src-ui/app/main_page/sidebar_section/language_settings/translator_selector_open_button/translator_selector/TranslatorSelector.jsx @@ -1,12 +1,13 @@ import clsx from "clsx"; import styles from "./TranslatorSelector.module.scss"; -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import { chunkArray } from "@utils"; import { useStore_IsOpenedTranslatorSelector } from "@store"; import { useLanguageSettings } from "@logics_main"; -export const TranslatorSelector = ({selected_id, translation_engines, is_selected_same_language}) => { const { t } = useTranslation(); +export const TranslatorSelector = ({selected_id, translation_engines, is_selected_same_language}) => { + const { t } = useI18n(); const columns = chunkArray(translation_engines, 2); return ( @@ -46,7 +47,7 @@ export const TranslatorSelector = ({selected_id, translation_engines, is_selecte }; const TranslatorBox = (props) => { - const { t } = useTranslation(); + const { t } = useI18n(); const { setSelectedTranslationEngines} = useLanguageSettings(); const { updateIsOpenedTranslatorSelector} = useStore_IsOpenedTranslatorSelector(); diff --git a/src-ui/app/main_page/sidebar_section/main_function_switch/MainFunctionSwitch.jsx b/src-ui/app/main_page/sidebar_section/main_function_switch/MainFunctionSwitch.jsx index 991239f8..b3f031b6 100644 --- a/src-ui/app/main_page/sidebar_section/main_function_switch/MainFunctionSwitch.jsx +++ b/src-ui/app/main_page/sidebar_section/main_function_switch/MainFunctionSwitch.jsx @@ -1,4 +1,4 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import clsx from "clsx"; import styles from "./MainFunctionSwitch.module.scss"; import TranslationSvg from "@images/translation.svg?react"; @@ -11,7 +11,7 @@ import { } from "@logics_main"; export const MainFunctionSwitch = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const { toggleTranslation, currentTranslationStatus, diff --git a/src-ui/app/others/modal_controller/update_modal/UpdateModal.jsx b/src-ui/app/others/modal_controller/update_modal/UpdateModal.jsx index dd8f0f43..11198da7 100644 --- a/src-ui/app/others/modal_controller/update_modal/UpdateModal.jsx +++ b/src-ui/app/others/modal_controller/update_modal/UpdateModal.jsx @@ -1,6 +1,6 @@ import clsx from "clsx"; import styles from "./UpdateModal.module.scss"; -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import { useStore_OpenedQuickSetting } from "@store"; import { usePlugins } from "@logics_configs"; import { @@ -13,7 +13,7 @@ import { import { PluginCompatibilityList } from "./plugins_compatibility_list/PluginCompatibilityList"; export const UpdateModal = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const { updateOpenedQuickSetting } = useStore_OpenedQuickSetting(); const { updateSoftware, updateSoftware_CUDA } = useUpdateSoftware(); const { updateIsSoftwareUpdating } = useIsSoftwareUpdating(); @@ -91,7 +91,7 @@ const VersionDescComponent = (props) => { }; const CurrentVersionLabel = (props) => { - const { t } = useTranslation(); + const { t } = useI18n(); if (props.is_latest_version_already) { return

{t("update_modal.is_latest_version_already")}

; diff --git a/src-ui/app/others/splash_component/download_models_container/DownloadModelsContainer.jsx b/src-ui/app/others/splash_component/download_models_container/DownloadModelsContainer.jsx index 9e3d8e67..9f1768f1 100644 --- a/src-ui/app/others/splash_component/download_models_container/DownloadModelsContainer.jsx +++ b/src-ui/app/others/splash_component/download_models_container/DownloadModelsContainer.jsx @@ -3,13 +3,13 @@ import vrct_logo_for_dark_mode from "@images/vrct_logo_for_dark_mode.png"; import vrct_now_downloading from "@images/VRCT_now_downloading.png"; import { - useCTranslate2WeightTypeStatus, - useWhisperWeightTypeStatus, + useTranslation, + useTranscription, } from "@logics_configs"; export const DownloadModelsContainer = () => { - const { currentCTranslate2WeightTypeStatus } = useCTranslate2WeightTypeStatus(); - const { currentWhisperWeightTypeStatus } = useWhisperWeightTypeStatus(); + const { currentCTranslate2WeightTypeStatus } = useTranslation(); + const { currentWhisperWeightTypeStatus } = useTranscription(); const c_translate_2 = currentCTranslate2WeightTypeStatus.data.find(d => d.id === "small"); const whisper = currentWhisperWeightTypeStatus.data.find(d => d.id === "base"); diff --git a/src-ui/app/others/updating_component/UpdatingComponent.jsx b/src-ui/app/others/updating_component/UpdatingComponent.jsx index 5dce4765..df362623 100644 --- a/src-ui/app/others/updating_component/UpdatingComponent.jsx +++ b/src-ui/app/others/updating_component/UpdatingComponent.jsx @@ -1,10 +1,10 @@ import styles from "./UpdatingComponent.module.scss"; -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import CircularProgress from "@mui/material/CircularProgress"; import chat_white_square from "@images/chato_white_square.png"; export const UpdatingComponent = () => { - const { t } = useTranslation(); + const { t } = useI18n(); return (
diff --git a/src-ui/logics/_useBackendErrorHandling.js b/src-ui/logics/_useBackendErrorHandling.js index e44b293c..83819883 100644 --- a/src-ui/logics/_useBackendErrorHandling.js +++ b/src-ui/logics/_useBackendErrorHandling.js @@ -1,4 +1,4 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import { useNotificationStatus, @@ -9,43 +9,42 @@ import { } from "@logics_main"; import { - useMicRecordTimeout, - useMicPhraseTimeout, - useMicMaxWords, + useTranscription, - useSpeakerRecordTimeout, - useSpeakerPhraseTimeout, - useSpeakerMaxWords, + useTranslation, - useDeepLAuthKey, + useOthers, - useEnableVrcMicMuteSync, - - useOscIpAddress, - useWebsocket, + useAdvancedSettings, } from "@logics_configs"; import { ui_configs } from "../ui_configs"; export const _useBackendErrorHandling = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const { showNotification_Error } = useNotificationStatus(); + const { + updateMicRecordTimeout, + updateMicPhraseTimeout, + updateMicMaxWords, + + updateSpeakerRecordTimeout, + updateSpeakerPhraseTimeout, + updateSpeakerMaxWords, + } = useTranscription(); + const { updateTranslationStatus, updateTranscriptionSendStatus, updateTranscriptionReceiveStatus } = useMainFunction(); - const { updateMicRecordTimeout } = useMicRecordTimeout(); - const { updateMicPhraseTimeout } = useMicPhraseTimeout(); - const { updateMicMaxWords } = useMicMaxWords(); + const { updateDeepLAuthKey } = useTranslation(); - const { updateSpeakerRecordTimeout } = useSpeakerRecordTimeout(); - const { updateSpeakerPhraseTimeout } = useSpeakerPhraseTimeout(); - const { updateSpeakerMaxWords } = useSpeakerMaxWords(); + const { updateEnableVrcMicMuteSync } = useOthers(); - const { updateDeepLAuthKey } = useDeepLAuthKey(); - - const { updateEnableVrcMicMuteSync } = useEnableVrcMicMuteSync(); - - const { updateOscIpAddress } = useOscIpAddress(); - const { updateEnableWebsocket, updateWebsocketHost, updateWebsocketPort } = useWebsocket(); + const { + updateOscIpAddress, + updateEnableWebsocket, + updateWebsocketHost, + updateWebsocketPort, + } = useAdvancedSettings(); const errorHandling_Backend = ({message, data, endpoint, result}) => { switch (endpoint) { diff --git a/src-ui/logics/common/useHandleOscQuery.js b/src-ui/logics/common/useHandleOscQuery.js index dace04d5..f952aaac 100644 --- a/src-ui/logics/common/useHandleOscQuery.js +++ b/src-ui/logics/common/useHandleOscQuery.js @@ -1,11 +1,11 @@ -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import { useNotificationStatus } from "@logics_common"; -import { useEnableVrcMicMuteSync } from "@logics_configs"; +import { useOthers } from "@logics_configs"; export const useHandleOscQuery = () => { - const { t } = useTranslation(); + const { t } = useI18n(); const { showNotification_Warning } = useNotificationStatus(); - const { updateEnableVrcMicMuteSync } = useEnableVrcMicMuteSync(); + const { updateEnableVrcMicMuteSync } = useOthers(); const handleOscQuery = (payload) => { const is_osc_query_enabled = payload.data; diff --git a/src-ui/logics/common/useWindow.js b/src-ui/logics/common/useWindow.js index 9585d0df..3e7f4059 100644 --- a/src-ui/logics/common/useWindow.js +++ b/src-ui/logics/common/useWindow.js @@ -2,12 +2,12 @@ import { useEffect, useRef } from "react"; import { currentMonitor, availableMonitors, PhysicalPosition, PhysicalSize } from "@tauri-apps/api/window"; import { useStdoutToPython } from "@useStdoutToPython"; import { useStore_IsBreakPoint } from "@store"; -import { useUiScaling } from "@logics_configs"; +import { useAppearance } from "@logics_configs"; import { store } from "@store"; export const useWindow = () => { const { asyncStdoutToPython } = useStdoutToPython(); - const { currentUiScaling } = useUiScaling(); + const { currentUiScaling } = useAppearance(); const { updateIsBreakPoint } = useStore_IsBreakPoint(); const appWindow = store.appWindow; diff --git a/src-ui/logics/configs/advanced_settings/useWebsocket.js b/src-ui/logics/configs/advanced_settings/useAdvancedSettings.js similarity index 54% rename from src-ui/logics/configs/advanced_settings/useWebsocket.js rename to src-ui/logics/configs/advanced_settings/useAdvancedSettings.js index 2002b78d..327a15a6 100644 --- a/src-ui/logics/configs/advanced_settings/useWebsocket.js +++ b/src-ui/logics/configs/advanced_settings/useAdvancedSettings.js @@ -1,16 +1,54 @@ import { + useStore_OscIpAddress, + useStore_OscPort, useStore_EnableWebsocket, useStore_WebsocketHost, useStore_WebsocketPort, } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; +import { useNotificationStatus } from "@logics_common"; -export const useWebsocket = () => { +export const useAdvancedSettings = () => { const { asyncStdoutToPython } = useStdoutToPython(); + const { showNotification_Error } = useNotificationStatus(); + + // OSC IP Address + const { currentOscIpAddress, updateOscIpAddress, pendingOscIpAddress } = useStore_OscIpAddress(); + // OSC Port + const { currentOscPort, updateOscPort, pendingOscPort } = useStore_OscPort(); + // WebSocket const { currentEnableWebsocket, updateEnableWebsocket, pendingEnableWebsocket } = useStore_EnableWebsocket(); const { currentWebsocketHost, updateWebsocketHost, pendingWebsocketHost } = useStore_WebsocketHost(); const { currentWebsocketPort, updateWebsocketPort, pendingWebsocketPort } = useStore_WebsocketPort(); + // OSC IP Address + const getOscIpAddress = () => { + pendingOscIpAddress(); + asyncStdoutToPython("/get/data/osc_ip_address"); + }; + + const setOscIpAddress = (osc_ip_address) => { + pendingOscIpAddress(); + asyncStdoutToPython("/set/data/osc_ip_address", osc_ip_address); + }; + + // OSC Port + const getOscPort = () => { + pendingOscPort(); + asyncStdoutToPython("/get/data/osc_port"); + }; + + const setOscPort = (osc_port) => { + pendingOscPort(); + asyncStdoutToPython("/set/data/osc_port", osc_port); + }; + + const saveErrorOscPort = ({data, message, _result}) => { + updateOscPort(d => d.data); + showNotification_Error(_result); + }; + + // WebSocket const getEnableWebsocket = () => { pendingEnableWebsocket(); asyncStdoutToPython("/get/data/websocket_server"); @@ -47,7 +85,22 @@ export const useWebsocket = () => { asyncStdoutToPython("/set/data/websocket_port", websocket_port); }; + return { + // OSC IP Address + currentOscIpAddress, + getOscIpAddress, + updateOscIpAddress, + setOscIpAddress, + + // OSC Port + currentOscPort, + getOscPort, + updateOscPort, + setOscPort, + saveErrorOscPort, + + // WebSocket currentEnableWebsocket, updateEnableWebsocket, getEnableWebsocket, @@ -62,6 +115,5 @@ export const useWebsocket = () => { updateWebsocketPort, getWebsocketPort, setWebsocketPort, - }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/advanced_settings/useOscIpAddress.js b/src-ui/logics/configs/advanced_settings/useOscIpAddress.js deleted file mode 100644 index 8fe1ae06..00000000 --- a/src-ui/logics/configs/advanced_settings/useOscIpAddress.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_OscIpAddress } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useOscIpAddress = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentOscIpAddress, updateOscIpAddress, pendingOscIpAddress } = useStore_OscIpAddress(); - - const getOscIpAddress = () => { - pendingOscIpAddress(); - asyncStdoutToPython("/get/data/osc_ip_address"); - }; - - const setOscIpAddress = (osc_ip_address) => { - pendingOscIpAddress(); - asyncStdoutToPython("/set/data/osc_ip_address", osc_ip_address); - }; - - return { - currentOscIpAddress, - getOscIpAddress, - updateOscIpAddress, - setOscIpAddress, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/advanced_settings/useOscPort.js b/src-ui/logics/configs/advanced_settings/useOscPort.js deleted file mode 100644 index 0710021c..00000000 --- a/src-ui/logics/configs/advanced_settings/useOscPort.js +++ /dev/null @@ -1,33 +0,0 @@ -import { useStore_OscPort } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; -import { useNotificationStatus } from "@logics_common"; - -export const useOscPort = () => { - const { showNotification_Error } = useNotificationStatus(); - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentOscPort, updateOscPort, pendingOscPort } = useStore_OscPort(); - - const getOscPort = () => { - pendingOscPort(); - asyncStdoutToPython("/get/data/osc_port"); - }; - - const setOscPort = (osc_port) => { - pendingOscPort(); - asyncStdoutToPython("/set/data/osc_port", osc_port); - }; - - const saveErrorOscPort = ({data, message, _result}) => { - updateOscPort(d => d.data); - showNotification_Error(_result); - }; - - return { - currentOscPort, - getOscPort, - updateOscPort, - setOscPort, - - saveErrorOscPort, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/appearance/useAppearance.js b/src-ui/logics/configs/appearance/useAppearance.js new file mode 100644 index 00000000..582ebf73 --- /dev/null +++ b/src-ui/logics/configs/appearance/useAppearance.js @@ -0,0 +1,156 @@ +import { + useStore_UiLanguage, + useStore_UiScaling, + useStore_MessageLogUiScaling, + useStore_SendMessageButtonType, + useStore_ShowResendButton, + useStore_SelectedFontFamily, + useStore_Transparency, +} from "@store"; +import { useStdoutToPython } from "@useStdoutToPython"; + +export const useAppearance = () => { + const { asyncStdoutToPython } = useStdoutToPython(); + + // UI Language + const { currentUiLanguage, updateUiLanguage, pendingUiLanguage } = useStore_UiLanguage(); + // UI Scaling + const { currentUiScaling, updateUiScaling, pendingUiScaling } = useStore_UiScaling(); + // Message Log Ui Scaling + const { currentMessageLogUiScaling, updateMessageLogUiScaling, pendingMessageLogUiScaling } = useStore_MessageLogUiScaling(); + // Send Message Button Type + const { currentSendMessageButtonType, updateSendMessageButtonType, pendingSendMessageButtonType } = useStore_SendMessageButtonType(); + // Show Resend Button + const { currentShowResendButton, updateShowResendButton, pendingShowResendButton } = useStore_ShowResendButton(); + // Selected Font Family + const { currentSelectedFontFamily, updateSelectedFontFamily, pendingSelectedFontFamily } = useStore_SelectedFontFamily(); + // Transparency + const { currentTransparency, updateTransparency, pendingTransparency } = useStore_Transparency(); + + + // UI Language + const getUiLanguage = () => { + pendingUiLanguage(); + asyncStdoutToPython("/get/data/ui_language"); + }; + + const setUiLanguage = (selected_ui_language) => { + pendingUiLanguage(); + asyncStdoutToPython("/set/data/ui_language", selected_ui_language); + }; + + // UI Scaling + const getUiScaling = () => { + pendingUiScaling(); + asyncStdoutToPython("/get/data/ui_scaling"); + }; + + const setUiScaling = (selected_ui_scaling) => { + pendingUiScaling(); + asyncStdoutToPython("/set/data/ui_scaling", selected_ui_scaling); + }; + + // Message Log Ui Scaling + const getMessageLogUiScaling = () => { + pendingMessageLogUiScaling(); + asyncStdoutToPython("/get/data/textbox_ui_scaling"); + }; + + const setMessageLogUiScaling = (selected_ui_scaling) => { + pendingMessageLogUiScaling(); + asyncStdoutToPython("/set/data/textbox_ui_scaling", selected_ui_scaling); + }; + + // Send Message Button Type + const getSendMessageButtonType = () => { + pendingSendMessageButtonType(); + asyncStdoutToPython("/get/data/send_message_button_type"); + }; + + const setSendMessageButtonType = (send_message_button_type) => { + pendingSendMessageButtonType(); + asyncStdoutToPython("/set/data/send_message_button_type", send_message_button_type); + }; + + // Show Resend Button + const getShowResendButton = () => { + pendingShowResendButton(); + asyncStdoutToPython("/get/data/show_resend_button"); + }; + + const toggleShowResendButton = () => { + pendingShowResendButton(); + if (currentShowResendButton.data) { + asyncStdoutToPython("/set/disable/show_resend_button"); + } else { + asyncStdoutToPython("/set/enable/show_resend_button"); + } + }; + + // Selected Font Family + const getSelectedFontFamily = () => { + pendingSelectedFontFamily(); + asyncStdoutToPython("/get/data/font_family"); + }; + + const setSelectedFontFamily = (selected_font_family) => { + pendingSelectedFontFamily(); + asyncStdoutToPython("/set/data/font_family", selected_font_family); + }; + + // Transparency + const getTransparency = () => { + pendingTransparency(); + asyncStdoutToPython("/get/data/transparency"); + }; + + const setTransparency = (selected_transparency) => { + pendingTransparency(); + asyncStdoutToPython("/set/data/transparency", selected_transparency); + }; + + + return { + // UI Language + currentUiLanguage, + getUiLanguage, + updateUiLanguage, + setUiLanguage, + + // UI Scaling + currentUiScaling, + getUiScaling, + updateUiScaling, + setUiScaling, + + // Message Log Ui Scaling + currentMessageLogUiScaling, + getMessageLogUiScaling, + updateMessageLogUiScaling, + setMessageLogUiScaling, + + // Send Message Button Type + currentSendMessageButtonType, + getSendMessageButtonType, + setSendMessageButtonType, + updateSendMessageButtonType, + + // Show Resend Button + currentShowResendButton, + getShowResendButton, + updateShowResendButton, + toggleShowResendButton, + + // Selected Font Family + currentSelectedFontFamily, + getSelectedFontFamily, + updateSelectedFontFamily, + setSelectedFontFamily, + + // Transparency + currentTransparency, + getTransparency, + updateTransparency, + setTransparency, + }; +}; \ No newline at end of file diff --git a/src-ui/logics/configs/appearance/useMessageLogUiScaling.js b/src-ui/logics/configs/appearance/useMessageLogUiScaling.js deleted file mode 100644 index 2833774f..00000000 --- a/src-ui/logics/configs/appearance/useMessageLogUiScaling.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_MessageLogUiScaling } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useMessageLogUiScaling = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentMessageLogUiScaling, updateMessageLogUiScaling, pendingMessageLogUiScaling } = useStore_MessageLogUiScaling(); - - const getMessageLogUiScaling = () => { - pendingMessageLogUiScaling(); - asyncStdoutToPython("/get/data/textbox_ui_scaling"); - }; - - const setMessageLogUiScaling = (selected_ui_scaling) => { - pendingMessageLogUiScaling(); - asyncStdoutToPython("/set/data/textbox_ui_scaling", selected_ui_scaling); - }; - - return { - currentMessageLogUiScaling, - getMessageLogUiScaling, - updateMessageLogUiScaling, - setMessageLogUiScaling, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/appearance/useSelectedFontFamily.js b/src-ui/logics/configs/appearance/useSelectedFontFamily.js deleted file mode 100644 index 538ef462..00000000 --- a/src-ui/logics/configs/appearance/useSelectedFontFamily.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_SelectedFontFamily } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useSelectedFontFamily = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSelectedFontFamily, updateSelectedFontFamily, pendingSelectedFontFamily } = useStore_SelectedFontFamily(); - - const getSelectedFontFamily = () => { - pendingSelectedFontFamily(); - asyncStdoutToPython("/get/data/font_family"); - }; - - const setSelectedFontFamily = (selected_font_family) => { - pendingSelectedFontFamily(); - asyncStdoutToPython("/set/data/font_family", selected_font_family); - }; - - return { - currentSelectedFontFamily, - getSelectedFontFamily, - updateSelectedFontFamily, - setSelectedFontFamily, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/appearance/useSendMessageButtonType.js b/src-ui/logics/configs/appearance/useSendMessageButtonType.js deleted file mode 100644 index 621c7dbc..00000000 --- a/src-ui/logics/configs/appearance/useSendMessageButtonType.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_SendMessageButtonType } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useSendMessageButtonType = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSendMessageButtonType, updateSendMessageButtonType, pendingSendMessageButtonType } = useStore_SendMessageButtonType(); - - const getSendMessageButtonType = () => { - pendingSendMessageButtonType(); - asyncStdoutToPython("/get/data/send_message_button_type"); - }; - - const setSendMessageButtonType = (send_message_button_type) => { - pendingSendMessageButtonType(); - asyncStdoutToPython("/set/data/send_message_button_type", send_message_button_type); - }; - - return { - currentSendMessageButtonType, - getSendMessageButtonType, - setSendMessageButtonType, - updateSendMessageButtonType, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/appearance/useShowResendButton.js b/src-ui/logics/configs/appearance/useShowResendButton.js deleted file mode 100644 index 10a9fd00..00000000 --- a/src-ui/logics/configs/appearance/useShowResendButton.js +++ /dev/null @@ -1,28 +0,0 @@ -import { useStore_ShowResendButton } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useShowResendButton = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentShowResendButton, updateShowResendButton, pendingShowResendButton } = useStore_ShowResendButton(); - - const getShowResendButton = () => { - pendingShowResendButton(); - asyncStdoutToPython("/get/data/show_resend_button"); - }; - - const toggleShowResendButton = () => { - pendingShowResendButton(); - if (currentShowResendButton.data) { - asyncStdoutToPython("/set/disable/show_resend_button"); - } else { - asyncStdoutToPython("/set/enable/show_resend_button"); - } - }; - - return { - currentShowResendButton, - getShowResendButton, - updateShowResendButton, - toggleShowResendButton, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/appearance/useTransparency.js b/src-ui/logics/configs/appearance/useTransparency.js deleted file mode 100644 index 4c719503..00000000 --- a/src-ui/logics/configs/appearance/useTransparency.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_Transparency } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useTransparency = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentTransparency, updateTransparency, pendingTransparency } = useStore_Transparency(); - - const getTransparency = () => { - pendingTransparency(); - asyncStdoutToPython("/get/data/transparency"); - }; - - const setTransparency = (selected_transparency) => { - pendingTransparency(); - asyncStdoutToPython("/set/data/transparency", selected_transparency); - }; - - return { - currentTransparency, - getTransparency, - updateTransparency, - setTransparency, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/appearance/useUiLanguage.js b/src-ui/logics/configs/appearance/useUiLanguage.js deleted file mode 100644 index bb3a5b39..00000000 --- a/src-ui/logics/configs/appearance/useUiLanguage.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_UiLanguage } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useUiLanguage = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentUiLanguage, updateUiLanguage, pendingUiLanguage } = useStore_UiLanguage(); - - const getUiLanguage = () => { - pendingUiLanguage(); - asyncStdoutToPython("/get/data/ui_language"); - }; - - const setUiLanguage = (selected_ui_language) => { - pendingUiLanguage(); - asyncStdoutToPython("/set/data/ui_language", selected_ui_language); - }; - - return { - currentUiLanguage, - getUiLanguage, - updateUiLanguage, - setUiLanguage, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/appearance/useUiScaling.js b/src-ui/logics/configs/appearance/useUiScaling.js deleted file mode 100644 index e5d75e1d..00000000 --- a/src-ui/logics/configs/appearance/useUiScaling.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_UiScaling } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useUiScaling = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentUiScaling, updateUiScaling, pendingUiScaling } = useStore_UiScaling(); - - const getUiScaling = () => { - pendingUiScaling(); - asyncStdoutToPython("/get/data/ui_scaling"); - }; - - const setUiScaling = (selected_ui_scaling) => { - pendingUiScaling(); - asyncStdoutToPython("/set/data/ui_scaling", selected_ui_scaling); - }; - - return { - currentUiScaling, - getUiScaling, - updateUiScaling, - setUiScaling, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/index.js b/src-ui/logics/configs/index.js index 9ffc7145..54e7d133 100644 --- a/src-ui/logics/configs/index.js +++ b/src-ui/logics/configs/index.js @@ -1,58 +1,12 @@ export { useDevice } from "./device/useDevice"; - -export { useMessageLogUiScaling } from "./appearance/useMessageLogUiScaling"; -export { useSelectedFontFamily } from "./appearance/useSelectedFontFamily"; -export { useTransparency } from "./appearance/useTransparency"; -export { useSendMessageButtonType } from "./appearance/useSendMessageButtonType"; -export { useShowResendButton } from "./appearance/useShowResendButton"; -export { useUiLanguage } from "./appearance/useUiLanguage"; -export { useUiScaling } from "./appearance/useUiScaling"; - -export { useEnableAutoClearMessageInputBox } from "./others/useEnableAutoClearMessageInputBox"; -export { useEnableAutoExportMessageLogs } from "./others/useEnableAutoExportMessageLogs"; -export { useEnableSendMessageToVrc } from "./others/useEnableSendMessageToVrc"; -export { useEnableSendReceivedMessageToVrc } from "./others/useEnableSendReceivedMessageToVrc"; -export { useEnableSendOnlyTranslatedMessages } from "./others/useEnableSendOnlyTranslatedMessages"; -export { useEnableVrcMicMuteSync } from "./others/useEnableVrcMicMuteSync"; -export { useEnableNotificationVrcSfx } from "./others/useEnableNotificationVrcSfx"; - -export { useMicRecordTimeout } from "./transcription/useMicRecordTimeout"; -export { useMicPhraseTimeout } from "./transcription/useMicPhraseTimeout"; -export { useMicMaxWords } from "./transcription/useMicMaxWords"; -export { useMicWordFilterList } from "./transcription/useMicWordFilterList"; - -export { useSpeakerRecordTimeout } from "./transcription/useSpeakerRecordTimeout"; -export { useSpeakerPhraseTimeout } from "./transcription/useSpeakerPhraseTimeout"; -export { useSpeakerMaxWords } from "./transcription/useSpeakerMaxWords"; - -export { useSelectedTranscriptionEngine } from "./transcription/useSelectedTranscriptionEngine"; -export { useWhisperWeightTypeStatus } from "./transcription/useWhisperWeightTypeStatus"; -export { useSelectedWhisperWeightType } from "./transcription/useSelectedWhisperWeightType"; -export { useSelectableWhisperComputeDeviceList } from "./transcription/useSelectableWhisperComputeDeviceList"; -export { useSelectedWhisperComputeDevice } from "./transcription/useSelectedWhisperComputeDevice"; - -export { useDeepLAuthKey } from "./translation/useDeepLAuthKey"; -export { useCTranslate2WeightTypeStatus } from "./translation/useCTranslate2WeightTypeStatus"; -export { useSelectedCTranslate2WeightType } from "./translation/useSelectedCTranslate2WeightType"; -export { useSelectableCTranslate2ComputeDeviceList } from "./translation/useSelectableCTranslate2ComputeDeviceList"; -export { useSelectedCTranslate2ComputeDevice } from "./translation/useSelectedCTranslate2ComputeDevice"; - -export { useIsEnabledOverlaySmallLog } from "./vr/useIsEnabledOverlaySmallLog"; -export { useOverlaySmallLogSettings } from "./vr/useOverlaySmallLogSettings"; -export { useIsEnabledOverlayLargeLog } from "./vr/useIsEnabledOverlayLargeLog"; -export { useOverlayShowOnlyTranslatedMessages } from "./vr/useOverlayShowOnlyTranslatedMessages"; -export { useOverlayLargeLogSettings } from "./vr/useOverlayLargeLogSettings"; -export { useSendTextToOverlay } from "./vr/useSendTextToOverlay"; - +export { useAppearance } from "./appearance/useAppearance"; +export { useOthers } from "./others/useOthers"; +export { useTranscription } from "./transcription/useTranscription"; +export { useTranslation } from "./translation/useTranslation"; +export { useVr } from "./vr/useVr"; export { useHotkeys } from "./hotkeys/useHotkeys"; - -export { useOscIpAddress } from "./advanced_settings/useOscIpAddress"; -export { useOscPort } from "./advanced_settings/useOscPort"; -export { useWebsocket } from "./advanced_settings/useWebsocket"; - - +export { useAdvancedSettings } from "./advanced_settings/useAdvancedSettings"; export { useSupporters } from "./supporters/useSupporters"; - export { usePlugins } from "./plugins/usePlugins"; export { useSettingBoxScrollPosition } from "./useSettingBoxScrollPosition"; \ No newline at end of file diff --git a/src-ui/logics/configs/others/useEnableAutoClearMessageInputBox.js b/src-ui/logics/configs/others/useEnableAutoClearMessageInputBox.js deleted file mode 100644 index 6508990c..00000000 --- a/src-ui/logics/configs/others/useEnableAutoClearMessageInputBox.js +++ /dev/null @@ -1,28 +0,0 @@ -import { useStore_EnableAutoClearMessageInputBox } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useEnableAutoClearMessageInputBox = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentEnableAutoClearMessageInputBox, updateEnableAutoClearMessageInputBox, pendingEnableAutoClearMessageInputBox } = useStore_EnableAutoClearMessageInputBox(); - - const getEnableAutoClearMessageInputBox = () => { - pendingEnableAutoClearMessageInputBox(); - asyncStdoutToPython("/get/data/auto_clear_message_box"); - }; - - const toggleEnableAutoClearMessageInputBox = () => { - pendingEnableAutoClearMessageInputBox(); - if (currentEnableAutoClearMessageInputBox.data) { - asyncStdoutToPython("/set/disable/auto_clear_message_box"); - } else { - asyncStdoutToPython("/set/enable/auto_clear_message_box"); - } - }; - - return { - currentEnableAutoClearMessageInputBox, - getEnableAutoClearMessageInputBox, - toggleEnableAutoClearMessageInputBox, - updateEnableAutoClearMessageInputBox, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/others/useEnableAutoExportMessageLogs.js b/src-ui/logics/configs/others/useEnableAutoExportMessageLogs.js deleted file mode 100644 index e9faab35..00000000 --- a/src-ui/logics/configs/others/useEnableAutoExportMessageLogs.js +++ /dev/null @@ -1,28 +0,0 @@ -import { useStore_EnableAutoExportMessageLogs } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useEnableAutoExportMessageLogs = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentEnableAutoExportMessageLogs, updateEnableAutoExportMessageLogs, pendingEnableAutoExportMessageLogs } = useStore_EnableAutoExportMessageLogs(); - - const getEnableAutoExportMessageLogs = () => { - pendingEnableAutoExportMessageLogs(); - asyncStdoutToPython("/get/data/logger_feature"); - }; - - const toggleEnableAutoExportMessageLogs = () => { - pendingEnableAutoExportMessageLogs(); - if (currentEnableAutoExportMessageLogs.data) { - asyncStdoutToPython("/set/disable/logger_feature"); - } else { - asyncStdoutToPython("/set/enable/logger_feature"); - } - }; - - return { - currentEnableAutoExportMessageLogs, - getEnableAutoExportMessageLogs, - toggleEnableAutoExportMessageLogs, - updateEnableAutoExportMessageLogs, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/others/useEnableNotificationVrcSfx.js b/src-ui/logics/configs/others/useEnableNotificationVrcSfx.js deleted file mode 100644 index 9a001114..00000000 --- a/src-ui/logics/configs/others/useEnableNotificationVrcSfx.js +++ /dev/null @@ -1,28 +0,0 @@ -import { useStore_EnableNotificationVrcSfx } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useEnableNotificationVrcSfx = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentEnableNotificationVrcSfx, updateEnableNotificationVrcSfx, pendingEnableNotificationVrcSfx } = useStore_EnableNotificationVrcSfx(); - - const getEnableNotificationVrcSfx = () => { - pendingEnableNotificationVrcSfx(); - asyncStdoutToPython("/get/data/notification_vrc_sfx"); - }; - - const toggleEnableNotificationVrcSfx = () => { - pendingEnableNotificationVrcSfx(); - if (currentEnableNotificationVrcSfx.data) { - asyncStdoutToPython("/set/disable/notification_vrc_sfx"); - } else { - asyncStdoutToPython("/set/enable/notification_vrc_sfx"); - } - }; - - return { - currentEnableNotificationVrcSfx, - getEnableNotificationVrcSfx, - toggleEnableNotificationVrcSfx, - updateEnableNotificationVrcSfx, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/others/useEnableSendMessageToVrc.js b/src-ui/logics/configs/others/useEnableSendMessageToVrc.js deleted file mode 100644 index 6284dd17..00000000 --- a/src-ui/logics/configs/others/useEnableSendMessageToVrc.js +++ /dev/null @@ -1,28 +0,0 @@ -import { useStore_EnableSendMessageToVrc } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useEnableSendMessageToVrc = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentEnableSendMessageToVrc, updateEnableSendMessageToVrc, pendingEnableSendMessageToVrc } = useStore_EnableSendMessageToVrc(); - - const getEnableSendMessageToVrc = () => { - pendingEnableSendMessageToVrc(); - asyncStdoutToPython("/get/data/send_message_to_vrc"); - }; - - const toggleEnableSendMessageToVrc = () => { - pendingEnableSendMessageToVrc(); - if (currentEnableSendMessageToVrc.data) { - asyncStdoutToPython("/set/disable/send_message_to_vrc"); - } else { - asyncStdoutToPython("/set/enable/send_message_to_vrc"); - } - }; - - return { - currentEnableSendMessageToVrc, - getEnableSendMessageToVrc, - toggleEnableSendMessageToVrc, - updateEnableSendMessageToVrc, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/others/useEnableSendOnlyTranslatedMessages.js b/src-ui/logics/configs/others/useEnableSendOnlyTranslatedMessages.js deleted file mode 100644 index 4ba9d4af..00000000 --- a/src-ui/logics/configs/others/useEnableSendOnlyTranslatedMessages.js +++ /dev/null @@ -1,28 +0,0 @@ -import { useStore_EnableSendOnlyTranslatedMessages } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useEnableSendOnlyTranslatedMessages = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentEnableSendOnlyTranslatedMessages, updateEnableSendOnlyTranslatedMessages, pendingEnableSendOnlyTranslatedMessages } = useStore_EnableSendOnlyTranslatedMessages(); - - const getEnableSendOnlyTranslatedMessages = () => { - pendingEnableSendOnlyTranslatedMessages(); - asyncStdoutToPython("/get/data/send_only_translated_messages"); - }; - - const toggleEnableSendOnlyTranslatedMessages = () => { - pendingEnableSendOnlyTranslatedMessages(); - if (currentEnableSendOnlyTranslatedMessages.data) { - asyncStdoutToPython("/set/disable/send_only_translated_messages"); - } else { - asyncStdoutToPython("/set/enable/send_only_translated_messages"); - } - }; - - return { - currentEnableSendOnlyTranslatedMessages, - getEnableSendOnlyTranslatedMessages, - toggleEnableSendOnlyTranslatedMessages, - updateEnableSendOnlyTranslatedMessages, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/others/useEnableSendReceivedMessageToVrc.js b/src-ui/logics/configs/others/useEnableSendReceivedMessageToVrc.js deleted file mode 100644 index bfc550a1..00000000 --- a/src-ui/logics/configs/others/useEnableSendReceivedMessageToVrc.js +++ /dev/null @@ -1,28 +0,0 @@ -import { useStore_EnableSendReceivedMessageToVrc } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useEnableSendReceivedMessageToVrc = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentEnableSendReceivedMessageToVrc, updateEnableSendReceivedMessageToVrc, pendingEnableSendReceivedMessageToVrc } = useStore_EnableSendReceivedMessageToVrc(); - - const getEnableSendReceivedMessageToVrc = () => { - pendingEnableSendReceivedMessageToVrc(); - asyncStdoutToPython("/get/data/send_received_message_to_vrc"); - }; - - const toggleEnableSendReceivedMessageToVrc = () => { - pendingEnableSendReceivedMessageToVrc(); - if (currentEnableSendReceivedMessageToVrc.data) { - asyncStdoutToPython("/set/disable/send_received_message_to_vrc"); - } else { - asyncStdoutToPython("/set/enable/send_received_message_to_vrc"); - } - }; - - return { - currentEnableSendReceivedMessageToVrc, - getEnableSendReceivedMessageToVrc, - toggleEnableSendReceivedMessageToVrc, - updateEnableSendReceivedMessageToVrc, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/others/useEnableVrcMicMuteSync.js b/src-ui/logics/configs/others/useEnableVrcMicMuteSync.js deleted file mode 100644 index df79fd54..00000000 --- a/src-ui/logics/configs/others/useEnableVrcMicMuteSync.js +++ /dev/null @@ -1,36 +0,0 @@ -import { useStore_EnableVrcMicMuteSync } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useEnableVrcMicMuteSync = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentEnableVrcMicMuteSync, updateEnableVrcMicMuteSync, pendingEnableVrcMicMuteSync } = useStore_EnableVrcMicMuteSync(); - - const getEnableVrcMicMuteSync = () => { - pendingEnableVrcMicMuteSync(); - asyncStdoutToPython("/get/data/vrc_mic_mute_sync"); - }; - - const toggleEnableVrcMicMuteSync = () => { - pendingEnableVrcMicMuteSync(); - if (currentEnableVrcMicMuteSync.data.is_enabled) { - asyncStdoutToPython("/set/disable/vrc_mic_mute_sync"); - } else { - asyncStdoutToPython("/set/enable/vrc_mic_mute_sync"); - } - }; - - const updateEnableVrcMicMuteSync_FromBackend = (payload) => { - updateEnableVrcMicMuteSync((old_value) => { - return {...old_value.data, is_enabled: payload}; - }); - }; - - return { - currentEnableVrcMicMuteSync, - getEnableVrcMicMuteSync, - toggleEnableVrcMicMuteSync, - updateEnableVrcMicMuteSync, - - updateEnableVrcMicMuteSync_FromBackend, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/others/useOthers.js b/src-ui/logics/configs/others/useOthers.js new file mode 100644 index 00000000..b9f13612 --- /dev/null +++ b/src-ui/logics/configs/others/useOthers.js @@ -0,0 +1,192 @@ +import { + useStore_EnableAutoClearMessageInputBox, + useStore_EnableSendOnlyTranslatedMessages, + useStore_EnableAutoExportMessageLogs, + useStore_EnableVrcMicMuteSync, + useStore_EnableSendMessageToVrc, + useStore_EnableNotificationVrcSfx, + useStore_EnableSendReceivedMessageToVrc, +} from "@store"; +import { useStdoutToPython } from "@useStdoutToPython"; + +export const useOthers = () => { + const { asyncStdoutToPython } = useStdoutToPython(); + + // Auto Clear Message Input Box + const { currentEnableAutoClearMessageInputBox, updateEnableAutoClearMessageInputBox, pendingEnableAutoClearMessageInputBox } = useStore_EnableAutoClearMessageInputBox(); + // Send Only Translated Messages + const { currentEnableSendOnlyTranslatedMessages, updateEnableSendOnlyTranslatedMessages, pendingEnableSendOnlyTranslatedMessages } = useStore_EnableSendOnlyTranslatedMessages(); + // Auto Export Message Logs + const { currentEnableAutoExportMessageLogs, updateEnableAutoExportMessageLogs, pendingEnableAutoExportMessageLogs } = useStore_EnableAutoExportMessageLogs(); + // VRC Mic Mute Sync + const { currentEnableVrcMicMuteSync, updateEnableVrcMicMuteSync, pendingEnableVrcMicMuteSync } = useStore_EnableVrcMicMuteSync(); + // Send Message To VRCT + const { currentEnableSendMessageToVrc, updateEnableSendMessageToVrc, pendingEnableSendMessageToVrc } = useStore_EnableSendMessageToVrc(); + // Sounds + // Notification VRC SFX + const { currentEnableNotificationVrcSfx, updateEnableNotificationVrcSfx, pendingEnableNotificationVrcSfx } = useStore_EnableNotificationVrcSfx(); + // Speaker2Chatbox + // Send Received Message To VRC + const { currentEnableSendReceivedMessageToVrc, updateEnableSendReceivedMessageToVrc, pendingEnableSendReceivedMessageToVrc } = useStore_EnableSendReceivedMessageToVrc(); + + + // Auto Clear Message Input Box + const getEnableAutoClearMessageInputBox = () => { + pendingEnableAutoClearMessageInputBox(); + asyncStdoutToPython("/get/data/auto_clear_message_box"); + }; + + const toggleEnableAutoClearMessageInputBox = () => { + pendingEnableAutoClearMessageInputBox(); + if (currentEnableAutoClearMessageInputBox.data) { + asyncStdoutToPython("/set/disable/auto_clear_message_box"); + } else { + asyncStdoutToPython("/set/enable/auto_clear_message_box"); + } + }; + + // Send Only Translated Messages + const getEnableSendOnlyTranslatedMessages = () => { + pendingEnableSendOnlyTranslatedMessages(); + asyncStdoutToPython("/get/data/send_only_translated_messages"); + }; + + const toggleEnableSendOnlyTranslatedMessages = () => { + pendingEnableSendOnlyTranslatedMessages(); + if (currentEnableSendOnlyTranslatedMessages.data) { + asyncStdoutToPython("/set/disable/send_only_translated_messages"); + } else { + asyncStdoutToPython("/set/enable/send_only_translated_messages"); + } + }; + + // Auto Export Message Logs + const getEnableAutoExportMessageLogs = () => { + pendingEnableAutoExportMessageLogs(); + asyncStdoutToPython("/get/data/logger_feature"); + }; + + const toggleEnableAutoExportMessageLogs = () => { + pendingEnableAutoExportMessageLogs(); + if (currentEnableAutoExportMessageLogs.data) { + asyncStdoutToPython("/set/disable/logger_feature"); + } else { + asyncStdoutToPython("/set/enable/logger_feature"); + } + }; + + // VRC Mic Mute Sync + const getEnableVrcMicMuteSync = () => { + pendingEnableVrcMicMuteSync(); + asyncStdoutToPython("/get/data/vrc_mic_mute_sync"); + }; + + const toggleEnableVrcMicMuteSync = () => { + pendingEnableVrcMicMuteSync(); + if (currentEnableVrcMicMuteSync.data.is_enabled) { + asyncStdoutToPython("/set/disable/vrc_mic_mute_sync"); + } else { + asyncStdoutToPython("/set/enable/vrc_mic_mute_sync"); + } + }; + + const updateEnableVrcMicMuteSync_FromBackend = (payload) => { + updateEnableVrcMicMuteSync((old_value) => { + return {...old_value.data, is_enabled: payload}; + }); + }; + + // Send Message To VRCT + const getEnableSendMessageToVrc = () => { + pendingEnableSendMessageToVrc(); + asyncStdoutToPython("/get/data/send_message_to_vrc"); + }; + + const toggleEnableSendMessageToVrc = () => { + pendingEnableSendMessageToVrc(); + if (currentEnableSendMessageToVrc.data) { + asyncStdoutToPython("/set/disable/send_message_to_vrc"); + } else { + asyncStdoutToPython("/set/enable/send_message_to_vrc"); + } + }; + + // Sounds + // Notification VRC SFX + const getEnableNotificationVrcSfx = () => { + pendingEnableNotificationVrcSfx(); + asyncStdoutToPython("/get/data/notification_vrc_sfx"); + }; + + const toggleEnableNotificationVrcSfx = () => { + pendingEnableNotificationVrcSfx(); + if (currentEnableNotificationVrcSfx.data) { + asyncStdoutToPython("/set/disable/notification_vrc_sfx"); + } else { + asyncStdoutToPython("/set/enable/notification_vrc_sfx"); + } + }; + + // Speaker2Chatbox + // Send Received Message To VRC + const getEnableSendReceivedMessageToVrc = () => { + pendingEnableSendReceivedMessageToVrc(); + asyncStdoutToPython("/get/data/send_received_message_to_vrc"); + }; + + const toggleEnableSendReceivedMessageToVrc = () => { + pendingEnableSendReceivedMessageToVrc(); + if (currentEnableSendReceivedMessageToVrc.data) { + asyncStdoutToPython("/set/disable/send_received_message_to_vrc"); + } else { + asyncStdoutToPython("/set/enable/send_received_message_to_vrc"); + } + }; + + return { + // Auto Clear Message Input Box + currentEnableAutoClearMessageInputBox, + getEnableAutoClearMessageInputBox, + toggleEnableAutoClearMessageInputBox, + updateEnableAutoClearMessageInputBox, + + // Send Only Translated Messages + currentEnableSendOnlyTranslatedMessages, + getEnableSendOnlyTranslatedMessages, + toggleEnableSendOnlyTranslatedMessages, + updateEnableSendOnlyTranslatedMessages, + + // Auto Export Message Logs + currentEnableAutoExportMessageLogs, + getEnableAutoExportMessageLogs, + toggleEnableAutoExportMessageLogs, + updateEnableAutoExportMessageLogs, + + // VRC Mic Mute Sync + currentEnableVrcMicMuteSync, + getEnableVrcMicMuteSync, + toggleEnableVrcMicMuteSync, + updateEnableVrcMicMuteSync, + updateEnableVrcMicMuteSync_FromBackend, + + // Send Message To VRCT + currentEnableSendMessageToVrc, + getEnableSendMessageToVrc, + toggleEnableSendMessageToVrc, + updateEnableSendMessageToVrc, + + // Sounds + // Notification VRC SFX + currentEnableNotificationVrcSfx, + getEnableNotificationVrcSfx, + toggleEnableNotificationVrcSfx, + updateEnableNotificationVrcSfx, + + // Speaker2Chatbox + // Send Received Message To VRC + currentEnableSendReceivedMessageToVrc, + getEnableSendReceivedMessageToVrc, + toggleEnableSendReceivedMessageToVrc, + updateEnableSendReceivedMessageToVrc, + }; +}; \ No newline at end of file diff --git a/src-ui/logics/configs/plugins/usePlugins.js b/src-ui/logics/configs/plugins/usePlugins.js index 50a9fe41..e22c2aff 100644 --- a/src-ui/logics/configs/plugins/usePlugins.js +++ b/src-ui/logics/configs/plugins/usePlugins.js @@ -1,5 +1,5 @@ import { invoke } from "@tauri-apps/api/core"; -import { useTranslation } from "react-i18next"; +import { useI18n } from "@useI18n"; import { IS_PLUGIN_PATH_DEV_MODE, getPluginsList } from "@ui_configs"; import { store, @@ -36,7 +36,7 @@ import * as logics_common from "@logics_common"; const PLUGIN_LIST_URL = getPluginsList(); export const usePlugins = () => { - const { t } = useTranslation(); + const { t, i18n } = useI18n(); const { showNotification_Success, showNotification_Error } = useNotificationStatus(); const { asyncStdoutToPython } = useStdoutToPython(); @@ -50,8 +50,6 @@ export const usePlugins = () => { const { asyncTauriFetchGithub } = useFetch(); - const { i18n } = useTranslation(); - const generatePluginContext = (downloaded_plugin_info) => { const plugin_context = { registerComponent: (component) => { diff --git a/src-ui/logics/configs/transcription/useMicMaxWords.js b/src-ui/logics/configs/transcription/useMicMaxWords.js deleted file mode 100644 index 72abd77b..00000000 --- a/src-ui/logics/configs/transcription/useMicMaxWords.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_MicMaxWords } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useMicMaxWords = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentMicMaxWords, updateMicMaxWords, pendingMicMaxWords } = useStore_MicMaxWords(); - - const getMicMaxWords = () => { - pendingMicMaxWords(); - asyncStdoutToPython("/get/data/mic_max_phrases"); - }; - - const setMicMaxWords = (selected_mic_max_phrases) => { - pendingMicMaxWords(); - asyncStdoutToPython("/set/data/mic_max_phrases", selected_mic_max_phrases); - }; - - return { - currentMicMaxWords, - getMicMaxWords, - updateMicMaxWords, - setMicMaxWords, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/transcription/useMicPhraseTimeout.js b/src-ui/logics/configs/transcription/useMicPhraseTimeout.js deleted file mode 100644 index 6f66abf8..00000000 --- a/src-ui/logics/configs/transcription/useMicPhraseTimeout.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_MicPhraseTimeout } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useMicPhraseTimeout = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentMicPhraseTimeout, updateMicPhraseTimeout, pendingMicPhraseTimeout } = useStore_MicPhraseTimeout(); - - const getMicPhraseTimeout = () => { - pendingMicPhraseTimeout(); - asyncStdoutToPython("/get/data/mic_phrase_timeout"); - }; - - const setMicPhraseTimeout = (selected_mic_phrase_timeout) => { - pendingMicPhraseTimeout(); - asyncStdoutToPython("/set/data/mic_phrase_timeout", selected_mic_phrase_timeout); - }; - - return { - currentMicPhraseTimeout, - getMicPhraseTimeout, - updateMicPhraseTimeout, - setMicPhraseTimeout, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/transcription/useMicRecordTimeout.js b/src-ui/logics/configs/transcription/useMicRecordTimeout.js deleted file mode 100644 index cfeab807..00000000 --- a/src-ui/logics/configs/transcription/useMicRecordTimeout.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_MicRecordTimeout } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useMicRecordTimeout = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentMicRecordTimeout, updateMicRecordTimeout, pendingMicRecordTimeout } = useStore_MicRecordTimeout(); - - const getMicRecordTimeout = () => { - pendingMicRecordTimeout(); - asyncStdoutToPython("/get/data/mic_record_timeout"); - }; - - const setMicRecordTimeout = (selected_mic_record_timeout) => { - pendingMicRecordTimeout(); - asyncStdoutToPython("/set/data/mic_record_timeout", selected_mic_record_timeout); - }; - - return { - currentMicRecordTimeout, - getMicRecordTimeout, - updateMicRecordTimeout, - setMicRecordTimeout, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/transcription/useMicWordFilterList.js b/src-ui/logics/configs/transcription/useMicWordFilterList.js deleted file mode 100644 index 1901e286..00000000 --- a/src-ui/logics/configs/transcription/useMicWordFilterList.js +++ /dev/null @@ -1,41 +0,0 @@ -import { useStore_MicWordFilterList } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useMicWordFilterList = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentMicWordFilterList, updateMicWordFilterList, pendingMicWordFilterList } = useStore_MicWordFilterList(); - - const getMicWordFilterList = () => { - pendingMicWordFilterList(); - asyncStdoutToPython("/get/data/mic_word_filter"); - }; - - const setMicWordFilterList = (selected_mic_word_filter) => { - pendingMicWordFilterList(); - asyncStdoutToPython("/set/data/mic_word_filter", selected_mic_word_filter); - }; - - const updateMicWordFilterList_FromBackend = (payload) => { - updateMicWordFilterList((prev_list) => { - const updated_list = [...prev_list.data]; - for (const value of payload) { - const existing_item = updated_list.find(item => item.value === value); - if (existing_item) { - existing_item.is_redoable = false; - } else { - updated_list.push({ value, is_redoable: false }); - } - } - return updated_list; - }); - }; - - return { - currentMicWordFilterList, - getMicWordFilterList, - updateMicWordFilterList, - setMicWordFilterList, - - updateMicWordFilterList_FromBackend, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/transcription/useSelectableWhisperComputeDeviceList.js b/src-ui/logics/configs/transcription/useSelectableWhisperComputeDeviceList.js deleted file mode 100644 index a5528937..00000000 --- a/src-ui/logics/configs/transcription/useSelectableWhisperComputeDeviceList.js +++ /dev/null @@ -1,25 +0,0 @@ -import { useStore_SelectableWhisperComputeDeviceList } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; -import { transformToIndexedArray } from "@utils"; - -export const useSelectableWhisperComputeDeviceList = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSelectableWhisperComputeDeviceList, updateSelectableWhisperComputeDeviceList, pendingSelectableWhisperComputeDeviceList } = useStore_SelectableWhisperComputeDeviceList(); - - const getSelectableWhisperComputeDeviceList = () => { - pendingSelectableWhisperComputeDeviceList(); - asyncStdoutToPython("/get/data/transcription_compute_device_list"); - }; - - const updateSelectableWhisperComputeDeviceList_FromBackend = (payload) => { - updateSelectableWhisperComputeDeviceList(transformToIndexedArray(payload)); - }; - - return { - currentSelectableWhisperComputeDeviceList, - getSelectableWhisperComputeDeviceList, - updateSelectableWhisperComputeDeviceList, - - updateSelectableWhisperComputeDeviceList_FromBackend, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/transcription/useSelectedTranscriptionEngine.js b/src-ui/logics/configs/transcription/useSelectedTranscriptionEngine.js deleted file mode 100644 index 9c7758f7..00000000 --- a/src-ui/logics/configs/transcription/useSelectedTranscriptionEngine.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_SelectedTranscriptionEngine } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useSelectedTranscriptionEngine = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSelectedTranscriptionEngine, updateSelectedTranscriptionEngine, pendingSelectedTranscriptionEngine } = useStore_SelectedTranscriptionEngine(); - - const getSelectedTranscriptionEngine = () => { - pendingSelectedTranscriptionEngine(); - asyncStdoutToPython("/get/data/selected_transcription_engine"); - }; - - const setSelectedTranscriptionEngine = (selected_transcription_engine) => { - pendingSelectedTranscriptionEngine(); - asyncStdoutToPython("/set/data/selected_transcription_engine", selected_transcription_engine); - }; - - return { - currentSelectedTranscriptionEngine, - getSelectedTranscriptionEngine, - updateSelectedTranscriptionEngine, - setSelectedTranscriptionEngine, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/transcription/useSelectedWhisperComputeDevice.js b/src-ui/logics/configs/transcription/useSelectedWhisperComputeDevice.js deleted file mode 100644 index 517dde00..00000000 --- a/src-ui/logics/configs/transcription/useSelectedWhisperComputeDevice.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_SelectedWhisperComputeDevice } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useSelectedWhisperComputeDevice = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSelectedWhisperComputeDevice, updateSelectedWhisperComputeDevice, pendingSelectedWhisperComputeDevice } = useStore_SelectedWhisperComputeDevice(); - - const getSelectedWhisperComputeDevice = () => { - pendingSelectedWhisperComputeDevice(); - asyncStdoutToPython("/get/data/selected_transcription_compute_device"); - }; - - const setSelectedWhisperComputeDevice = (selected_transcription_compute_device) => { - pendingSelectedWhisperComputeDevice(); - asyncStdoutToPython("/set/data/selected_transcription_compute_device", selected_transcription_compute_device); - }; - - return { - currentSelectedWhisperComputeDevice, - getSelectedWhisperComputeDevice, - updateSelectedWhisperComputeDevice, - setSelectedWhisperComputeDevice, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/transcription/useSelectedWhisperWeightType.js b/src-ui/logics/configs/transcription/useSelectedWhisperWeightType.js deleted file mode 100644 index 220921ae..00000000 --- a/src-ui/logics/configs/transcription/useSelectedWhisperWeightType.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_SelectedWhisperWeightType } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useSelectedWhisperWeightType = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSelectedWhisperWeightType, updateSelectedWhisperWeightType, pendingSelectedWhisperWeightType } = useStore_SelectedWhisperWeightType(); - - const getSelectedWhisperWeightType = () => { - pendingSelectedWhisperWeightType(); - asyncStdoutToPython("/get/data/whisper_weight_type"); - }; - - const setSelectedWhisperWeightType = (selected_whisper_weight_type) => { - pendingSelectedWhisperWeightType(); - asyncStdoutToPython("/set/data/whisper_weight_type", selected_whisper_weight_type); - }; - - return { - currentSelectedWhisperWeightType, - getSelectedWhisperWeightType, - updateSelectedWhisperWeightType, - setSelectedWhisperWeightType, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/transcription/useSpeakerMaxWords.js b/src-ui/logics/configs/transcription/useSpeakerMaxWords.js deleted file mode 100644 index 4907ab09..00000000 --- a/src-ui/logics/configs/transcription/useSpeakerMaxWords.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_SpeakerMaxWords } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useSpeakerMaxWords = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSpeakerMaxWords, updateSpeakerMaxWords, pendingSpeakerMaxWords } = useStore_SpeakerMaxWords(); - - const getSpeakerMaxWords = () => { - pendingSpeakerMaxWords(); - asyncStdoutToPython("/get/data/speaker_max_phrases"); - }; - - const setSpeakerMaxWords = (selected_speaker_max_phrases) => { - pendingSpeakerMaxWords(); - asyncStdoutToPython("/set/data/speaker_max_phrases", selected_speaker_max_phrases); - }; - - return { - currentSpeakerMaxWords, - getSpeakerMaxWords, - updateSpeakerMaxWords, - setSpeakerMaxWords, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/transcription/useSpeakerPhraseTimeout.js b/src-ui/logics/configs/transcription/useSpeakerPhraseTimeout.js deleted file mode 100644 index 4f9ac1c9..00000000 --- a/src-ui/logics/configs/transcription/useSpeakerPhraseTimeout.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_SpeakerPhraseTimeout } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useSpeakerPhraseTimeout = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSpeakerPhraseTimeout, updateSpeakerPhraseTimeout, pendingSpeakerPhraseTimeout } = useStore_SpeakerPhraseTimeout(); - - const getSpeakerPhraseTimeout = () => { - pendingSpeakerPhraseTimeout(); - asyncStdoutToPython("/get/data/speaker_phrase_timeout"); - }; - - const setSpeakerPhraseTimeout = (selected_speaker_phrase_timeout) => { - pendingSpeakerPhraseTimeout(); - asyncStdoutToPython("/set/data/speaker_phrase_timeout", selected_speaker_phrase_timeout); - }; - - return { - currentSpeakerPhraseTimeout, - getSpeakerPhraseTimeout, - updateSpeakerPhraseTimeout, - setSpeakerPhraseTimeout, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/transcription/useSpeakerRecordTimeout.js b/src-ui/logics/configs/transcription/useSpeakerRecordTimeout.js deleted file mode 100644 index 123ad89b..00000000 --- a/src-ui/logics/configs/transcription/useSpeakerRecordTimeout.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_SpeakerRecordTimeout } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useSpeakerRecordTimeout = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSpeakerRecordTimeout, updateSpeakerRecordTimeout, pendingSpeakerRecordTimeout } = useStore_SpeakerRecordTimeout(); - - const getSpeakerRecordTimeout = () => { - pendingSpeakerRecordTimeout(); - asyncStdoutToPython("/get/data/speaker_record_timeout"); - }; - - const setSpeakerRecordTimeout = (selected_speaker_record_timeout) => { - pendingSpeakerRecordTimeout(); - asyncStdoutToPython("/set/data/speaker_record_timeout", selected_speaker_record_timeout); - }; - - return { - currentSpeakerRecordTimeout, - getSpeakerRecordTimeout, - updateSpeakerRecordTimeout, - setSpeakerRecordTimeout, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/transcription/useTranscription.js b/src-ui/logics/configs/transcription/useTranscription.js new file mode 100644 index 00000000..2079780c --- /dev/null +++ b/src-ui/logics/configs/transcription/useTranscription.js @@ -0,0 +1,292 @@ +import { + useStore_MicRecordTimeout, + useStore_MicPhraseTimeout, + useStore_MicMaxWords, + useStore_MicWordFilterList, + + useStore_SpeakerMaxWords, + useStore_SpeakerPhraseTimeout, + useStore_SpeakerRecordTimeout, + + useStore_SelectableWhisperComputeDeviceList, + useStore_SelectedTranscriptionEngine, + useStore_SelectedWhisperComputeDevice, + useStore_SelectedWhisperWeightType, + + useStore_WhisperWeightTypeStatus, +} from "@store"; +import { useStdoutToPython } from "@useStdoutToPython"; +import { transformToIndexedArray } from "@utils"; + +export const useTranscription = () => { + const { asyncStdoutToPython } = useStdoutToPython(); + + // Mic + const { currentMicRecordTimeout, updateMicRecordTimeout, pendingMicRecordTimeout } = useStore_MicRecordTimeout(); + const { currentMicPhraseTimeout, updateMicPhraseTimeout, pendingMicPhraseTimeout } = useStore_MicPhraseTimeout(); + const { currentMicMaxWords, updateMicMaxWords, pendingMicMaxWords } = useStore_MicMaxWords(); + const { currentMicWordFilterList, updateMicWordFilterList, pendingMicWordFilterList } = useStore_MicWordFilterList(); + + // Speaker + const { currentSpeakerRecordTimeout, updateSpeakerRecordTimeout, pendingSpeakerRecordTimeout } = useStore_SpeakerRecordTimeout(); + const { currentSpeakerPhraseTimeout, updateSpeakerPhraseTimeout, pendingSpeakerPhraseTimeout } = useStore_SpeakerPhraseTimeout(); + const { currentSpeakerMaxWords, updateSpeakerMaxWords, pendingSpeakerMaxWords } = useStore_SpeakerMaxWords(); + + // Transcription Engines + const { currentSelectedTranscriptionEngine, updateSelectedTranscriptionEngine, pendingSelectedTranscriptionEngine } = useStore_SelectedTranscriptionEngine(); + const { currentWhisperWeightTypeStatus, updateWhisperWeightTypeStatus, pendingWhisperWeightTypeStatus } = useStore_WhisperWeightTypeStatus(); + const { currentSelectedWhisperWeightType, updateSelectedWhisperWeightType, pendingSelectedWhisperWeightType } = useStore_SelectedWhisperWeightType(); + const { currentSelectableWhisperComputeDeviceList, updateSelectableWhisperComputeDeviceList, pendingSelectableWhisperComputeDeviceList } = useStore_SelectableWhisperComputeDeviceList(); + const { currentSelectedWhisperComputeDevice, updateSelectedWhisperComputeDevice, pendingSelectedWhisperComputeDevice } = useStore_SelectedWhisperComputeDevice(); + + + // Mic + const getMicRecordTimeout = () => { + pendingMicRecordTimeout(); + asyncStdoutToPython("/get/data/mic_record_timeout"); + }; + + const setMicRecordTimeout = (selected_mic_record_timeout) => { + pendingMicRecordTimeout(); + asyncStdoutToPython("/set/data/mic_record_timeout", selected_mic_record_timeout); + }; + + + const getMicPhraseTimeout = () => { + pendingMicPhraseTimeout(); + asyncStdoutToPython("/get/data/mic_phrase_timeout"); + }; + + const setMicPhraseTimeout = (selected_mic_phrase_timeout) => { + pendingMicPhraseTimeout(); + asyncStdoutToPython("/set/data/mic_phrase_timeout", selected_mic_phrase_timeout); + }; + + + const getMicMaxWords = () => { + pendingMicMaxWords(); + asyncStdoutToPython("/get/data/mic_max_phrases"); + }; + + const setMicMaxWords = (selected_mic_max_phrases) => { + pendingMicMaxWords(); + asyncStdoutToPython("/set/data/mic_max_phrases", selected_mic_max_phrases); + }; + + const getMicWordFilterList = () => { + pendingMicWordFilterList(); + asyncStdoutToPython("/get/data/mic_word_filter"); + }; + + const setMicWordFilterList = (selected_mic_word_filter) => { + pendingMicWordFilterList(); + asyncStdoutToPython("/set/data/mic_word_filter", selected_mic_word_filter); + }; + + const updateMicWordFilterList_FromBackend = (payload) => { + updateMicWordFilterList((prev_list) => { + const updated_list = [...prev_list.data]; + for (const value of payload) { + const existing_item = updated_list.find(item => item.value === value); + if (existing_item) { + existing_item.is_redoable = false; + } else { + updated_list.push({ value, is_redoable: false }); + } + } + return updated_list; + }); + }; + + // Speaker + const getSpeakerRecordTimeout = () => { + pendingSpeakerRecordTimeout(); + asyncStdoutToPython("/get/data/speaker_record_timeout"); + }; + + const setSpeakerRecordTimeout = (selected_speaker_record_timeout) => { + pendingSpeakerRecordTimeout(); + asyncStdoutToPython("/set/data/speaker_record_timeout", selected_speaker_record_timeout); + }; + + + const getSpeakerPhraseTimeout = () => { + pendingSpeakerPhraseTimeout(); + asyncStdoutToPython("/get/data/speaker_phrase_timeout"); + }; + + const setSpeakerPhraseTimeout = (selected_speaker_phrase_timeout) => { + pendingSpeakerPhraseTimeout(); + asyncStdoutToPython("/set/data/speaker_phrase_timeout", selected_speaker_phrase_timeout); + }; + + + const getSpeakerMaxWords = () => { + pendingSpeakerMaxWords(); + asyncStdoutToPython("/get/data/speaker_max_phrases"); + }; + + const setSpeakerMaxWords = (selected_speaker_max_phrases) => { + pendingSpeakerMaxWords(); + asyncStdoutToPython("/set/data/speaker_max_phrases", selected_speaker_max_phrases); + }; + + + // Transcription Engines + // Transcription Engines (Google / Whisper) + const getSelectedTranscriptionEngine = () => { + pendingSelectedTranscriptionEngine(); + asyncStdoutToPython("/get/data/selected_transcription_engine"); + }; + + const setSelectedTranscriptionEngine = (selected_transcription_engine) => { + pendingSelectedTranscriptionEngine(); + asyncStdoutToPython("/set/data/selected_transcription_engine", selected_transcription_engine); + }; + + + // Transcription Engines (Weight Type List) + const updateDownloadedWhisperWeightTypeStatus = (downloaded_weight_type_status) => { + updateWhisperWeightTypeStatus((old_status) => + old_status.data.map((item) => ({ + ...item, + is_downloaded: downloaded_weight_type_status[item.id] ?? item.is_downloaded, + })) + ); + }; + const updateDownloadProgressWhisperWeightTypeStatus = (payload) => { + if (payload === true) return console.error("fix me."); + + updateWhisperWeightTypeStatus((old_status) => + old_status.data.map((item) => + payload.weight_type === item.id + ? { ...item, progress: payload.progress * 100 } + : item + ) + ); + }; + const pendingWhisperWeightType = (id) => { + updateWhisperWeightTypeStatus((old_status) => + old_status.data.map((item) => + id === item.id + ? { ...item, is_pending: true } + : item + ) + ); + }; + const downloadedWhisperWeightType = (id) => { + updateWhisperWeightTypeStatus((old_status) => + old_status.data.map((item) => + id === item.id + ? { ...item, is_downloaded: true, is_pending: false, progress: null } + : item + ) + ); + }; + + const downloadWhisperWeight = (weight_type) => { + asyncStdoutToPython("/run/download_whisper_weight", weight_type); + }; + + // Transcription Engines (Selected Weight Type) + const getSelectedWhisperWeightType = () => { + pendingSelectedWhisperWeightType(); + asyncStdoutToPython("/get/data/whisper_weight_type"); + }; + + const setSelectedWhisperWeightType = (selected_whisper_weight_type) => { + pendingSelectedWhisperWeightType(); + asyncStdoutToPython("/set/data/whisper_weight_type", selected_whisper_weight_type); + }; + + + // Transcription Engines (Compute Device List) + const getSelectableWhisperComputeDeviceList = () => { + pendingSelectableWhisperComputeDeviceList(); + asyncStdoutToPython("/get/data/transcription_compute_device_list"); + }; + + const updateSelectableWhisperComputeDeviceList_FromBackend = (payload) => { + updateSelectableWhisperComputeDeviceList(transformToIndexedArray(payload)); + }; + + // Transcription Engines (Selected Compute Device) + const getSelectedWhisperComputeDevice = () => { + pendingSelectedWhisperComputeDevice(); + asyncStdoutToPython("/get/data/selected_transcription_compute_device"); + }; + + const setSelectedWhisperComputeDevice = (selected_transcription_compute_device) => { + pendingSelectedWhisperComputeDevice(); + asyncStdoutToPython("/set/data/selected_transcription_compute_device", selected_transcription_compute_device); + }; + + return { + // Mic + currentMicRecordTimeout, + getMicRecordTimeout, + updateMicRecordTimeout, + setMicRecordTimeout, + + currentMicPhraseTimeout, + getMicPhraseTimeout, + updateMicPhraseTimeout, + setMicPhraseTimeout, + + currentMicMaxWords, + getMicMaxWords, + updateMicMaxWords, + setMicMaxWords, + + currentMicWordFilterList, + getMicWordFilterList, + updateMicWordFilterList, + setMicWordFilterList, + updateMicWordFilterList_FromBackend, + + // Speaker + currentSpeakerRecordTimeout, + getSpeakerRecordTimeout, + updateSpeakerRecordTimeout, + setSpeakerRecordTimeout, + + currentSpeakerPhraseTimeout, + getSpeakerPhraseTimeout, + updateSpeakerPhraseTimeout, + setSpeakerPhraseTimeout, + + currentSpeakerMaxWords, + getSpeakerMaxWords, + updateSpeakerMaxWords, + setSpeakerMaxWords, + + // Transcription Engines + currentSelectedTranscriptionEngine, + getSelectedTranscriptionEngine, + updateSelectedTranscriptionEngine, + setSelectedTranscriptionEngine, + + currentWhisperWeightTypeStatus, + updateWhisperWeightTypeStatus, + updateDownloadedWhisperWeightTypeStatus, + updateDownloadProgressWhisperWeightTypeStatus, + pendingWhisperWeightType, + downloadedWhisperWeightType, + downloadWhisperWeight, + + currentSelectedWhisperWeightType, + getSelectedWhisperWeightType, + updateSelectedWhisperWeightType, + setSelectedWhisperWeightType, + + currentSelectableWhisperComputeDeviceList, + getSelectableWhisperComputeDeviceList, + updateSelectableWhisperComputeDeviceList, + updateSelectableWhisperComputeDeviceList_FromBackend, + + currentSelectedWhisperComputeDevice, + getSelectedWhisperComputeDevice, + updateSelectedWhisperComputeDevice, + setSelectedWhisperComputeDevice, + }; +}; \ No newline at end of file diff --git a/src-ui/logics/configs/transcription/useWhisperWeightTypeStatus.js b/src-ui/logics/configs/transcription/useWhisperWeightTypeStatus.js deleted file mode 100644 index 1d8a96c3..00000000 --- a/src-ui/logics/configs/transcription/useWhisperWeightTypeStatus.js +++ /dev/null @@ -1,60 +0,0 @@ -import { useStore_WhisperWeightTypeStatus } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useWhisperWeightTypeStatus = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentWhisperWeightTypeStatus, updateWhisperWeightTypeStatus, pendingWhisperWeightTypeStatus } = useStore_WhisperWeightTypeStatus(); - - const updateDownloadedWhisperWeightTypeStatus = (downloaded_weight_type_status) => { - updateWhisperWeightTypeStatus((old_status) => - old_status.data.map((item) => ({ - ...item, - is_downloaded: downloaded_weight_type_status[item.id] ?? item.is_downloaded, - })) - ); - }; - const updateDownloadProgressWhisperWeightTypeStatus = (payload) => { - if (payload === true) return console.error("fix me."); - - updateWhisperWeightTypeStatus((old_status) => - old_status.data.map((item) => - payload.weight_type === item.id - ? { ...item, progress: payload.progress * 100 } - : item - ) - ); - }; - const pendingWhisperWeightType = (id) => { - updateWhisperWeightTypeStatus((old_status) => - old_status.data.map((item) => - id === item.id - ? { ...item, is_pending: true } - : item - ) - ); - }; - const downloadedWhisperWeightType = (id) => { - updateWhisperWeightTypeStatus((old_status) => - old_status.data.map((item) => - id === item.id - ? { ...item, is_downloaded: true, is_pending: false, progress: null } - : item - ) - ); - }; - - const downloadWhisperWeight = (weight_type) => { - asyncStdoutToPython("/run/download_whisper_weight", weight_type); - }; - - return { - currentWhisperWeightTypeStatus, - updateWhisperWeightTypeStatus, - - updateDownloadedWhisperWeightTypeStatus, - updateDownloadProgressWhisperWeightTypeStatus, - pendingWhisperWeightType, - downloadedWhisperWeightType, - downloadWhisperWeight, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/translation/useCTranslate2WeightTypeStatus.js b/src-ui/logics/configs/translation/useCTranslate2WeightTypeStatus.js deleted file mode 100644 index fa28404e..00000000 --- a/src-ui/logics/configs/translation/useCTranslate2WeightTypeStatus.js +++ /dev/null @@ -1,60 +0,0 @@ -import { useStore_CTranslate2WeightTypeStatus } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useCTranslate2WeightTypeStatus = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentCTranslate2WeightTypeStatus, updateCTranslate2WeightTypeStatus, pendingCTranslate2WeightTypeStatus } = useStore_CTranslate2WeightTypeStatus(); - - const updateDownloadedCTranslate2WeightTypeStatus = (downloaded_weight_type_status) => { - updateCTranslate2WeightTypeStatus((old_status) => - old_status.data.map((item) => ({ - ...item, - is_downloaded: downloaded_weight_type_status[item.id] ?? item.is_downloaded, - })) - ); - }; - const updateDownloadProgressCTranslate2WeightTypeStatus = (payload) => { - if (payload === true) return console.error("fix me."); - - updateCTranslate2WeightTypeStatus((old_status) => - old_status.data.map((item) => - payload.weight_type === item.id - ? { ...item, progress: payload.progress * 100 } - : item - ) - ); - }; - const pendingCTranslate2WeightType = (id) => { - updateCTranslate2WeightTypeStatus((old_status) => - old_status.data.map((item) => - id === item.id - ? { ...item, is_pending: true } - : item - ) - ); - }; - const downloadedCTranslate2WeightType = (id) => { - updateCTranslate2WeightTypeStatus((old_status) => - old_status.data.map((item) => - id === item.id - ? { ...item, is_downloaded: true, is_pending: false, progress: null } - : item - ) - ); - }; - - const downloadCTranslate2Weight = (weight_type) => { - asyncStdoutToPython("/run/download_ctranslate2_weight", weight_type); - }; - - return { - currentCTranslate2WeightTypeStatus, - updateCTranslate2WeightTypeStatus, - - updateDownloadedCTranslate2WeightTypeStatus, - updateDownloadProgressCTranslate2WeightTypeStatus, - pendingCTranslate2WeightType, - downloadedCTranslate2WeightType, - downloadCTranslate2Weight, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/translation/useDeepLAuthKey.js b/src-ui/logics/configs/translation/useDeepLAuthKey.js deleted file mode 100644 index 89661ad1..00000000 --- a/src-ui/logics/configs/translation/useDeepLAuthKey.js +++ /dev/null @@ -1,45 +0,0 @@ -import { useStore_DeepLAuthKey } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; -import { useTranslation } from "react-i18next"; -import { useNotificationStatus } from "@logics_common"; - -export const useDeepLAuthKey = () => { - const { t } = useTranslation(); - const { showNotification_Success, showNotification_Error } = useNotificationStatus(); - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentDeepLAuthKey, updateDeepLAuthKey, pendingDeepLAuthKey } = useStore_DeepLAuthKey(); - - const getDeepLAuthKey = () => { - pendingDeepLAuthKey(); - asyncStdoutToPython("/get/data/deepl_auth_key"); - }; - - const setDeepLAuthKey = (selected_deepl_auth_key) => { - pendingDeepLAuthKey(); - asyncStdoutToPython("/set/data/deepl_auth_key", selected_deepl_auth_key); - }; - - const deleteDeepLAuthKey = () => { - pendingDeepLAuthKey(); - asyncStdoutToPython("/delete/data/deepl_auth_key"); - }; - const deletedDeepLAuthKey = () => { - updateDeepLAuthKey(""); - }; - - const savedDeepLAuthKey = (data) => { - updateDeepLAuthKey(data); - showNotification_Success(t("config_page.translation.deepl_auth_key.auth_key_success")); - }; - - return { - currentDeepLAuthKey, - getDeepLAuthKey, - updateDeepLAuthKey, - setDeepLAuthKey, - deleteDeepLAuthKey, - - deletedDeepLAuthKey, - savedDeepLAuthKey, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/translation/useSelectableCTranslate2ComputeDeviceList.js b/src-ui/logics/configs/translation/useSelectableCTranslate2ComputeDeviceList.js deleted file mode 100644 index 4ae60c1f..00000000 --- a/src-ui/logics/configs/translation/useSelectableCTranslate2ComputeDeviceList.js +++ /dev/null @@ -1,25 +0,0 @@ -import { useStore_SelectableCTranslate2ComputeDeviceList } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; -import { transformToIndexedArray } from "@utils"; - -export const useSelectableCTranslate2ComputeDeviceList = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSelectableCTranslate2ComputeDeviceList, updateSelectableCTranslate2ComputeDeviceList, pendingSelectableCTranslate2ComputeDeviceList } = useStore_SelectableCTranslate2ComputeDeviceList(); - - const getSelectableCTranslate2ComputeDeviceList = () => { - pendingSelectableCTranslate2ComputeDeviceList(); - asyncStdoutToPython("/get/data/translation_compute_device_list"); - }; - - const updateSelectableCTranslate2ComputeDeviceList_FromBackend = (payload) => { - updateSelectableCTranslate2ComputeDeviceList(transformToIndexedArray(payload)); - }; - - return { - currentSelectableCTranslate2ComputeDeviceList, - getSelectableCTranslate2ComputeDeviceList, - updateSelectableCTranslate2ComputeDeviceList, - - updateSelectableCTranslate2ComputeDeviceList_FromBackend, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/translation/useSelectedCTranslate2ComputeDevice.js b/src-ui/logics/configs/translation/useSelectedCTranslate2ComputeDevice.js deleted file mode 100644 index 0887364d..00000000 --- a/src-ui/logics/configs/translation/useSelectedCTranslate2ComputeDevice.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_SelectedCTranslate2ComputeDevice } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useSelectedCTranslate2ComputeDevice = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSelectedCTranslate2ComputeDevice, updateSelectedCTranslate2ComputeDevice, pendingSelectedCTranslate2ComputeDevice } = useStore_SelectedCTranslate2ComputeDevice(); - - const getSelectedCTranslate2ComputeDevice = () => { - pendingSelectedCTranslate2ComputeDevice(); - asyncStdoutToPython("/get/data/selected_translation_compute_device"); - }; - - const setSelectedCTranslate2ComputeDevice = (selected_translation_compute_device) => { - pendingSelectedCTranslate2ComputeDevice(); - asyncStdoutToPython("/set/data/selected_translation_compute_device", selected_translation_compute_device); - }; - - return { - currentSelectedCTranslate2ComputeDevice, - getSelectedCTranslate2ComputeDevice, - updateSelectedCTranslate2ComputeDevice, - setSelectedCTranslate2ComputeDevice, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/translation/useSelectedCTranslate2WeightType.js b/src-ui/logics/configs/translation/useSelectedCTranslate2WeightType.js deleted file mode 100644 index 9b6197dc..00000000 --- a/src-ui/logics/configs/translation/useSelectedCTranslate2WeightType.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_SelectedCTranslate2WeightType } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useSelectedCTranslate2WeightType = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentSelectedCTranslate2WeightType, updateSelectedCTranslate2WeightType, pendingSelectedCTranslate2WeightType } = useStore_SelectedCTranslate2WeightType(); - - const getSelectedCTranslate2WeightType = () => { - pendingSelectedCTranslate2WeightType(); - asyncStdoutToPython("/get/data/ctranslate2_weight_type"); - }; - - const setSelectedCTranslate2WeightType = (selected_ctranslate2_weight_type) => { - pendingSelectedCTranslate2WeightType(); - asyncStdoutToPython("/set/data/ctranslate2_weight_type", selected_ctranslate2_weight_type); - }; - - return { - currentSelectedCTranslate2WeightType, - getSelectedCTranslate2WeightType, - updateSelectedCTranslate2WeightType, - setSelectedCTranslate2WeightType, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/translation/useTranslation.js b/src-ui/logics/configs/translation/useTranslation.js new file mode 100644 index 00000000..77747256 --- /dev/null +++ b/src-ui/logics/configs/translation/useTranslation.js @@ -0,0 +1,155 @@ +import { + useStore_CTranslate2WeightTypeStatus, + useStore_SelectedCTranslate2WeightType, + useStore_SelectableCTranslate2ComputeDeviceList, + useStore_SelectedCTranslate2ComputeDevice, + useStore_DeepLAuthKey, +} from "@store"; +import { useStdoutToPython } from "@useStdoutToPython"; +import { useI18n } from "@useI18n"; +import { transformToIndexedArray } from "@utils"; +import { useNotificationStatus } from "@logics_common"; + +export const useTranslation = () => { + const { t } = useI18n(); + const { asyncStdoutToPython } = useStdoutToPython(); + const { showNotification_Success, showNotification_Error } = useNotificationStatus(); + + const { currentCTranslate2WeightTypeStatus, updateCTranslate2WeightTypeStatus, pendingCTranslate2WeightTypeStatus } = useStore_CTranslate2WeightTypeStatus(); + const { currentSelectedCTranslate2WeightType, updateSelectedCTranslate2WeightType, pendingSelectedCTranslate2WeightType } = useStore_SelectedCTranslate2WeightType(); + const { currentSelectableCTranslate2ComputeDeviceList, updateSelectableCTranslate2ComputeDeviceList, pendingSelectableCTranslate2ComputeDeviceList } = useStore_SelectableCTranslate2ComputeDeviceList(); + const { currentSelectedCTranslate2ComputeDevice, updateSelectedCTranslate2ComputeDevice, pendingSelectedCTranslate2ComputeDevice } = useStore_SelectedCTranslate2ComputeDevice(); + const { currentDeepLAuthKey, updateDeepLAuthKey, pendingDeepLAuthKey } = useStore_DeepLAuthKey(); + + + const updateDownloadedCTranslate2WeightTypeStatus = (downloaded_weight_type_status) => { + updateCTranslate2WeightTypeStatus((old_status) => + old_status.data.map((item) => ({ + ...item, + is_downloaded: downloaded_weight_type_status[item.id] ?? item.is_downloaded, + })) + ); + }; + const updateDownloadProgressCTranslate2WeightTypeStatus = (payload) => { + if (payload === true) return console.error("fix me."); + + updateCTranslate2WeightTypeStatus((old_status) => + old_status.data.map((item) => + payload.weight_type === item.id + ? { ...item, progress: payload.progress * 100 } + : item + ) + ); + }; + const pendingCTranslate2WeightType = (id) => { + updateCTranslate2WeightTypeStatus((old_status) => + old_status.data.map((item) => + id === item.id + ? { ...item, is_pending: true } + : item + ) + ); + }; + const downloadedCTranslate2WeightType = (id) => { + updateCTranslate2WeightTypeStatus((old_status) => + old_status.data.map((item) => + id === item.id + ? { ...item, is_downloaded: true, is_pending: false, progress: null } + : item + ) + ); + }; + const downloadCTranslate2Weight = (weight_type) => { + asyncStdoutToPython("/run/download_ctranslate2_weight", weight_type); + }; + + + const getSelectedCTranslate2WeightType = () => { + pendingSelectedCTranslate2WeightType(); + asyncStdoutToPython("/get/data/ctranslate2_weight_type"); + }; + + const setSelectedCTranslate2WeightType = (selected_ctranslate2_weight_type) => { + pendingSelectedCTranslate2WeightType(); + asyncStdoutToPython("/set/data/ctranslate2_weight_type", selected_ctranslate2_weight_type); + }; + + + const getSelectableCTranslate2ComputeDeviceList = () => { + pendingSelectableCTranslate2ComputeDeviceList(); + asyncStdoutToPython("/get/data/translation_compute_device_list"); + }; + + const updateSelectableCTranslate2ComputeDeviceList_FromBackend = (payload) => { + updateSelectableCTranslate2ComputeDeviceList(transformToIndexedArray(payload)); + }; + + + const getSelectedCTranslate2ComputeDevice = () => { + pendingSelectedCTranslate2ComputeDevice(); + asyncStdoutToPython("/get/data/selected_translation_compute_device"); + }; + + const setSelectedCTranslate2ComputeDevice = (selected_translation_compute_device) => { + pendingSelectedCTranslate2ComputeDevice(); + asyncStdoutToPython("/set/data/selected_translation_compute_device", selected_translation_compute_device); + }; + + + const getDeepLAuthKey = () => { + pendingDeepLAuthKey(); + asyncStdoutToPython("/get/data/deepl_auth_key"); + }; + + const setDeepLAuthKey = (selected_deepl_auth_key) => { + pendingDeepLAuthKey(); + asyncStdoutToPython("/set/data/deepl_auth_key", selected_deepl_auth_key); + }; + + const deleteDeepLAuthKey = () => { + pendingDeepLAuthKey(); + asyncStdoutToPython("/delete/data/deepl_auth_key"); + }; + const deletedDeepLAuthKey = () => { + updateDeepLAuthKey(""); + }; + + const savedDeepLAuthKey = (data) => { + updateDeepLAuthKey(data); + showNotification_Success(t("config_page.translation.deepl_auth_key.auth_key_success")); + }; + + + return { + currentCTranslate2WeightTypeStatus, + updateCTranslate2WeightTypeStatus, + updateDownloadedCTranslate2WeightTypeStatus, + updateDownloadProgressCTranslate2WeightTypeStatus, + pendingCTranslate2WeightType, + downloadedCTranslate2WeightType, + downloadCTranslate2Weight, + + currentSelectedCTranslate2WeightType, + getSelectedCTranslate2WeightType, + updateSelectedCTranslate2WeightType, + setSelectedCTranslate2WeightType, + + currentSelectableCTranslate2ComputeDeviceList, + getSelectableCTranslate2ComputeDeviceList, + updateSelectableCTranslate2ComputeDeviceList, + updateSelectableCTranslate2ComputeDeviceList_FromBackend, + + currentSelectedCTranslate2ComputeDevice, + getSelectedCTranslate2ComputeDevice, + updateSelectedCTranslate2ComputeDevice, + setSelectedCTranslate2ComputeDevice, + + currentDeepLAuthKey, + getDeepLAuthKey, + updateDeepLAuthKey, + setDeepLAuthKey, + deleteDeepLAuthKey, + deletedDeepLAuthKey, + savedDeepLAuthKey, + }; +}; \ No newline at end of file diff --git a/src-ui/logics/configs/vr/useIsEnabledOverlayLargeLog.js b/src-ui/logics/configs/vr/useIsEnabledOverlayLargeLog.js deleted file mode 100644 index c66e865f..00000000 --- a/src-ui/logics/configs/vr/useIsEnabledOverlayLargeLog.js +++ /dev/null @@ -1,28 +0,0 @@ -import { useStore_IsEnabledOverlayLargeLog } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useIsEnabledOverlayLargeLog = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentIsEnabledOverlayLargeLog, updateIsEnabledOverlayLargeLog, pendingIsEnabledOverlayLargeLog } = useStore_IsEnabledOverlayLargeLog(); - - const getIsEnabledOverlayLargeLog = () => { - pendingIsEnabledOverlayLargeLog(); - asyncStdoutToPython("/get/data/overlay_large_log"); - }; - - const toggleIsEnabledOverlayLargeLog = () => { - pendingIsEnabledOverlayLargeLog(); - if (currentIsEnabledOverlayLargeLog.data) { - asyncStdoutToPython("/set/disable/overlay_large_log"); - } else { - asyncStdoutToPython("/set/enable/overlay_large_log"); - } - }; - - return { - currentIsEnabledOverlayLargeLog, - getIsEnabledOverlayLargeLog, - updateIsEnabledOverlayLargeLog, - toggleIsEnabledOverlayLargeLog, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/vr/useIsEnabledOverlaySmallLog.js b/src-ui/logics/configs/vr/useIsEnabledOverlaySmallLog.js deleted file mode 100644 index dbdf0247..00000000 --- a/src-ui/logics/configs/vr/useIsEnabledOverlaySmallLog.js +++ /dev/null @@ -1,28 +0,0 @@ -import { useStore_IsEnabledOverlaySmallLog } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useIsEnabledOverlaySmallLog = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentIsEnabledOverlaySmallLog, updateIsEnabledOverlaySmallLog, pendingIsEnabledOverlaySmallLog } = useStore_IsEnabledOverlaySmallLog(); - - const getIsEnabledOverlaySmallLog = () => { - pendingIsEnabledOverlaySmallLog(); - asyncStdoutToPython("/get/data/overlay_small_log"); - }; - - const toggleIsEnabledOverlaySmallLog = () => { - pendingIsEnabledOverlaySmallLog(); - if (currentIsEnabledOverlaySmallLog.data) { - asyncStdoutToPython("/set/disable/overlay_small_log"); - } else { - asyncStdoutToPython("/set/enable/overlay_small_log"); - } - }; - - return { - currentIsEnabledOverlaySmallLog, - getIsEnabledOverlaySmallLog, - updateIsEnabledOverlaySmallLog, - toggleIsEnabledOverlaySmallLog, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/vr/useOverlayLargeLogSettings.js b/src-ui/logics/configs/vr/useOverlayLargeLogSettings.js deleted file mode 100644 index f7a1a577..00000000 --- a/src-ui/logics/configs/vr/useOverlayLargeLogSettings.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_OverlayLargeLogSettings } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useOverlayLargeLogSettings = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentOverlayLargeLogSettings, updateOverlayLargeLogSettings, pendingOverlayLargeLogSettings } = useStore_OverlayLargeLogSettings(); - - const getOverlayLargeLogSettings = () => { - // pendingOverlayLargeLogSettings(); - asyncStdoutToPython("/get/data/overlay_large_log_settings"); - }; - - const setOverlayLargeLogSettings = (overlay_large_log_settings) => { - // pendingOverlayLargeLogSettings(); - asyncStdoutToPython("/set/data/overlay_large_log_settings", overlay_large_log_settings); - }; - - return { - currentOverlayLargeLogSettings, - getOverlayLargeLogSettings, - updateOverlayLargeLogSettings, - setOverlayLargeLogSettings, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/vr/useOverlayShowOnlyTranslatedMessages.js b/src-ui/logics/configs/vr/useOverlayShowOnlyTranslatedMessages.js deleted file mode 100644 index 40e3fc87..00000000 --- a/src-ui/logics/configs/vr/useOverlayShowOnlyTranslatedMessages.js +++ /dev/null @@ -1,28 +0,0 @@ -import { useStore_OverlayShowOnlyTranslatedMessages } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useOverlayShowOnlyTranslatedMessages = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentOverlayShowOnlyTranslatedMessages, updateOverlayShowOnlyTranslatedMessages, pendingOverlayShowOnlyTranslatedMessages } = useStore_OverlayShowOnlyTranslatedMessages(); - - const getOverlayShowOnlyTranslatedMessages = () => { - pendingOverlayShowOnlyTranslatedMessages(); - asyncStdoutToPython("/get/data/overlay_show_only_translated_messages"); - }; - - const toggleOverlayShowOnlyTranslatedMessages = () => { - pendingOverlayShowOnlyTranslatedMessages(); - if (currentOverlayShowOnlyTranslatedMessages.data) { - asyncStdoutToPython("/set/disable/overlay_show_only_translated_messages"); - } else { - asyncStdoutToPython("/set/enable/overlay_show_only_translated_messages"); - } - }; - - return { - currentOverlayShowOnlyTranslatedMessages, - getOverlayShowOnlyTranslatedMessages, - updateOverlayShowOnlyTranslatedMessages, - toggleOverlayShowOnlyTranslatedMessages, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/vr/useOverlaySmallLogSettings.js b/src-ui/logics/configs/vr/useOverlaySmallLogSettings.js deleted file mode 100644 index 7979f5c1..00000000 --- a/src-ui/logics/configs/vr/useOverlaySmallLogSettings.js +++ /dev/null @@ -1,24 +0,0 @@ -import { useStore_OverlaySmallLogSettings } from "@store"; -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useOverlaySmallLogSettings = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - const { currentOverlaySmallLogSettings, updateOverlaySmallLogSettings, pendingOverlaySmallLogSettings } = useStore_OverlaySmallLogSettings(); - - const getOverlaySmallLogSettings = () => { - // pendingOverlaySmallLogSettings(); - asyncStdoutToPython("/get/data/overlay_small_log_settings"); - }; - - const setOverlaySmallLogSettings = (overlay_small_log_settings) => { - // pendingOverlaySmallLogSettings(); - asyncStdoutToPython("/set/data/overlay_small_log_settings", overlay_small_log_settings); - }; - - return { - currentOverlaySmallLogSettings, - getOverlaySmallLogSettings, - updateOverlaySmallLogSettings, - setOverlaySmallLogSettings, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/vr/useSendTextToOverlay.js b/src-ui/logics/configs/vr/useSendTextToOverlay.js deleted file mode 100644 index f109e3ad..00000000 --- a/src-ui/logics/configs/vr/useSendTextToOverlay.js +++ /dev/null @@ -1,13 +0,0 @@ -import { useStdoutToPython } from "@useStdoutToPython"; - -export const useSendTextToOverlay = () => { - const { asyncStdoutToPython } = useStdoutToPython(); - - const sendTextToOverlay = (text) => { - asyncStdoutToPython("/run/send_text_overlay", text); - }; - - return { - sendTextToOverlay, - }; -}; \ No newline at end of file diff --git a/src-ui/logics/configs/vr/useVr.js b/src-ui/logics/configs/vr/useVr.js new file mode 100644 index 00000000..2f5dd9eb --- /dev/null +++ b/src-ui/logics/configs/vr/useVr.js @@ -0,0 +1,120 @@ +import { + useStore_IsEnabledOverlaySmallLog, + useStore_IsEnabledOverlayLargeLog, + useStore_OverlaySmallLogSettings, + useStore_OverlayLargeLogSettings, + useStore_OverlayShowOnlyTranslatedMessages, +} from "@store"; +import { useStdoutToPython } from "@useStdoutToPython"; + +export const useVr = () => { + const { asyncStdoutToPython } = useStdoutToPython(); + + const { currentIsEnabledOverlaySmallLog, updateIsEnabledOverlaySmallLog, pendingIsEnabledOverlaySmallLog } = useStore_IsEnabledOverlaySmallLog(); + const { currentIsEnabledOverlayLargeLog, updateIsEnabledOverlayLargeLog, pendingIsEnabledOverlayLargeLog } = useStore_IsEnabledOverlayLargeLog(); + const { currentOverlaySmallLogSettings, updateOverlaySmallLogSettings, pendingOverlaySmallLogSettings } = useStore_OverlaySmallLogSettings(); + const { currentOverlayLargeLogSettings, updateOverlayLargeLogSettings, pendingOverlayLargeLogSettings } = useStore_OverlayLargeLogSettings(); + const { currentOverlayShowOnlyTranslatedMessages, updateOverlayShowOnlyTranslatedMessages, pendingOverlayShowOnlyTranslatedMessages } = useStore_OverlayShowOnlyTranslatedMessages(); + + + const getIsEnabledOverlaySmallLog = () => { + pendingIsEnabledOverlaySmallLog(); + asyncStdoutToPython("/get/data/overlay_small_log"); + }; + + const toggleIsEnabledOverlaySmallLog = () => { + pendingIsEnabledOverlaySmallLog(); + if (currentIsEnabledOverlaySmallLog.data) { + asyncStdoutToPython("/set/disable/overlay_small_log"); + } else { + asyncStdoutToPython("/set/enable/overlay_small_log"); + } + }; + + + const getIsEnabledOverlayLargeLog = () => { + pendingIsEnabledOverlayLargeLog(); + asyncStdoutToPython("/get/data/overlay_large_log"); + }; + + const toggleIsEnabledOverlayLargeLog = () => { + pendingIsEnabledOverlayLargeLog(); + if (currentIsEnabledOverlayLargeLog.data) { + asyncStdoutToPython("/set/disable/overlay_large_log"); + } else { + asyncStdoutToPython("/set/enable/overlay_large_log"); + } + }; + + + const getOverlaySmallLogSettings = () => { + // pendingOverlaySmallLogSettings(); + asyncStdoutToPython("/get/data/overlay_small_log_settings"); + }; + + const setOverlaySmallLogSettings = (overlay_small_log_settings) => { + // pendingOverlaySmallLogSettings(); + asyncStdoutToPython("/set/data/overlay_small_log_settings", overlay_small_log_settings); + }; + + + const getOverlayLargeLogSettings = () => { + // pendingOverlayLargeLogSettings(); + asyncStdoutToPython("/get/data/overlay_large_log_settings"); + }; + + const setOverlayLargeLogSettings = (overlay_large_log_settings) => { + // pendingOverlayLargeLogSettings(); + asyncStdoutToPython("/set/data/overlay_large_log_settings", overlay_large_log_settings); + }; + + + const getOverlayShowOnlyTranslatedMessages = () => { + pendingOverlayShowOnlyTranslatedMessages(); + asyncStdoutToPython("/get/data/overlay_show_only_translated_messages"); + }; + + const toggleOverlayShowOnlyTranslatedMessages = () => { + pendingOverlayShowOnlyTranslatedMessages(); + if (currentOverlayShowOnlyTranslatedMessages.data) { + asyncStdoutToPython("/set/disable/overlay_show_only_translated_messages"); + } else { + asyncStdoutToPython("/set/enable/overlay_show_only_translated_messages"); + } + }; + + + const sendTextToOverlay = (text) => { + asyncStdoutToPython("/run/send_text_overlay", text); + }; + + + return { + currentIsEnabledOverlaySmallLog, + getIsEnabledOverlaySmallLog, + updateIsEnabledOverlaySmallLog, + toggleIsEnabledOverlaySmallLog, + + currentIsEnabledOverlayLargeLog, + getIsEnabledOverlayLargeLog, + updateIsEnabledOverlayLargeLog, + toggleIsEnabledOverlayLargeLog, + + currentOverlaySmallLogSettings, + getOverlaySmallLogSettings, + updateOverlaySmallLogSettings, + setOverlaySmallLogSettings, + + currentOverlayLargeLogSettings, + getOverlayLargeLogSettings, + updateOverlayLargeLogSettings, + setOverlayLargeLogSettings, + + currentOverlayShowOnlyTranslatedMessages, + getOverlayShowOnlyTranslatedMessages, + updateOverlayShowOnlyTranslatedMessages, + toggleOverlayShowOnlyTranslatedMessages, + + sendTextToOverlay, + }; +}; \ No newline at end of file diff --git a/src-ui/logics/useReceiveRoutes.js b/src-ui/logics/useReceiveRoutes.js index a4a1ad87..a956ba6e 100644 --- a/src-ui/logics/useReceiveRoutes.js +++ b/src-ui/logics/useReceiveRoutes.js @@ -137,140 +137,141 @@ export const ROUTE_META_LIST = [ // Appearance - { endpoint: "/get/data/ui_language", ns: configs, hook_name: "useUiLanguage", method_name: "updateUiLanguage" }, - { endpoint: "/set/data/ui_language", ns: configs, hook_name: "useUiLanguage", method_name: "updateUiLanguage" }, + { endpoint: "/get/data/ui_language", ns: configs, hook_name: "useAppearance", method_name: "updateUiLanguage" }, + { endpoint: "/set/data/ui_language", ns: configs, hook_name: "useAppearance", method_name: "updateUiLanguage" }, - { endpoint: "/get/data/ui_scaling", ns: configs, hook_name: "useUiScaling", method_name: "updateUiScaling" }, - { endpoint: "/set/data/ui_scaling", ns: configs, hook_name: "useUiScaling", method_name: "updateUiScaling" }, + { endpoint: "/get/data/ui_scaling", ns: configs, hook_name: "useAppearance", method_name: "updateUiScaling" }, + { endpoint: "/set/data/ui_scaling", ns: configs, hook_name: "useAppearance", method_name: "updateUiScaling" }, - { endpoint: "/get/data/textbox_ui_scaling", ns: configs, hook_name: "useMessageLogUiScaling", method_name: "updateMessageLogUiScaling" }, - { endpoint: "/set/data/textbox_ui_scaling", ns: configs, hook_name: "useMessageLogUiScaling", method_name: "updateMessageLogUiScaling" }, + { endpoint: "/get/data/textbox_ui_scaling", ns: configs, hook_name: "useAppearance", method_name: "updateMessageLogUiScaling" }, + { endpoint: "/set/data/textbox_ui_scaling", ns: configs, hook_name: "useAppearance", method_name: "updateMessageLogUiScaling" }, - { endpoint: "/get/data/send_message_button_type", ns: configs, hook_name: "useSendMessageButtonType", method_name: "updateSendMessageButtonType" }, - { endpoint: "/set/data/send_message_button_type", ns: configs, hook_name: "useSendMessageButtonType", method_name: "updateSendMessageButtonType" }, + { endpoint: "/get/data/send_message_button_type", ns: configs, hook_name: "useAppearance", method_name: "updateSendMessageButtonType" }, + { endpoint: "/set/data/send_message_button_type", ns: configs, hook_name: "useAppearance", method_name: "updateSendMessageButtonType" }, - { endpoint: "/get/data/show_resend_button", ns: configs, hook_name: "useShowResendButton", method_name: "updateShowResendButton" }, - { endpoint: "/set/enable/show_resend_button", ns: configs, hook_name: "useShowResendButton", method_name: "updateShowResendButton" }, - { endpoint: "/set/disable/show_resend_button", ns: configs, hook_name: "useShowResendButton", method_name: "updateShowResendButton" }, + { endpoint: "/get/data/show_resend_button", ns: configs, hook_name: "useAppearance", method_name: "updateShowResendButton" }, + { endpoint: "/set/enable/show_resend_button", ns: configs, hook_name: "useAppearance", method_name: "updateShowResendButton" }, + { endpoint: "/set/disable/show_resend_button", ns: configs, hook_name: "useAppearance", method_name: "updateShowResendButton" }, - { endpoint: "/get/data/font_family", ns: configs, hook_name: "useSelectedFontFamily", method_name: "updateSelectedFontFamily" }, - { endpoint: "/set/data/font_family", ns: configs, hook_name: "useSelectedFontFamily", method_name: "updateSelectedFontFamily" }, + { endpoint: "/get/data/font_family", ns: configs, hook_name: "useAppearance", method_name: "updateSelectedFontFamily" }, + { endpoint: "/set/data/font_family", ns: configs, hook_name: "useAppearance", method_name: "updateSelectedFontFamily" }, - { endpoint: "/get/data/transparency", ns: configs, hook_name: "useTransparency", method_name: "updateTransparency" }, - { endpoint: "/set/data/transparency", ns: configs, hook_name: "useTransparency", method_name: "updateTransparency" }, + { endpoint: "/get/data/transparency", ns: configs, hook_name: "useAppearance", method_name: "updateTransparency" }, + { endpoint: "/set/data/transparency", ns: configs, hook_name: "useAppearance", method_name: "updateTransparency" }, // Translation - { endpoint: "/get/data/deepl_auth_key", ns: configs, hook_name: "useDeepLAuthKey", method_name: "updateDeepLAuthKey" }, - { endpoint: "/set/data/deepl_auth_key", ns: configs, hook_name: "useDeepLAuthKey", method_name: "savedDeepLAuthKey" }, - { endpoint: "/delete/data/deepl_auth_key", ns: configs, hook_name: "useDeepLAuthKey", method_name: "deletedDeepLAuthKey" }, + { endpoint: "/get/data/deepl_auth_key", ns: configs, hook_name: "useTranslation", method_name: "updateDeepLAuthKey" }, + { endpoint: "/set/data/deepl_auth_key", ns: configs, hook_name: "useTranslation", method_name: "savedDeepLAuthKey" }, + { endpoint: "/delete/data/deepl_auth_key", ns: configs, hook_name: "useTranslation", method_name: "deletedDeepLAuthKey" }, // Translation (AI Models) - { endpoint: "/get/data/ctranslate2_weight_type", ns: configs, hook_name: "useSelectedCTranslate2WeightType", method_name: "updateSelectedCTranslate2WeightType" }, - { endpoint: "/set/data/ctranslate2_weight_type", ns: configs, hook_name: "useSelectedCTranslate2WeightType", method_name: "updateSelectedCTranslate2WeightType" }, + { endpoint: "/get/data/ctranslate2_weight_type", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedCTranslate2WeightType" }, + { endpoint: "/set/data/ctranslate2_weight_type", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedCTranslate2WeightType" }, - { endpoint: "/get/data/selectable_ctranslate2_weight_type_dict", ns: configs, hook_name: "useCTranslate2WeightTypeStatus", method_name: "updateDownloadedCTranslate2WeightTypeStatus" }, + { endpoint: "/get/data/selectable_ctranslate2_weight_type_dict", ns: configs, hook_name: "useTranslation", method_name: "updateDownloadedCTranslate2WeightTypeStatus" }, - { endpoint: "/get/data/translation_compute_device_list", ns: configs, hook_name: "useSelectableCTranslate2ComputeDeviceList", method_name: "updateSelectableCTranslate2ComputeDeviceList_FromBackend" }, - - { endpoint: "/get/data/selected_translation_compute_device", ns: configs, hook_name: "useSelectedCTranslate2ComputeDevice", method_name: "updateSelectedCTranslate2ComputeDevice" }, - { endpoint: "/set/data/selected_translation_compute_device", ns: configs, hook_name: "useSelectedCTranslate2ComputeDevice", method_name: "updateSelectedCTranslate2ComputeDevice" }, - - { endpoint: "/run/downloaded_ctranslate2_weight", ns: configs, hook_name: "useCTranslate2WeightTypeStatus", method_name: "downloadedCTranslate2WeightType" }, + { endpoint: "/run/downloaded_ctranslate2_weight", ns: configs, hook_name: "useTranslation", method_name: "downloadedCTranslate2WeightType" }, { endpoint: "/run/download_ctranslate2_weight", ns: null, hook_name: null, method_name: null }, - { endpoint: "/run/download_progress_ctranslate2_weight", ns: configs, hook_name: "useCTranslate2WeightTypeStatus", method_name: "updateDownloadProgressCTranslate2WeightTypeStatus" }, + { endpoint: "/run/download_progress_ctranslate2_weight", ns: configs, hook_name: "useTranslation", method_name: "updateDownloadProgressCTranslate2WeightTypeStatus" }, + + { endpoint: "/get/data/translation_compute_device_list", ns: configs, hook_name: "useTranslation", method_name: "updateSelectableCTranslate2ComputeDeviceList_FromBackend" }, + + { endpoint: "/get/data/selected_translation_compute_device", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedCTranslate2ComputeDevice" }, + { endpoint: "/set/data/selected_translation_compute_device", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedCTranslate2ComputeDevice" }, + // Transcription // Transcription (Mic) - { endpoint: "/get/data/mic_record_timeout", ns: configs, hook_name: "useMicRecordTimeout", method_name: "updateMicRecordTimeout" }, - { endpoint: "/set/data/mic_record_timeout", ns: configs, hook_name: "useMicRecordTimeout", method_name: "updateMicRecordTimeout" }, + { endpoint: "/get/data/mic_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateMicRecordTimeout" }, + { endpoint: "/set/data/mic_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateMicRecordTimeout" }, - { endpoint: "/get/data/mic_phrase_timeout", ns: configs, hook_name: "useMicPhraseTimeout", method_name: "updateMicPhraseTimeout" }, - { endpoint: "/set/data/mic_phrase_timeout", ns: configs, hook_name: "useMicPhraseTimeout", method_name: "updateMicPhraseTimeout" }, + { endpoint: "/get/data/mic_phrase_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateMicPhraseTimeout" }, + { endpoint: "/set/data/mic_phrase_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateMicPhraseTimeout" }, - { endpoint: "/get/data/mic_max_phrases", ns: configs, hook_name: "useMicMaxWords", method_name: "updateMicMaxWords" }, - { endpoint: "/set/data/mic_max_phrases", ns: configs, hook_name: "useMicMaxWords", method_name: "updateMicMaxWords" }, + { endpoint: "/get/data/mic_max_phrases", ns: configs, hook_name: "useTranscription", method_name: "updateMicMaxWords" }, + { endpoint: "/set/data/mic_max_phrases", ns: configs, hook_name: "useTranscription", method_name: "updateMicMaxWords" }, - { endpoint: "/get/data/mic_word_filter", ns: configs, hook_name: "useMicWordFilterList", method_name: "updateMicWordFilterList_FromBackend" }, - { endpoint: "/set/data/mic_word_filter", ns: configs, hook_name: "useMicWordFilterList", method_name: "updateMicWordFilterList_FromBackend" }, + { endpoint: "/get/data/mic_word_filter", ns: configs, hook_name: "useTranscription", method_name: "updateMicWordFilterList_FromBackend" }, + { endpoint: "/set/data/mic_word_filter", ns: configs, hook_name: "useTranscription", method_name: "updateMicWordFilterList_FromBackend" }, // Transcription (Speaker) - { endpoint: "/get/data/speaker_record_timeout", ns: configs, hook_name: "useSpeakerRecordTimeout", method_name: "updateSpeakerRecordTimeout" }, - { endpoint: "/set/data/speaker_record_timeout", ns: configs, hook_name: "useSpeakerRecordTimeout", method_name: "updateSpeakerRecordTimeout" }, + { endpoint: "/get/data/speaker_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerRecordTimeout" }, + { endpoint: "/set/data/speaker_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerRecordTimeout" }, - { endpoint: "/get/data/speaker_phrase_timeout", ns: configs, hook_name: "useSpeakerPhraseTimeout", method_name: "updateSpeakerPhraseTimeout" }, - { endpoint: "/set/data/speaker_phrase_timeout", ns: configs, hook_name: "useSpeakerPhraseTimeout", method_name: "updateSpeakerPhraseTimeout" }, + { endpoint: "/get/data/speaker_phrase_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerPhraseTimeout" }, + { endpoint: "/set/data/speaker_phrase_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerPhraseTimeout" }, - { endpoint: "/get/data/speaker_max_phrases", ns: configs, hook_name: "useSpeakerMaxWords", method_name: "updateSpeakerMaxWords" }, - { endpoint: "/set/data/speaker_max_phrases", ns: configs, hook_name: "useSpeakerMaxWords", method_name: "updateSpeakerMaxWords" }, + { endpoint: "/get/data/speaker_max_phrases", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerMaxWords" }, + { endpoint: "/set/data/speaker_max_phrases", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerMaxWords" }, // Transcription (AI Models) - { endpoint: "/get/data/selected_transcription_engine", ns: configs, hook_name: "useSelectedTranscriptionEngine", method_name: "updateSelectedTranscriptionEngine" }, - { endpoint: "/set/data/selected_transcription_engine", ns: configs, hook_name: "useSelectedTranscriptionEngine", method_name: "updateSelectedTranscriptionEngine" }, + { endpoint: "/get/data/selected_transcription_engine", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionEngine" }, + { endpoint: "/set/data/selected_transcription_engine", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionEngine" }, - { endpoint: "/get/data/whisper_weight_type", ns: configs, hook_name: "useSelectedWhisperWeightType", method_name: "updateSelectedWhisperWeightType" }, - { endpoint: "/set/data/whisper_weight_type", ns: configs, hook_name: "useSelectedWhisperWeightType", method_name: "updateSelectedWhisperWeightType" }, + { endpoint: "/get/data/whisper_weight_type", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperWeightType" }, + { endpoint: "/set/data/whisper_weight_type", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperWeightType" }, - { endpoint: "/get/data/selectable_whisper_weight_type_dict", ns: configs, hook_name: "useWhisperWeightTypeStatus", method_name: "updateDownloadedWhisperWeightTypeStatus" }, + { endpoint: "/get/data/selectable_whisper_weight_type_dict", ns: configs, hook_name: "useTranscription", method_name: "updateDownloadedWhisperWeightTypeStatus" }, - { endpoint: "/run/downloaded_whisper_weight", ns: configs, hook_name: "useWhisperWeightTypeStatus", method_name: "downloadedWhisperWeightType" }, + { endpoint: "/run/downloaded_whisper_weight", ns: configs, hook_name: "useTranscription", method_name: "downloadedWhisperWeightType" }, { endpoint: "/run/download_whisper_weight", ns: null, hook_name: null, method_name: null }, - { endpoint: "/run/download_progress_whisper_weight", ns: configs, hook_name: "useWhisperWeightTypeStatus", method_name: "updateDownloadProgressWhisperWeightTypeStatus" }, + { endpoint: "/run/download_progress_whisper_weight", ns: configs, hook_name: "useTranscription", method_name: "updateDownloadProgressWhisperWeightTypeStatus" }, - { endpoint: "/get/data/transcription_compute_device_list", ns: configs, hook_name: "useSelectableWhisperComputeDeviceList", method_name: "updateSelectableWhisperComputeDeviceList_FromBackend" }, - { endpoint: "/get/data/selected_transcription_compute_device", ns: configs, hook_name: "useSelectedWhisperComputeDevice", method_name: "updateSelectedWhisperComputeDevice" }, - { endpoint: "/set/data/selected_transcription_compute_device", ns: configs, hook_name: "useSelectedWhisperComputeDevice", method_name: "updateSelectedWhisperComputeDevice" }, + { endpoint: "/get/data/transcription_compute_device_list", ns: configs, hook_name: "useTranscription", method_name: "updateSelectableWhisperComputeDeviceList_FromBackend" }, + { endpoint: "/get/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperComputeDevice" }, + { endpoint: "/set/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperComputeDevice" }, // VR - { endpoint: "/get/data/overlay_small_log", ns: configs, hook_name: "useIsEnabledOverlaySmallLog", method_name: "updateIsEnabledOverlaySmallLog" }, - { endpoint: "/set/enable/overlay_small_log", ns: configs, hook_name: "useIsEnabledOverlaySmallLog", method_name: "updateIsEnabledOverlaySmallLog" }, - { endpoint: "/set/disable/overlay_small_log", ns: configs, hook_name: "useIsEnabledOverlaySmallLog", method_name: "updateIsEnabledOverlaySmallLog" }, + { endpoint: "/get/data/overlay_small_log", ns: configs, hook_name: "useVr", method_name: "updateIsEnabledOverlaySmallLog" }, + { endpoint: "/set/enable/overlay_small_log", ns: configs, hook_name: "useVr", method_name: "updateIsEnabledOverlaySmallLog" }, + { endpoint: "/set/disable/overlay_small_log", ns: configs, hook_name: "useVr", method_name: "updateIsEnabledOverlaySmallLog" }, - { endpoint: "/get/data/overlay_small_log_settings", ns: configs, hook_name: "useOverlaySmallLogSettings", method_name: "updateOverlaySmallLogSettings" }, - { endpoint: "/set/data/overlay_small_log_settings", ns: configs, hook_name: "useOverlaySmallLogSettings", method_name: "updateOverlaySmallLogSettings" }, + { endpoint: "/get/data/overlay_small_log_settings", ns: configs, hook_name: "useVr", method_name: "updateOverlaySmallLogSettings" }, + { endpoint: "/set/data/overlay_small_log_settings", ns: configs, hook_name: "useVr", method_name: "updateOverlaySmallLogSettings" }, - { endpoint: "/get/data/overlay_large_log", ns: configs, hook_name: "useIsEnabledOverlayLargeLog", method_name: "updateIsEnabledOverlayLargeLog" }, - { endpoint: "/set/enable/overlay_large_log", ns: configs, hook_name: "useIsEnabledOverlayLargeLog", method_name: "updateIsEnabledOverlayLargeLog" }, - { endpoint: "/set/disable/overlay_large_log", ns: configs, hook_name: "useIsEnabledOverlayLargeLog", method_name: "updateIsEnabledOverlayLargeLog" }, + { endpoint: "/get/data/overlay_large_log", ns: configs, hook_name: "useVr", method_name: "updateIsEnabledOverlayLargeLog" }, + { endpoint: "/set/enable/overlay_large_log", ns: configs, hook_name: "useVr", method_name: "updateIsEnabledOverlayLargeLog" }, + { endpoint: "/set/disable/overlay_large_log", ns: configs, hook_name: "useVr", method_name: "updateIsEnabledOverlayLargeLog" }, - { endpoint: "/get/data/overlay_large_log_settings", ns: configs, hook_name: "useOverlayLargeLogSettings", method_name: "updateOverlayLargeLogSettings" }, - { endpoint: "/set/data/overlay_large_log_settings", ns: configs, hook_name: "useOverlayLargeLogSettings", method_name: "updateOverlayLargeLogSettings" }, + { endpoint: "/get/data/overlay_large_log_settings", ns: configs, hook_name: "useVr", method_name: "updateOverlayLargeLogSettings" }, + { endpoint: "/set/data/overlay_large_log_settings", ns: configs, hook_name: "useVr", method_name: "updateOverlayLargeLogSettings" }, - { endpoint: "/get/data/overlay_show_only_translated_messages", ns: configs, hook_name: "useOverlayShowOnlyTranslatedMessages", method_name: "updateOverlayShowOnlyTranslatedMessages" }, - { endpoint: "/set/enable/overlay_show_only_translated_messages", ns: configs, hook_name: "useOverlayShowOnlyTranslatedMessages", method_name: "updateOverlayShowOnlyTranslatedMessages" }, - { endpoint: "/set/disable/overlay_show_only_translated_messages", ns: configs, hook_name: "useOverlayShowOnlyTranslatedMessages", method_name: "updateOverlayShowOnlyTranslatedMessages" }, + { endpoint: "/get/data/overlay_show_only_translated_messages", ns: configs, hook_name: "useVr", method_name: "updateOverlayShowOnlyTranslatedMessages" }, + { endpoint: "/set/enable/overlay_show_only_translated_messages", ns: configs, hook_name: "useVr", method_name: "updateOverlayShowOnlyTranslatedMessages" }, + { endpoint: "/set/disable/overlay_show_only_translated_messages", ns: configs, hook_name: "useVr", method_name: "updateOverlayShowOnlyTranslatedMessages" }, { endpoint: "/run/send_text_overlay", ns: null, hook_name: null, method_name: null }, // Others - { endpoint: "/get/data/auto_clear_message_box", ns: configs, hook_name: "useEnableAutoClearMessageInputBox", method_name: "updateEnableAutoClearMessageInputBox" }, - { endpoint: "/set/enable/auto_clear_message_box", ns: configs, hook_name: "useEnableAutoClearMessageInputBox", method_name: "updateEnableAutoClearMessageInputBox" }, - { endpoint: "/set/disable/auto_clear_message_box", ns: configs, hook_name: "useEnableAutoClearMessageInputBox", method_name: "updateEnableAutoClearMessageInputBox" }, + { endpoint: "/get/data/auto_clear_message_box", ns: configs, hook_name: "useOthers", method_name: "updateEnableAutoClearMessageInputBox" }, + { endpoint: "/set/enable/auto_clear_message_box", ns: configs, hook_name: "useOthers", method_name: "updateEnableAutoClearMessageInputBox" }, + { endpoint: "/set/disable/auto_clear_message_box", ns: configs, hook_name: "useOthers", method_name: "updateEnableAutoClearMessageInputBox" }, - { endpoint: "/get/data/send_only_translated_messages", ns: configs, hook_name: "useEnableSendOnlyTranslatedMessages", method_name: "updateEnableSendOnlyTranslatedMessages" }, - { endpoint: "/set/enable/send_only_translated_messages", ns: configs, hook_name: "useEnableSendOnlyTranslatedMessages", method_name: "updateEnableSendOnlyTranslatedMessages" }, - { endpoint: "/set/disable/send_only_translated_messages", ns: configs, hook_name: "useEnableSendOnlyTranslatedMessages", method_name: "updateEnableSendOnlyTranslatedMessages" }, + { endpoint: "/get/data/send_only_translated_messages", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendOnlyTranslatedMessages" }, + { endpoint: "/set/enable/send_only_translated_messages", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendOnlyTranslatedMessages" }, + { endpoint: "/set/disable/send_only_translated_messages", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendOnlyTranslatedMessages" }, - { endpoint: "/get/data/logger_feature", ns: configs, hook_name: "useEnableAutoExportMessageLogs", method_name: "updateEnableAutoExportMessageLogs" }, - { endpoint: "/set/enable/logger_feature", ns: configs, hook_name: "useEnableAutoExportMessageLogs", method_name: "updateEnableAutoExportMessageLogs" }, - { endpoint: "/set/disable/logger_feature", ns: configs, hook_name: "useEnableAutoExportMessageLogs", method_name: "updateEnableAutoExportMessageLogs" }, + { endpoint: "/get/data/logger_feature", ns: configs, hook_name: "useOthers", method_name: "updateEnableAutoExportMessageLogs" }, + { endpoint: "/set/enable/logger_feature", ns: configs, hook_name: "useOthers", method_name: "updateEnableAutoExportMessageLogs" }, + { endpoint: "/set/disable/logger_feature", ns: configs, hook_name: "useOthers", method_name: "updateEnableAutoExportMessageLogs" }, - { endpoint: "/get/data/vrc_mic_mute_sync", ns: configs, hook_name: "useEnableVrcMicMuteSync", method_name: "updateEnableVrcMicMuteSync_FromBackend" }, - { endpoint: "/set/enable/vrc_mic_mute_sync", ns: configs, hook_name: "useEnableVrcMicMuteSync", method_name: "updateEnableVrcMicMuteSync_FromBackend" }, - { endpoint: "/set/disable/vrc_mic_mute_sync", ns: configs, hook_name: "useEnableVrcMicMuteSync", method_name: "updateEnableVrcMicMuteSync_FromBackend" }, + { endpoint: "/get/data/vrc_mic_mute_sync", ns: configs, hook_name: "useOthers", method_name: "updateEnableVrcMicMuteSync_FromBackend" }, + { endpoint: "/set/enable/vrc_mic_mute_sync", ns: configs, hook_name: "useOthers", method_name: "updateEnableVrcMicMuteSync_FromBackend" }, + { endpoint: "/set/disable/vrc_mic_mute_sync", ns: configs, hook_name: "useOthers", method_name: "updateEnableVrcMicMuteSync_FromBackend" }, - { endpoint: "/get/data/send_message_to_vrc", ns: configs, hook_name: "useEnableSendMessageToVrc", method_name: "updateEnableSendMessageToVrc" }, - { endpoint: "/set/enable/send_message_to_vrc", ns: configs, hook_name: "useEnableSendMessageToVrc", method_name: "updateEnableSendMessageToVrc" }, - { endpoint: "/set/disable/send_message_to_vrc", ns: configs, hook_name: "useEnableSendMessageToVrc", method_name: "updateEnableSendMessageToVrc" }, + { endpoint: "/get/data/send_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendMessageToVrc" }, + { endpoint: "/set/enable/send_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendMessageToVrc" }, + { endpoint: "/set/disable/send_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendMessageToVrc" }, - { endpoint: "/get/data/send_received_message_to_vrc", ns: configs, hook_name: "useEnableSendReceivedMessageToVrc", method_name: "updateEnableSendReceivedMessageToVrc" }, - { endpoint: "/set/enable/send_received_message_to_vrc", ns: configs, hook_name: "useEnableSendReceivedMessageToVrc", method_name: "updateEnableSendReceivedMessageToVrc" }, - { endpoint: "/set/disable/send_received_message_to_vrc", ns: configs, hook_name: "useEnableSendReceivedMessageToVrc", method_name: "updateEnableSendReceivedMessageToVrc" }, + { endpoint: "/get/data/send_received_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendReceivedMessageToVrc" }, + { endpoint: "/set/enable/send_received_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendReceivedMessageToVrc" }, + { endpoint: "/set/disable/send_received_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendReceivedMessageToVrc" }, - { endpoint: "/get/data/notification_vrc_sfx", ns: configs, hook_name: "useEnableNotificationVrcSfx", method_name: "updateEnableNotificationVrcSfx" }, - { endpoint: "/set/enable/notification_vrc_sfx", ns: configs, hook_name: "useEnableNotificationVrcSfx", method_name: "updateEnableNotificationVrcSfx" }, - { endpoint: "/set/disable/notification_vrc_sfx", ns: configs, hook_name: "useEnableNotificationVrcSfx", method_name: "updateEnableNotificationVrcSfx" }, + { endpoint: "/get/data/notification_vrc_sfx", ns: configs, hook_name: "useOthers", method_name: "updateEnableNotificationVrcSfx" }, + { endpoint: "/set/enable/notification_vrc_sfx", ns: configs, hook_name: "useOthers", method_name: "updateEnableNotificationVrcSfx" }, + { endpoint: "/set/disable/notification_vrc_sfx", ns: configs, hook_name: "useOthers", method_name: "updateEnableNotificationVrcSfx" }, // Hotkeys { endpoint: "/get/data/hotkeys", ns: configs, hook_name: "useHotkeys", method_name: "updateHotkeys" }, @@ -281,21 +282,21 @@ export const ROUTE_META_LIST = [ { endpoint: "/set/data/plugins_status", ns: configs, hook_name: "usePlugins", method_name: "updateSavedPluginsStatus" }, // Advanced Settings - { endpoint: "/get/data/osc_ip_address", ns: configs, hook_name: "useOscIpAddress", method_name: "updateOscIpAddress" }, - { endpoint: "/set/data/osc_ip_address", ns: configs, hook_name: "useOscIpAddress", method_name: "updateOscIpAddress" }, + { endpoint: "/get/data/osc_ip_address", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateOscIpAddress" }, + { endpoint: "/set/data/osc_ip_address", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateOscIpAddress" }, - { endpoint: "/get/data/osc_port", ns: configs, hook_name: "useOscPort", method_name: "updateOscPort" }, - { endpoint: "/set/data/osc_port", ns: configs, hook_name: "useOscPort", method_name: "updateOscPort" }, + { endpoint: "/get/data/osc_port", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateOscPort" }, + { endpoint: "/set/data/osc_port", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateOscPort" }, - { endpoint: "/get/data/websocket_server", ns: configs, hook_name: "useWebsocket", method_name: "updateEnableWebsocket" }, - { endpoint: "/set/enable/websocket_server", ns: configs, hook_name: "useWebsocket", method_name: "updateEnableWebsocket" }, - { endpoint: "/set/disable/websocket_server", ns: configs, hook_name: "useWebsocket", method_name: "updateEnableWebsocket" }, + { endpoint: "/get/data/websocket_server", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateEnableWebsocket" }, + { endpoint: "/set/enable/websocket_server", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateEnableWebsocket" }, + { endpoint: "/set/disable/websocket_server", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateEnableWebsocket" }, - { endpoint: "/get/data/websocket_host", ns: configs, hook_name: "useWebsocket", method_name: "updateWebsocketHost" }, - { endpoint: "/set/data/websocket_host", ns: configs, hook_name: "useWebsocket", method_name: "updateWebsocketHost" }, + { endpoint: "/get/data/websocket_host", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateWebsocketHost" }, + { endpoint: "/set/data/websocket_host", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateWebsocketHost" }, - { endpoint: "/get/data/websocket_port", ns: configs, hook_name: "useWebsocket", method_name: "updateWebsocketPort" }, - { endpoint: "/set/data/websocket_port", ns: configs, hook_name: "useWebsocket", method_name: "updateWebsocketPort" }, + { endpoint: "/get/data/websocket_port", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateWebsocketPort" }, + { endpoint: "/set/data/websocket_port", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateWebsocketPort" }, // Not Implemented Yet... diff --git a/vite.config.js b/vite.config.js index 32bd2c51..b678f171 100644 --- a/vite.config.js +++ b/vite.config.js @@ -57,6 +57,8 @@ export default defineConfig(async () => { alias: { "@root": path.resolve(__dirname), + "@useI18n": path.resolve(__dirname, "locales/useI18n.js"), + "@useReceiveRoutes": path.resolve(__dirname, "src-ui/logics/useReceiveRoutes.js"), "@useStdoutToPython": path.resolve(__dirname, "src-ui/logics/useStdoutToPython.js"), From 50bd182d8fbcd7822236c971692f8180d9f1bf7e Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Thu, 19 Jun 2025 09:32:34 +0900 Subject: [PATCH 36/41] [Chore] Remove unused define params in store.js --- src-ui/store.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src-ui/store.js b/src-ui/store.js index 67b52a81..7d2fac28 100644 --- a/src-ui/store.js +++ b/src-ui/store.js @@ -16,12 +16,9 @@ import { export const store = { backend_subprocess: null, - config_page: null, setting_box_scroll_container: null, log_box_ref: null, text_area_ref: null, - is_register_window_geometry_controller: false, - is_applied_init_message_box_height: false, is_initialized_load_plugin: false, is_fetched_plugins_info_already: false, is_initialized_fetched_plugin_info: false, From 1623352c9277b84d126c13470445cfdf00bd0fa9 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 21 Jun 2025 02:35:41 +0900 Subject: [PATCH 37/41] [Update] Add save success notification. --- .../ReactToastifyOverrideClass.scss | 31 ++++ .../SnackbarController.jsx | 43 +++--- src-ui/logics/_useBackendErrorHandling.js | 6 +- src-ui/logics/common/useNotificationStatus.js | 20 ++- .../advanced_settings/useAdvancedSettings.js | 45 +++++- .../configs/appearance/useAppearance.js | 45 ++++++ src-ui/logics/configs/device/useDevice.js | 79 +++++++++-- src-ui/logics/configs/hotkeys/useHotkeys.js | 8 +- src-ui/logics/configs/others/useOthers.js | 47 ++++++- src-ui/logics/configs/plugins/usePlugins.js | 7 +- .../configs/transcription/useTranscription.js | 55 +++++++- .../configs/translation/useTranslation.js | 31 ++-- src-ui/logics/configs/vr/useVr.js | 35 ++++- src-ui/logics/useReceiveRoutes.js | 132 +++++++++--------- 14 files changed, 440 insertions(+), 144 deletions(-) diff --git a/src-ui/app/others/snackbar_controller/ReactToastifyOverrideClass.scss b/src-ui/app/others/snackbar_controller/ReactToastifyOverrideClass.scss index 640a2116..d8d3045e 100644 --- a/src-ui/app/others/snackbar_controller/ReactToastifyOverrideClass.scss +++ b/src-ui/app/others/snackbar_controller/ReactToastifyOverrideClass.scss @@ -110,4 +110,35 @@ min-width: 2.8rem; justify-content: center; align-items: center; +} + +@keyframes fade_in { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +@keyframes fade_out { + 0% { + opacity: 1; + } + 100% { + opacity: 0; + } +} +.fade_in { + opacity: 0; + animation-name: fade_in; + animation-duration: 0.1s; + animation-timing-function: ease-out; + animation-fill-mode: forwards; +} +.fade_out { + opacity: 1; + animation-name: fade_out; + animation-duration: 0.2s; + animation-timing-function: ease-out; + animation-fill-mode: forwards; } \ No newline at end of file diff --git a/src-ui/app/others/snackbar_controller/SnackbarController.jsx b/src-ui/app/others/snackbar_controller/SnackbarController.jsx index 28bd6325..b617b98a 100644 --- a/src-ui/app/others/snackbar_controller/SnackbarController.jsx +++ b/src-ui/app/others/snackbar_controller/SnackbarController.jsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from "react"; -import { ToastContainer, toast, Bounce } from "react-toastify"; +import { ToastContainer, toast, cssTransition } from "react-toastify"; import clsx from "clsx"; import "./ReactToastifyOverrideClass.scss"; @@ -13,6 +13,13 @@ import ErrorSvg from "@images/error.svg?react"; import { useNotificationStatus } from "@logics_common"; +const CustomTransition = cssTransition({ + enter: "fade_in", + exit: "fade_out", + collapse: false, +}); + + export const SnackbarController = () => { const { currentNotificationStatus, closeNotification } = useNotificationStatus(); const [containerKey, setContainerKey] = useState(0); @@ -35,34 +42,22 @@ export const SnackbarController = () => { hideDuration = Number(settings.options?.hide_duration); } + const to_hide_progress_bar = (settings.options?.to_hide_progress_bar === true) ? true : false; + useEffect(() => { if (!settings.is_open) return; const message_text = settings.message; + const category_id = settings.category_id ? settings.category_id : message_text; - if (toast.isActive(message_text)) { - setContainerKey(prevKey => prevKey + 1); + setContainerKey(prevKey => prevKey + 1); - setTimeout(() => { - toast(message_text, { - toastId: message_text, - type: settings.status, - autoClose: hideDuration, - transition: Bounce, - toastClassName: snackbar_classname, - progressClassName: styles.toast_progress, - closeButton: , - onClose: () => { - closeNotification(); - }, - }); - }, 50); - } else { + setTimeout(() => { toast(message_text, { - toastId: message_text, + toastId: category_id, type: settings.status, autoClose: hideDuration, - transition: Bounce, + transition: CustomTransition, toastClassName: snackbar_classname, progressClassName: styles.toast_progress, closeButton: , @@ -70,15 +65,15 @@ export const SnackbarController = () => { closeNotification(); }, }); - } - }, [settings, hideDuration, closeNotification, snackbar_classname]); + }, 50); + }, [settings]); return ( { case "/set/data/deepl_auth_key": if (message === "DeepL auth key length is not correct") { updateDeepLAuthKey(data); - showNotification_Error(t("common_error.deepl_auth_key_invalid_length")); + showNotification_Error(t("common_error.deepl_auth_key_invalid_length"), { category_id: "deepl_auth_key" }); } else if (message === "Authentication failure of deepL auth key") { updateDeepLAuthKey(data); - showNotification_Error(t("common_error.deepl_auth_key_failed_authentication")); + showNotification_Error(t("common_error.deepl_auth_key_failed_authentication"), { category_id: "deepl_auth_key" }); } else { // Exception updateDeepLAuthKey(data); - showNotification_Error(message); + showNotification_Error(message, { category_id: "deepl_auth_key" }); } return; diff --git a/src-ui/logics/common/useNotificationStatus.js b/src-ui/logics/common/useNotificationStatus.js index c623d091..6c9614cd 100644 --- a/src-ui/logics/common/useNotificationStatus.js +++ b/src-ui/logics/common/useNotificationStatus.js @@ -3,13 +3,11 @@ import { useStore_NotificationStatus } from "@store"; export const useNotificationStatus = () => { const { currentNotificationStatus, updateNotificationStatus } = useStore_NotificationStatus(); - const generateRandomKey = () => Math.random(); - const showNotification_Warning = (message, options = {}) => { updateNotificationStatus({ status: "warning", is_open: true, - key: generateRandomKey(), + category_id: (options.category_id) ? options.category_id : null, message: message, options: options, }); @@ -19,7 +17,7 @@ export const useNotificationStatus = () => { updateNotificationStatus({ status: "error", is_open: true, - key: generateRandomKey(), + category_id: (options.category_id) ? options.category_id : null, message: message, options: options, }); @@ -29,12 +27,23 @@ export const useNotificationStatus = () => { updateNotificationStatus({ status: "success", is_open: true, - key: generateRandomKey(), + category_id: (options.category_id) ? options.category_id : null, message: message, options: options, }); }; + const showNotification_SaveSuccess = (options = {}) => { + options = { hide_duration: 2000, to_hide_progress_bar: true, ...options }; + updateNotificationStatus({ + status: "success", + is_open: true, + category_id: (options.category_id) ? options.category_id : null, + message: "設定の適用と、保存が完了しました。", + options: options, + }); + }; + const closeNotification = () => { updateNotificationStatus((prev) => ({ ...prev.data, @@ -49,6 +58,7 @@ export const useNotificationStatus = () => { showNotification_Warning, showNotification_Error, showNotification_Success, + showNotification_SaveSuccess, closeNotification, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/advanced_settings/useAdvancedSettings.js b/src-ui/logics/configs/advanced_settings/useAdvancedSettings.js index 327a15a6..7bf5652e 100644 --- a/src-ui/logics/configs/advanced_settings/useAdvancedSettings.js +++ b/src-ui/logics/configs/advanced_settings/useAdvancedSettings.js @@ -10,7 +10,7 @@ import { useNotificationStatus } from "@logics_common"; export const useAdvancedSettings = () => { const { asyncStdoutToPython } = useStdoutToPython(); - const { showNotification_Error } = useNotificationStatus(); + const { showNotification_Error, showNotification_SaveSuccess } = useNotificationStatus(); // OSC IP Address const { currentOscIpAddress, updateOscIpAddress, pendingOscIpAddress } = useStore_OscIpAddress(); @@ -32,6 +32,11 @@ export const useAdvancedSettings = () => { asyncStdoutToPython("/set/data/osc_ip_address", osc_ip_address); }; + const setSuccessOscIpAddress = (osc_ip_address) => { + updateOscIpAddress(osc_ip_address); + showNotification_SaveSuccess(); + }; + // OSC Port const getOscPort = () => { pendingOscPort(); @@ -43,12 +48,17 @@ export const useAdvancedSettings = () => { asyncStdoutToPython("/set/data/osc_port", osc_port); }; - const saveErrorOscPort = ({data, message, _result}) => { + const setSuccessOscPort = (osc_port) => { + updateOscPort(osc_port); + showNotification_SaveSuccess(); + }; + + const saveErrorOscPort = ({ data, message, _result }) => { updateOscPort(d => d.data); showNotification_Error(_result); }; - // WebSocket + // WebSocket Enable const getEnableWebsocket = () => { pendingEnableWebsocket(); asyncStdoutToPython("/get/data/websocket_server"); @@ -63,7 +73,12 @@ export const useAdvancedSettings = () => { } }; + const setSuccessEnableWebsocket = (is_enabled) => { + updateEnableWebsocket(is_enabled); + showNotification_SaveSuccess(); + }; + // WebSocket Host const getWebsocketHost = () => { pendingWebsocketHost(); asyncStdoutToPython("/get/data/websocket_host"); @@ -74,7 +89,12 @@ export const useAdvancedSettings = () => { asyncStdoutToPython("/set/data/websocket_host", websocket_host); }; + const setSuccessWebsocketHost = (websocket_host) => { + updateWebsocketHost(websocket_host); + showNotification_SaveSuccess(); + }; + // WebSocket Port const getWebsocketPort = () => { pendingWebsocketPort(); asyncStdoutToPython("/get/data/websocket_port"); @@ -85,6 +105,10 @@ export const useAdvancedSettings = () => { asyncStdoutToPython("/set/data/websocket_port", websocket_port); }; + const setSuccessWebsocketPort = (websocket_port) => { + updateWebsocketPort(websocket_port); + showNotification_SaveSuccess(); + }; return { // OSC IP Address @@ -92,28 +116,35 @@ export const useAdvancedSettings = () => { getOscIpAddress, updateOscIpAddress, setOscIpAddress, + setSuccessOscIpAddress, // OSC Port currentOscPort, getOscPort, updateOscPort, setOscPort, + setSuccessOscPort, saveErrorOscPort, - // WebSocket + // WebSocket Enable currentEnableWebsocket, - updateEnableWebsocket, getEnableWebsocket, + updateEnableWebsocket, toggleEnableWebsocket, + setSuccessEnableWebsocket, + // WebSocket Host currentWebsocketHost, - updateWebsocketHost, getWebsocketHost, + updateWebsocketHost, setWebsocketHost, + setSuccessWebsocketHost, + // WebSocket Port currentWebsocketPort, - updateWebsocketPort, getWebsocketPort, + updateWebsocketPort, setWebsocketPort, + setSuccessWebsocketPort, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/appearance/useAppearance.js b/src-ui/logics/configs/appearance/useAppearance.js index 582ebf73..dbf5c310 100644 --- a/src-ui/logics/configs/appearance/useAppearance.js +++ b/src-ui/logics/configs/appearance/useAppearance.js @@ -8,9 +8,13 @@ import { useStore_Transparency, } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; +import { useI18n } from "@useI18n"; +import { useNotificationStatus } from "@logics_common"; export const useAppearance = () => { + const { t } = useI18n(); const { asyncStdoutToPython } = useStdoutToPython(); + const { showNotification_SaveSuccess } = useNotificationStatus(); // UI Language const { currentUiLanguage, updateUiLanguage, pendingUiLanguage } = useStore_UiLanguage(); @@ -39,6 +43,11 @@ export const useAppearance = () => { asyncStdoutToPython("/set/data/ui_language", selected_ui_language); }; + const setSuccessUiLanguage = (selected_ui_language) => { + updateUiLanguage(selected_ui_language); + showNotification_SaveSuccess(); + }; + // UI Scaling const getUiScaling = () => { pendingUiScaling(); @@ -50,6 +59,11 @@ export const useAppearance = () => { asyncStdoutToPython("/set/data/ui_scaling", selected_ui_scaling); }; + const setSuccessUiScaling = (selected_ui_scaling) => { + updateUiScaling(selected_ui_scaling); + showNotification_SaveSuccess(); + }; + // Message Log Ui Scaling const getMessageLogUiScaling = () => { pendingMessageLogUiScaling(); @@ -61,6 +75,11 @@ export const useAppearance = () => { asyncStdoutToPython("/set/data/textbox_ui_scaling", selected_ui_scaling); }; + const setSuccessMessageLogUiScaling = (selected_ui_scaling) => { + updateMessageLogUiScaling(selected_ui_scaling); + showNotification_SaveSuccess(); + }; + // Send Message Button Type const getSendMessageButtonType = () => { pendingSendMessageButtonType(); @@ -72,6 +91,11 @@ export const useAppearance = () => { asyncStdoutToPython("/set/data/send_message_button_type", send_message_button_type); }; + const setSuccessSendMessageButtonType = (send_message_button_type) => { + updateSendMessageButtonType(send_message_button_type); + showNotification_SaveSuccess(); + }; + // Show Resend Button const getShowResendButton = () => { pendingShowResendButton(); @@ -86,6 +110,10 @@ export const useAppearance = () => { asyncStdoutToPython("/set/enable/show_resend_button"); } }; + const setSuccessShowResendButton = (to_show) => { + updateShowResendButton(to_show); + showNotification_SaveSuccess(); + }; // Selected Font Family const getSelectedFontFamily = () => { @@ -98,6 +126,11 @@ export const useAppearance = () => { asyncStdoutToPython("/set/data/font_family", selected_font_family); }; + const setSuccessSelectedFontFamily = (selected_font_family) => { + updateSelectedFontFamily(selected_font_family); + showNotification_SaveSuccess(); + }; + // Transparency const getTransparency = () => { pendingTransparency(); @@ -109,6 +142,11 @@ export const useAppearance = () => { asyncStdoutToPython("/set/data/transparency", selected_transparency); }; + const setSuccessTransparency = (selected_transparency) => { + updateTransparency(selected_transparency); + showNotification_SaveSuccess(); + }; + return { // UI Language @@ -116,23 +154,27 @@ export const useAppearance = () => { getUiLanguage, updateUiLanguage, setUiLanguage, + setSuccessUiLanguage, // UI Scaling currentUiScaling, getUiScaling, updateUiScaling, setUiScaling, + setSuccessUiScaling, // Message Log Ui Scaling currentMessageLogUiScaling, getMessageLogUiScaling, updateMessageLogUiScaling, setMessageLogUiScaling, + setSuccessMessageLogUiScaling, // Send Message Button Type currentSendMessageButtonType, getSendMessageButtonType, setSendMessageButtonType, + setSuccessSendMessageButtonType, updateSendMessageButtonType, // Show Resend Button @@ -140,17 +182,20 @@ export const useAppearance = () => { getShowResendButton, updateShowResendButton, toggleShowResendButton, + setSuccessShowResendButton, // Selected Font Family currentSelectedFontFamily, getSelectedFontFamily, updateSelectedFontFamily, setSelectedFontFamily, + setSuccessSelectedFontFamily, // Transparency currentTransparency, getTransparency, updateTransparency, setTransparency, + setSuccessTransparency, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useDevice.js b/src-ui/logics/configs/device/useDevice.js index 25a05f1c..b0919ad1 100644 --- a/src-ui/logics/configs/device/useDevice.js +++ b/src-ui/logics/configs/device/useDevice.js @@ -18,9 +18,11 @@ import { } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; import { arrayToObject } from "@utils"; +import { useNotificationStatus } from "@logics_common"; export const useDevice = () => { const { asyncStdoutToPython } = useStdoutToPython(); + const { showNotification_SaveSuccess } = useNotificationStatus(); const { currentEnableAutoMicSelect, updateEnableAutoMicSelect, pendingEnableAutoMicSelect } = useStore_EnableAutoMicSelect(); const { currentEnableAutoSpeakerSelect, updateEnableAutoSpeakerSelect, pendingEnableAutoSpeakerSelect } = useStore_EnableAutoSpeakerSelect(); @@ -34,11 +36,11 @@ export const useDevice = () => { const { currentSelectedSpeakerDevice, updateSelectedSpeakerDevice, pendingSelectedSpeakerDevice } = useStore_SelectedSpeakerDevice(); - const { updateMicThreshold, currentMicThreshold } = useStore_MicThreshold(); - const { updateEnableAutomaticMicThreshold, currentEnableAutomaticMicThreshold, pendingEnableAutomaticMicThreshold } = useStore_EnableAutomaticMicThreshold(); + const { currentMicThreshold, updateMicThreshold } = useStore_MicThreshold(); + const { currentEnableAutomaticMicThreshold, updateEnableAutomaticMicThreshold, pendingEnableAutomaticMicThreshold } = useStore_EnableAutomaticMicThreshold(); - const { updateSpeakerThreshold, currentSpeakerThreshold } = useStore_SpeakerThreshold(); - const { updateEnableAutomaticSpeakerThreshold, currentEnableAutomaticSpeakerThreshold, pendingEnableAutomaticSpeakerThreshold } = useStore_EnableAutomaticSpeakerThreshold(); + const { currentSpeakerThreshold, updateSpeakerThreshold } = useStore_SpeakerThreshold(); + const { currentEnableAutomaticSpeakerThreshold, updateEnableAutomaticSpeakerThreshold, pendingEnableAutomaticSpeakerThreshold } = useStore_EnableAutomaticSpeakerThreshold(); // Auto Select (Mic) const getEnableAutoMicSelect = () => { @@ -54,6 +56,12 @@ export const useDevice = () => { asyncStdoutToPython("/set/enable/auto_mic_select"); } }; + + const setSuccessEnableAutoMicSelect = (enabled) => { + updateEnableAutoMicSelect(enabled); + showNotification_SaveSuccess(); + }; + // Auto Select (Speaker) const getEnableAutoSpeakerSelect = () => { pendingEnableAutoSpeakerSelect(); @@ -69,6 +77,10 @@ export const useDevice = () => { } }; + const setSuccessEnableAutoSpeakerSelect = (enabled) => { + updateEnableAutoSpeakerSelect(enabled); + showNotification_SaveSuccess(); + }; // List (Mic device) const getMicDeviceList = () => { @@ -79,6 +91,7 @@ export const useDevice = () => { const updateMicDeviceList_FromBackend = (payload) => { updateMicDeviceList(arrayToObject(payload)); }; + // List (Mic host) const getMicHostList = () => { pendingMicHostList(); @@ -88,6 +101,7 @@ export const useDevice = () => { const updateMicHostList_FromBackend = (payload) => { updateMicHostList(arrayToObject(payload)); }; + // List (Speaker device) const getSpeakerDeviceList = () => { pendingSpeakerDeviceList(); @@ -98,7 +112,6 @@ export const useDevice = () => { updateSpeakerDeviceList(arrayToObject(payload)); }; - // Selected (Mic host) const getSelectedMicHost = () => { pendingSelectedMicHost(); @@ -109,6 +122,12 @@ export const useDevice = () => { pendingSelectedMicHost(); asyncStdoutToPython("/set/data/selected_mic_host", selected_mic_host); }; + + const setSuccessSelectedMicHost = (payload) => { + updateSelectedMicHostAndDevice(payload); // Receive host and device from backend. + showNotification_SaveSuccess(); + }; + // Selected (Mic device) const getSelectedMicDevice = () => { pendingSelectedMicDevice(); @@ -120,11 +139,16 @@ export const useDevice = () => { asyncStdoutToPython("/set/data/selected_mic_device", selected_mic_device); }; - // Selected (Mic and Host) + const setSuccessSelectedMicDevice = (selected_mic_device) => { + updateSelectedMicDevice(selected_mic_device); + showNotification_SaveSuccess(); + }; + + // Selected (Mic Device and Host) const updateSelectedMicHostAndDevice = (payload) => { updateSelectedMicHost(payload.host); updateSelectedMicDevice(payload.device); - }; + } // Selected (Speaker device) const getSelectedSpeakerDevice = () => { @@ -137,6 +161,10 @@ export const useDevice = () => { asyncStdoutToPython("/set/data/selected_speaker_device", selected_speaker_device); }; + const setSuccessSelectedSpeakerDevice = (selected_speaker_device) => { + updateSelectedSpeakerDevice(selected_speaker_device); + showNotification_SaveSuccess(); + }; // Threshold (Mic) const getMicThreshold = () => { @@ -147,6 +175,11 @@ export const useDevice = () => { asyncStdoutToPython("/set/data/mic_threshold", mic_threshold); }; + const setSuccessMicThreshold = (mic_threshold) => { + updateMicThreshold(mic_threshold); + showNotification_SaveSuccess(); + }; + const getEnableAutomaticMicThreshold = () => { pendingEnableAutomaticMicThreshold(); asyncStdoutToPython("/get/data/mic_automatic_threshold"); @@ -160,6 +193,12 @@ export const useDevice = () => { asyncStdoutToPython("/set/enable/mic_automatic_threshold"); } }; + + const setSuccessEnableAutomaticMicThreshold = (enabled) => { + updateEnableAutomaticMicThreshold(enabled); + showNotification_SaveSuccess(); + }; + // Threshold (Speaker) const getSpeakerThreshold = () => { asyncStdoutToPython("/get/data/speaker_threshold"); @@ -169,6 +208,11 @@ export const useDevice = () => { asyncStdoutToPython("/set/data/speaker_threshold", speaker_threshold); }; + const setSuccessSpeakerThreshold = (speaker_threshold) => { + updateSpeakerThreshold(speaker_threshold); + showNotification_SaveSuccess(); + }; + const getEnableAutomaticSpeakerThreshold = () => { pendingEnableAutomaticSpeakerThreshold(); asyncStdoutToPython("/get/data/speaker_automatic_threshold"); @@ -183,19 +227,23 @@ export const useDevice = () => { } }; - + const setSuccessEnableAutomaticSpeakerThreshold = (enabled) => { + updateEnableAutomaticSpeakerThreshold(enabled); + showNotification_SaveSuccess(); + }; return { currentEnableAutoMicSelect, getEnableAutoMicSelect, updateEnableAutoMicSelect, toggleEnableAutoMicSelect, + setSuccessEnableAutoMicSelect, currentEnableAutoSpeakerSelect, getEnableAutoSpeakerSelect, updateEnableAutoSpeakerSelect, toggleEnableAutoSpeakerSelect, - + setSuccessEnableAutoSpeakerSelect, currentMicDeviceList, getMicDeviceList, @@ -212,46 +260,47 @@ export const useDevice = () => { updateSpeakerDeviceList, updateSpeakerDeviceList_FromBackend, - currentSelectedMicHost, getSelectedMicHost, updateSelectedMicHost, setSelectedMicHost, + setSuccessSelectedMicHost, currentSelectedMicDevice, getSelectedMicDevice, updateSelectedMicDevice, setSelectedMicDevice, - + setSuccessSelectedMicDevice, updateSelectedMicHostAndDevice, - currentSelectedSpeakerDevice, getSelectedSpeakerDevice, updateSelectedSpeakerDevice, setSelectedSpeakerDevice, - + setSuccessSelectedSpeakerDevice, currentMicThreshold, getMicThreshold, setMicThreshold, updateMicThreshold, + setSuccessMicThreshold, currentEnableAutomaticMicThreshold, getEnableAutomaticMicThreshold, toggleEnableAutomaticMicThreshold, updateEnableAutomaticMicThreshold, + setSuccessEnableAutomaticMicThreshold, currentSpeakerThreshold, getSpeakerThreshold, setSpeakerThreshold, updateSpeakerThreshold, + setSuccessSpeakerThreshold, currentEnableAutomaticSpeakerThreshold, getEnableAutomaticSpeakerThreshold, toggleEnableAutomaticSpeakerThreshold, updateEnableAutomaticSpeakerThreshold, - - + setSuccessEnableAutomaticSpeakerThreshold, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/hotkeys/useHotkeys.js b/src-ui/logics/configs/hotkeys/useHotkeys.js index 20b18732..df7db416 100644 --- a/src-ui/logics/configs/hotkeys/useHotkeys.js +++ b/src-ui/logics/configs/hotkeys/useHotkeys.js @@ -20,7 +20,7 @@ export const useHotkeys = () => { pendingHotkeys(); asyncStdoutToPython("/get/data/hotkeys"); }; - const { showNotification_Success, showNotification_Error, closeNotification } = useNotificationStatus(); + const { showNotification_SaveSuccess, showNotification_Error, closeNotification } = useNotificationStatus(); const setHotkeys = (hotkeys) => { pendingHotkeys(); @@ -106,11 +106,17 @@ export const useHotkeys = () => { } }; + const setSuccessHotkeys = (hotkeys) => { + updateHotkeys(hotkeys); + showNotification_SaveSuccess(); + }; + return { currentHotkeys, getHotkeys, updateHotkeys, setHotkeys, + setSuccessHotkeys, registerShortcuts, unregisterAll, }; diff --git a/src-ui/logics/configs/others/useOthers.js b/src-ui/logics/configs/others/useOthers.js index b9f13612..62a14364 100644 --- a/src-ui/logics/configs/others/useOthers.js +++ b/src-ui/logics/configs/others/useOthers.js @@ -8,6 +8,7 @@ import { useStore_EnableSendReceivedMessageToVrc, } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; +import { useNotificationStatus } from "@logics_common"; export const useOthers = () => { const { asyncStdoutToPython } = useStdoutToPython(); @@ -29,6 +30,7 @@ export const useOthers = () => { // Send Received Message To VRC const { currentEnableSendReceivedMessageToVrc, updateEnableSendReceivedMessageToVrc, pendingEnableSendReceivedMessageToVrc } = useStore_EnableSendReceivedMessageToVrc(); + const { showNotification_SaveSuccess } = useNotificationStatus(); // Auto Clear Message Input Box const getEnableAutoClearMessageInputBox = () => { @@ -45,6 +47,11 @@ export const useOthers = () => { } }; + const setSuccessEnableAutoClearMessageInputBox = (enabled) => { + updateEnableAutoClearMessageInputBox(enabled); + showNotification_SaveSuccess(); + }; + // Send Only Translated Messages const getEnableSendOnlyTranslatedMessages = () => { pendingEnableSendOnlyTranslatedMessages(); @@ -60,6 +67,11 @@ export const useOthers = () => { } }; + const setSuccessEnableSendOnlyTranslatedMessages = (enabled) => { + updateEnableSendOnlyTranslatedMessages(enabled); + showNotification_SaveSuccess(); + }; + // Auto Export Message Logs const getEnableAutoExportMessageLogs = () => { pendingEnableAutoExportMessageLogs(); @@ -75,6 +87,11 @@ export const useOthers = () => { } }; + const setSuccessEnableAutoExportMessageLogs = (enabled) => { + updateEnableAutoExportMessageLogs(enabled); + showNotification_SaveSuccess(); + }; + // VRC Mic Mute Sync const getEnableVrcMicMuteSync = () => { pendingEnableVrcMicMuteSync(); @@ -90,10 +107,9 @@ export const useOthers = () => { } }; - const updateEnableVrcMicMuteSync_FromBackend = (payload) => { - updateEnableVrcMicMuteSync((old_value) => { - return {...old_value.data, is_enabled: payload}; - }); + const setSuccessEnableVrcMicMuteSync = (is_enabled) => { + updateEnableVrcMicMuteSync(old => ({ ...old.data, is_enabled: is_enabled })); + showNotification_SaveSuccess(); }; // Send Message To VRCT @@ -111,6 +127,11 @@ export const useOthers = () => { } }; + const setSuccessEnableSendMessageToVrc = (enabled) => { + updateEnableSendMessageToVrc(enabled); + showNotification_SaveSuccess(); + }; + // Sounds // Notification VRC SFX const getEnableNotificationVrcSfx = () => { @@ -127,6 +148,11 @@ export const useOthers = () => { } }; + const setSuccessEnableNotificationVrcSfx = (enabled) => { + updateEnableNotificationVrcSfx(enabled); + showNotification_SaveSuccess(); + }; + // Speaker2Chatbox // Send Received Message To VRC const getEnableSendReceivedMessageToVrc = () => { @@ -143,37 +169,46 @@ export const useOthers = () => { } }; + const setSuccessEnableSendReceivedMessageToVrc = (enabled) => { + updateEnableSendReceivedMessageToVrc(enabled); + showNotification_SaveSuccess(); + }; + return { // Auto Clear Message Input Box currentEnableAutoClearMessageInputBox, getEnableAutoClearMessageInputBox, toggleEnableAutoClearMessageInputBox, updateEnableAutoClearMessageInputBox, + setSuccessEnableAutoClearMessageInputBox, // Send Only Translated Messages currentEnableSendOnlyTranslatedMessages, getEnableSendOnlyTranslatedMessages, toggleEnableSendOnlyTranslatedMessages, updateEnableSendOnlyTranslatedMessages, + setSuccessEnableSendOnlyTranslatedMessages, // Auto Export Message Logs currentEnableAutoExportMessageLogs, getEnableAutoExportMessageLogs, toggleEnableAutoExportMessageLogs, updateEnableAutoExportMessageLogs, + setSuccessEnableAutoExportMessageLogs, // VRC Mic Mute Sync currentEnableVrcMicMuteSync, getEnableVrcMicMuteSync, toggleEnableVrcMicMuteSync, updateEnableVrcMicMuteSync, - updateEnableVrcMicMuteSync_FromBackend, + setSuccessEnableVrcMicMuteSync, // Send Message To VRCT currentEnableSendMessageToVrc, getEnableSendMessageToVrc, toggleEnableSendMessageToVrc, updateEnableSendMessageToVrc, + setSuccessEnableSendMessageToVrc, // Sounds // Notification VRC SFX @@ -181,6 +216,7 @@ export const useOthers = () => { getEnableNotificationVrcSfx, toggleEnableNotificationVrcSfx, updateEnableNotificationVrcSfx, + setSuccessEnableNotificationVrcSfx, // Speaker2Chatbox // Send Received Message To VRC @@ -188,5 +224,6 @@ export const useOthers = () => { getEnableSendReceivedMessageToVrc, toggleEnableSendReceivedMessageToVrc, updateEnableSendReceivedMessageToVrc, + setSuccessEnableSendReceivedMessageToVrc, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/plugins/usePlugins.js b/src-ui/logics/configs/plugins/usePlugins.js index e22c2aff..42f7d5a9 100644 --- a/src-ui/logics/configs/plugins/usePlugins.js +++ b/src-ui/logics/configs/plugins/usePlugins.js @@ -37,7 +37,7 @@ const PLUGIN_LIST_URL = getPluginsList(); export const usePlugins = () => { const { t, i18n } = useI18n(); - const { showNotification_Success, showNotification_Error } = useNotificationStatus(); + const { showNotification_SaveSuccess, showNotification_Success, showNotification_Error } = useNotificationStatus(); const { asyncStdoutToPython } = useStdoutToPython(); const { currentFetchedPluginsInfo, updateFetchedPluginsInfo, pendingFetchedPluginsInfo, errorFetchedPluginsInfo } = useStore_FetchedPluginsInfo(); @@ -371,6 +371,10 @@ export const usePlugins = () => { }); } + const setSuccessSavedPluginsStatus = (plugins_status) => { + updateSavedPluginsStatus(plugins_status); + showNotification_SaveSuccess(); + }; return { @@ -385,6 +389,7 @@ export const usePlugins = () => { currentSavedPluginsStatus, updateSavedPluginsStatus, + setSuccessSavedPluginsStatus, currentPluginsData, updatePluginsData, diff --git a/src-ui/logics/configs/transcription/useTranscription.js b/src-ui/logics/configs/transcription/useTranscription.js index 2079780c..0c4b8b2b 100644 --- a/src-ui/logics/configs/transcription/useTranscription.js +++ b/src-ui/logics/configs/transcription/useTranscription.js @@ -17,9 +17,11 @@ import { } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; import { transformToIndexedArray } from "@utils"; +import { useNotificationStatus } from "@logics_common"; export const useTranscription = () => { const { asyncStdoutToPython } = useStdoutToPython(); + const { showNotification_SaveSuccess } = useNotificationStatus(); // Mic const { currentMicRecordTimeout, updateMicRecordTimeout, pendingMicRecordTimeout } = useStore_MicRecordTimeout(); @@ -39,7 +41,6 @@ export const useTranscription = () => { const { currentSelectableWhisperComputeDeviceList, updateSelectableWhisperComputeDeviceList, pendingSelectableWhisperComputeDeviceList } = useStore_SelectableWhisperComputeDeviceList(); const { currentSelectedWhisperComputeDevice, updateSelectedWhisperComputeDevice, pendingSelectedWhisperComputeDevice } = useStore_SelectedWhisperComputeDevice(); - // Mic const getMicRecordTimeout = () => { pendingMicRecordTimeout(); @@ -51,6 +52,10 @@ export const useTranscription = () => { asyncStdoutToPython("/set/data/mic_record_timeout", selected_mic_record_timeout); }; + const setSuccessMicRecordTimeout = (value) => { + updateMicRecordTimeout(value); + showNotification_SaveSuccess(); + }; const getMicPhraseTimeout = () => { pendingMicPhraseTimeout(); @@ -62,6 +67,10 @@ export const useTranscription = () => { asyncStdoutToPython("/set/data/mic_phrase_timeout", selected_mic_phrase_timeout); }; + const setSuccessMicPhraseTimeout = (value) => { + updateMicPhraseTimeout(value); + showNotification_SaveSuccess(); + }; const getMicMaxWords = () => { pendingMicMaxWords(); @@ -73,6 +82,11 @@ export const useTranscription = () => { asyncStdoutToPython("/set/data/mic_max_phrases", selected_mic_max_phrases); }; + const setSuccessMicMaxWords = (value) => { + updateMicMaxWords(value); + showNotification_SaveSuccess(); + }; + const getMicWordFilterList = () => { pendingMicWordFilterList(); asyncStdoutToPython("/get/data/mic_word_filter"); @@ -83,7 +97,7 @@ export const useTranscription = () => { asyncStdoutToPython("/set/data/mic_word_filter", selected_mic_word_filter); }; - const updateMicWordFilterList_FromBackend = (payload) => { + const setSuccessMicWordFilterList = (payload) => { updateMicWordFilterList((prev_list) => { const updated_list = [...prev_list.data]; for (const value of payload) { @@ -96,6 +110,7 @@ export const useTranscription = () => { } return updated_list; }); + showNotification_SaveSuccess(); }; // Speaker @@ -109,6 +124,10 @@ export const useTranscription = () => { asyncStdoutToPython("/set/data/speaker_record_timeout", selected_speaker_record_timeout); }; + const setSuccessSpeakerRecordTimeout = (value) => { + updateSpeakerRecordTimeout(value); + showNotification_SaveSuccess(); + }; const getSpeakerPhraseTimeout = () => { pendingSpeakerPhraseTimeout(); @@ -120,6 +139,10 @@ export const useTranscription = () => { asyncStdoutToPython("/set/data/speaker_phrase_timeout", selected_speaker_phrase_timeout); }; + const setSuccessSpeakerPhraseTimeout = (value) => { + updateSpeakerPhraseTimeout(value); + showNotification_SaveSuccess(); + }; const getSpeakerMaxWords = () => { pendingSpeakerMaxWords(); @@ -131,6 +154,10 @@ export const useTranscription = () => { asyncStdoutToPython("/set/data/speaker_max_phrases", selected_speaker_max_phrases); }; + const setSuccessSpeakerMaxWords = (value) => { + updateSpeakerMaxWords(value); + showNotification_SaveSuccess(); + }; // Transcription Engines // Transcription Engines (Google / Whisper) @@ -144,6 +171,10 @@ export const useTranscription = () => { asyncStdoutToPython("/set/data/selected_transcription_engine", selected_transcription_engine); }; + const setSuccessSelectedTranscriptionEngine = (engine) => { + updateSelectedTranscriptionEngine(engine); + showNotification_SaveSuccess(); + }; // Transcription Engines (Weight Type List) const updateDownloadedWhisperWeightTypeStatus = (downloaded_weight_type_status) => { @@ -199,6 +230,10 @@ export const useTranscription = () => { asyncStdoutToPython("/set/data/whisper_weight_type", selected_whisper_weight_type); }; + const setSuccessSelectedWhisperWeightType = (wt) => { + updateSelectedWhisperWeightType(wt); + showNotification_SaveSuccess(); + }; // Transcription Engines (Compute Device List) const getSelectableWhisperComputeDeviceList = () => { @@ -221,50 +256,62 @@ export const useTranscription = () => { asyncStdoutToPython("/set/data/selected_transcription_compute_device", selected_transcription_compute_device); }; + const setSuccessSelectedWhisperComputeDevice = (dev) => { + updateSelectedWhisperComputeDevice(dev); + showNotification_SaveSuccess(); + }; + return { // Mic currentMicRecordTimeout, getMicRecordTimeout, updateMicRecordTimeout, setMicRecordTimeout, + setSuccessMicRecordTimeout, currentMicPhraseTimeout, getMicPhraseTimeout, updateMicPhraseTimeout, setMicPhraseTimeout, + setSuccessMicPhraseTimeout, currentMicMaxWords, getMicMaxWords, updateMicMaxWords, setMicMaxWords, + setSuccessMicMaxWords, currentMicWordFilterList, getMicWordFilterList, updateMicWordFilterList, setMicWordFilterList, - updateMicWordFilterList_FromBackend, + setSuccessMicWordFilterList, // Speaker currentSpeakerRecordTimeout, getSpeakerRecordTimeout, updateSpeakerRecordTimeout, setSpeakerRecordTimeout, + setSuccessSpeakerRecordTimeout, currentSpeakerPhraseTimeout, getSpeakerPhraseTimeout, updateSpeakerPhraseTimeout, setSpeakerPhraseTimeout, + setSuccessSpeakerPhraseTimeout, currentSpeakerMaxWords, getSpeakerMaxWords, updateSpeakerMaxWords, setSpeakerMaxWords, + setSuccessSpeakerMaxWords, // Transcription Engines currentSelectedTranscriptionEngine, getSelectedTranscriptionEngine, updateSelectedTranscriptionEngine, setSelectedTranscriptionEngine, + setSuccessSelectedTranscriptionEngine, currentWhisperWeightTypeStatus, updateWhisperWeightTypeStatus, @@ -278,6 +325,7 @@ export const useTranscription = () => { getSelectedWhisperWeightType, updateSelectedWhisperWeightType, setSelectedWhisperWeightType, + setSuccessSelectedWhisperWeightType, currentSelectableWhisperComputeDeviceList, getSelectableWhisperComputeDeviceList, @@ -288,5 +336,6 @@ export const useTranscription = () => { getSelectedWhisperComputeDevice, updateSelectedWhisperComputeDevice, setSelectedWhisperComputeDevice, + setSuccessSelectedWhisperComputeDevice, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/translation/useTranslation.js b/src-ui/logics/configs/translation/useTranslation.js index 77747256..b282bf90 100644 --- a/src-ui/logics/configs/translation/useTranslation.js +++ b/src-ui/logics/configs/translation/useTranslation.js @@ -13,7 +13,7 @@ import { useNotificationStatus } from "@logics_common"; export const useTranslation = () => { const { t } = useI18n(); const { asyncStdoutToPython } = useStdoutToPython(); - const { showNotification_Success, showNotification_Error } = useNotificationStatus(); + const { showNotification_SaveSuccess } = useNotificationStatus(); const { currentCTranslate2WeightTypeStatus, updateCTranslate2WeightTypeStatus, pendingCTranslate2WeightTypeStatus } = useStore_CTranslate2WeightTypeStatus(); const { currentSelectedCTranslate2WeightType, updateSelectedCTranslate2WeightType, pendingSelectedCTranslate2WeightType } = useStore_SelectedCTranslate2WeightType(); @@ -74,6 +74,11 @@ export const useTranslation = () => { asyncStdoutToPython("/set/data/ctranslate2_weight_type", selected_ctranslate2_weight_type); }; + const setSuccessSelectedCTranslate2WeightType = (selected_ctranslate2_weight_type) => { + updateSelectedCTranslate2WeightType(selected_ctranslate2_weight_type); + showNotification_SaveSuccess(); + }; + const getSelectableCTranslate2ComputeDeviceList = () => { pendingSelectableCTranslate2ComputeDeviceList(); @@ -95,6 +100,11 @@ export const useTranslation = () => { asyncStdoutToPython("/set/data/selected_translation_compute_device", selected_translation_compute_device); }; + const setSuccessSelectedCTranslate2ComputeDevice = (selected_translation_compute_device) => { + updateSelectedCTranslate2ComputeDevice(selected_translation_compute_device); + showNotification_SaveSuccess(); + }; + const getDeepLAuthKey = () => { pendingDeepLAuthKey(); @@ -106,17 +116,18 @@ export const useTranslation = () => { asyncStdoutToPython("/set/data/deepl_auth_key", selected_deepl_auth_key); }; + const setSuccessDeepLAuthKey = (data) => { + updateDeepLAuthKey(data); + showNotification_SaveSuccess(t("config_page.translation.deepl_auth_key.auth_key_success"), { category_id: "deepl_auth_key" }); + }; + const deleteDeepLAuthKey = () => { pendingDeepLAuthKey(); asyncStdoutToPython("/delete/data/deepl_auth_key"); }; - const deletedDeepLAuthKey = () => { - updateDeepLAuthKey(""); - }; - const savedDeepLAuthKey = (data) => { - updateDeepLAuthKey(data); - showNotification_Success(t("config_page.translation.deepl_auth_key.auth_key_success")); + const deleteSuccessDeepLAuthKey = () => { + updateDeepLAuthKey(""); }; @@ -133,6 +144,7 @@ export const useTranslation = () => { getSelectedCTranslate2WeightType, updateSelectedCTranslate2WeightType, setSelectedCTranslate2WeightType, + setSuccessSelectedCTranslate2WeightType, currentSelectableCTranslate2ComputeDeviceList, getSelectableCTranslate2ComputeDeviceList, @@ -143,13 +155,14 @@ export const useTranslation = () => { getSelectedCTranslate2ComputeDevice, updateSelectedCTranslate2ComputeDevice, setSelectedCTranslate2ComputeDevice, + setSuccessSelectedCTranslate2ComputeDevice, currentDeepLAuthKey, getDeepLAuthKey, updateDeepLAuthKey, setDeepLAuthKey, deleteDeepLAuthKey, - deletedDeepLAuthKey, - savedDeepLAuthKey, + deleteSuccessDeepLAuthKey, + setSuccessDeepLAuthKey, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/vr/useVr.js b/src-ui/logics/configs/vr/useVr.js index 2f5dd9eb..ee65c538 100644 --- a/src-ui/logics/configs/vr/useVr.js +++ b/src-ui/logics/configs/vr/useVr.js @@ -6,9 +6,11 @@ import { useStore_OverlayShowOnlyTranslatedMessages, } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; +import { useNotificationStatus } from "@logics_common"; export const useVr = () => { const { asyncStdoutToPython } = useStdoutToPython(); + const { showNotification_SaveSuccess } = useNotificationStatus(); const { currentIsEnabledOverlaySmallLog, updateIsEnabledOverlaySmallLog, pendingIsEnabledOverlaySmallLog } = useStore_IsEnabledOverlaySmallLog(); const { currentIsEnabledOverlayLargeLog, updateIsEnabledOverlayLargeLog, pendingIsEnabledOverlayLargeLog } = useStore_IsEnabledOverlayLargeLog(); @@ -16,7 +18,6 @@ export const useVr = () => { const { currentOverlayLargeLogSettings, updateOverlayLargeLogSettings, pendingOverlayLargeLogSettings } = useStore_OverlayLargeLogSettings(); const { currentOverlayShowOnlyTranslatedMessages, updateOverlayShowOnlyTranslatedMessages, pendingOverlayShowOnlyTranslatedMessages } = useStore_OverlayShowOnlyTranslatedMessages(); - const getIsEnabledOverlaySmallLog = () => { pendingIsEnabledOverlaySmallLog(); asyncStdoutToPython("/get/data/overlay_small_log"); @@ -31,6 +32,10 @@ export const useVr = () => { } }; + const setSuccessIsEnabledOverlaySmallLog = (enabled) => { + updateIsEnabledOverlaySmallLog(enabled); + showNotification_SaveSuccess(); + }; const getIsEnabledOverlayLargeLog = () => { pendingIsEnabledOverlayLargeLog(); @@ -46,6 +51,10 @@ export const useVr = () => { } }; + const setSuccessIsEnabledOverlayLargeLog = (enabled) => { + updateIsEnabledOverlayLargeLog(enabled); + showNotification_SaveSuccess(); + }; const getOverlaySmallLogSettings = () => { // pendingOverlaySmallLogSettings(); @@ -57,6 +66,10 @@ export const useVr = () => { asyncStdoutToPython("/set/data/overlay_small_log_settings", overlay_small_log_settings); }; + const setSuccessOverlaySmallLogSettings = (settings) => { + updateOverlaySmallLogSettings(settings); + showNotification_SaveSuccess(); + }; const getOverlayLargeLogSettings = () => { // pendingOverlayLargeLogSettings(); @@ -68,6 +81,10 @@ export const useVr = () => { asyncStdoutToPython("/set/data/overlay_large_log_settings", overlay_large_log_settings); }; + const setSuccessOverlayLargeLogSettings = (settings) => { + updateOverlayLargeLogSettings(settings); + showNotification_SaveSuccess(); + }; const getOverlayShowOnlyTranslatedMessages = () => { pendingOverlayShowOnlyTranslatedMessages(); @@ -83,37 +100,45 @@ export const useVr = () => { } }; + const setSuccessOverlayShowOnlyTranslatedMessages = (enabled) => { + updateOverlayShowOnlyTranslatedMessages(enabled); + showNotification_SaveSuccess(); + }; const sendTextToOverlay = (text) => { asyncStdoutToPython("/run/send_text_overlay", text); }; - return { currentIsEnabledOverlaySmallLog, getIsEnabledOverlaySmallLog, - updateIsEnabledOverlaySmallLog, toggleIsEnabledOverlaySmallLog, + updateIsEnabledOverlaySmallLog, + setSuccessIsEnabledOverlaySmallLog, currentIsEnabledOverlayLargeLog, getIsEnabledOverlayLargeLog, - updateIsEnabledOverlayLargeLog, toggleIsEnabledOverlayLargeLog, + updateIsEnabledOverlayLargeLog, + setSuccessIsEnabledOverlayLargeLog, currentOverlaySmallLogSettings, getOverlaySmallLogSettings, updateOverlaySmallLogSettings, setOverlaySmallLogSettings, + setSuccessOverlaySmallLogSettings, currentOverlayLargeLogSettings, getOverlayLargeLogSettings, updateOverlayLargeLogSettings, setOverlayLargeLogSettings, + setSuccessOverlayLargeLogSettings, currentOverlayShowOnlyTranslatedMessages, getOverlayShowOnlyTranslatedMessages, - updateOverlayShowOnlyTranslatedMessages, toggleOverlayShowOnlyTranslatedMessages, + updateOverlayShowOnlyTranslatedMessages, + setSuccessOverlayShowOnlyTranslatedMessages, sendTextToOverlay, }; diff --git a/src-ui/logics/useReceiveRoutes.js b/src-ui/logics/useReceiveRoutes.js index a956ba6e..5c0e78e1 100644 --- a/src-ui/logics/useReceiveRoutes.js +++ b/src-ui/logics/useReceiveRoutes.js @@ -92,25 +92,25 @@ export const ROUTE_META_LIST = [ // Config Page // Device { endpoint: "/get/data/auto_mic_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoMicSelect" }, - { endpoint: "/set/enable/auto_mic_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoMicSelect" }, - { endpoint: "/set/disable/auto_mic_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoMicSelect" }, + { endpoint: "/set/enable/auto_mic_select", ns: configs, hook_name: "useDevice", method_name: "setSuccessEnableAutoMicSelect" }, + { endpoint: "/set/disable/auto_mic_select", ns: configs, hook_name: "useDevice", method_name: "setSuccessEnableAutoMicSelect" }, { endpoint: "/get/data/auto_speaker_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoSpeakerSelect" }, - { endpoint: "/set/enable/auto_speaker_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoSpeakerSelect" }, - { endpoint: "/set/disable/auto_speaker_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoSpeakerSelect" }, + { endpoint: "/set/enable/auto_speaker_select", ns: configs, hook_name: "useDevice", method_name: "setSuccessEnableAutoSpeakerSelect" }, + { endpoint: "/set/disable/auto_speaker_select", ns: configs, hook_name: "useDevice", method_name: "setSuccessEnableAutoSpeakerSelect" }, // Device (Mic) { endpoint: "/get/data/mic_host_list", ns: configs, hook_name: "useDevice", method_name: "updateMicHostList_FromBackend" }, { endpoint: "/run/mic_host_list", ns: configs, hook_name: "useDevice", method_name: "updateMicHostList_FromBackend" }, { endpoint: "/get/data/selected_mic_host", ns: configs, hook_name: "useDevice", method_name: "updateSelectedMicHost" }, - { endpoint: "/set/data/selected_mic_host", ns: configs, hook_name: "useDevice", method_name: "updateSelectedMicHostAndDevice" }, + { endpoint: "/set/data/selected_mic_host", ns: configs, hook_name: "useDevice", method_name: "setSuccessSelectedMicHost" }, { endpoint: "/get/data/mic_device_list", ns: configs, hook_name: "useDevice", method_name: "updateMicDeviceList_FromBackend" }, { endpoint: "/run/mic_device_list", ns: configs, hook_name: "useDevice", method_name: "updateMicDeviceList_FromBackend" }, { endpoint: "/get/data/selected_mic_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedMicDevice" }, - { endpoint: "/set/data/selected_mic_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedMicDevice" }, + { endpoint: "/set/data/selected_mic_device", ns: configs, hook_name: "useDevice", method_name: "setSuccessSelectedMicDevice" }, { endpoint: "/run/selected_mic_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedMicHostAndDevice" }, @@ -119,54 +119,54 @@ export const ROUTE_META_LIST = [ { endpoint: "/run/speaker_device_list", ns: configs, hook_name: "useDevice", method_name: "updateSpeakerDeviceList_FromBackend" }, { endpoint: "/get/data/selected_speaker_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedSpeakerDevice" }, - { endpoint: "/set/data/selected_speaker_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedSpeakerDevice" }, + { endpoint: "/set/data/selected_speaker_device", ns: configs, hook_name: "useDevice", method_name: "setSuccessSelectedSpeakerDevice" }, { endpoint: "/run/selected_speaker_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedSpeakerDevice" }, // Device (Threshold) { endpoint: "/get/data/mic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateMicThreshold" }, - { endpoint: "/set/data/mic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateMicThreshold" }, + { endpoint: "/set/data/mic_threshold", ns: configs, hook_name: "useDevice", method_name: "setSuccessMicThreshold" }, { endpoint: "/get/data/speaker_threshold", ns: configs, hook_name: "useDevice", method_name: "updateSpeakerThreshold" }, - { endpoint: "/set/data/speaker_threshold", ns: configs, hook_name: "useDevice", method_name: "updateSpeakerThreshold" }, + { endpoint: "/set/data/speaker_threshold", ns: configs, hook_name: "useDevice", method_name: "setSuccessSpeakerThreshold" }, { endpoint: "/get/data/mic_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticMicThreshold" }, - { endpoint: "/set/enable/mic_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticMicThreshold" }, - { endpoint: "/set/disable/mic_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticMicThreshold" }, + { endpoint: "/set/enable/mic_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "setSuccessEnableAutomaticMicThreshold" }, + { endpoint: "/set/disable/mic_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "setSuccessEnableAutomaticMicThreshold" }, { endpoint: "/get/data/speaker_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticSpeakerThreshold" }, - { endpoint: "/set/enable/speaker_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticSpeakerThreshold" }, - { endpoint: "/set/disable/speaker_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticSpeakerThreshold" }, + { endpoint: "/set/enable/speaker_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "setSuccessEnableAutomaticSpeakerThreshold" }, + { endpoint: "/set/disable/speaker_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "setSuccessEnableAutomaticSpeakerThreshold" }, // Appearance { endpoint: "/get/data/ui_language", ns: configs, hook_name: "useAppearance", method_name: "updateUiLanguage" }, - { endpoint: "/set/data/ui_language", ns: configs, hook_name: "useAppearance", method_name: "updateUiLanguage" }, + { endpoint: "/set/data/ui_language", ns: configs, hook_name: "useAppearance", method_name: "setSuccessUiLanguage" }, { endpoint: "/get/data/ui_scaling", ns: configs, hook_name: "useAppearance", method_name: "updateUiScaling" }, - { endpoint: "/set/data/ui_scaling", ns: configs, hook_name: "useAppearance", method_name: "updateUiScaling" }, + { endpoint: "/set/data/ui_scaling", ns: configs, hook_name: "useAppearance", method_name: "setSuccessUiScaling" }, { endpoint: "/get/data/textbox_ui_scaling", ns: configs, hook_name: "useAppearance", method_name: "updateMessageLogUiScaling" }, - { endpoint: "/set/data/textbox_ui_scaling", ns: configs, hook_name: "useAppearance", method_name: "updateMessageLogUiScaling" }, + { endpoint: "/set/data/textbox_ui_scaling", ns: configs, hook_name: "useAppearance", method_name: "setSuccessMessageLogUiScaling" }, { endpoint: "/get/data/send_message_button_type", ns: configs, hook_name: "useAppearance", method_name: "updateSendMessageButtonType" }, - { endpoint: "/set/data/send_message_button_type", ns: configs, hook_name: "useAppearance", method_name: "updateSendMessageButtonType" }, + { endpoint: "/set/data/send_message_button_type", ns: configs, hook_name: "useAppearance", method_name: "setSuccessSendMessageButtonType" }, { endpoint: "/get/data/show_resend_button", ns: configs, hook_name: "useAppearance", method_name: "updateShowResendButton" }, - { endpoint: "/set/enable/show_resend_button", ns: configs, hook_name: "useAppearance", method_name: "updateShowResendButton" }, - { endpoint: "/set/disable/show_resend_button", ns: configs, hook_name: "useAppearance", method_name: "updateShowResendButton" }, + { endpoint: "/set/enable/show_resend_button", ns: configs, hook_name: "useAppearance", method_name: "setSuccessShowResendButton" }, + { endpoint: "/set/disable/show_resend_button", ns: configs, hook_name: "useAppearance", method_name: "setSuccessShowResendButton" }, { endpoint: "/get/data/font_family", ns: configs, hook_name: "useAppearance", method_name: "updateSelectedFontFamily" }, - { endpoint: "/set/data/font_family", ns: configs, hook_name: "useAppearance", method_name: "updateSelectedFontFamily" }, + { endpoint: "/set/data/font_family", ns: configs, hook_name: "useAppearance", method_name: "setSuccessSelectedFontFamily" }, { endpoint: "/get/data/transparency", ns: configs, hook_name: "useAppearance", method_name: "updateTransparency" }, - { endpoint: "/set/data/transparency", ns: configs, hook_name: "useAppearance", method_name: "updateTransparency" }, + { endpoint: "/set/data/transparency", ns: configs, hook_name: "useAppearance", method_name: "setSuccessTransparency" }, // Translation { endpoint: "/get/data/deepl_auth_key", ns: configs, hook_name: "useTranslation", method_name: "updateDeepLAuthKey" }, - { endpoint: "/set/data/deepl_auth_key", ns: configs, hook_name: "useTranslation", method_name: "savedDeepLAuthKey" }, - { endpoint: "/delete/data/deepl_auth_key", ns: configs, hook_name: "useTranslation", method_name: "deletedDeepLAuthKey" }, + { endpoint: "/set/data/deepl_auth_key", ns: configs, hook_name: "useTranslation", method_name: "setSuccessDeepLAuthKey" }, + { endpoint: "/delete/data/deepl_auth_key", ns: configs, hook_name: "useTranslation", method_name: "deleteSuccessDeepLAuthKey" }, // Translation (AI Models) { endpoint: "/get/data/ctranslate2_weight_type", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedCTranslate2WeightType" }, - { endpoint: "/set/data/ctranslate2_weight_type", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedCTranslate2WeightType" }, + { endpoint: "/set/data/ctranslate2_weight_type", ns: configs, hook_name: "useTranslation", method_name: "setSuccessSelectedCTranslate2WeightType" }, { endpoint: "/get/data/selectable_ctranslate2_weight_type_dict", ns: configs, hook_name: "useTranslation", method_name: "updateDownloadedCTranslate2WeightTypeStatus" }, @@ -177,39 +177,39 @@ export const ROUTE_META_LIST = [ { endpoint: "/get/data/translation_compute_device_list", ns: configs, hook_name: "useTranslation", method_name: "updateSelectableCTranslate2ComputeDeviceList_FromBackend" }, { endpoint: "/get/data/selected_translation_compute_device", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedCTranslate2ComputeDevice" }, - { endpoint: "/set/data/selected_translation_compute_device", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedCTranslate2ComputeDevice" }, + { endpoint: "/set/data/selected_translation_compute_device", ns: configs, hook_name: "useTranslation", method_name: "setSuccessSelectedCTranslate2ComputeDevice" }, // Transcription // Transcription (Mic) { endpoint: "/get/data/mic_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateMicRecordTimeout" }, - { endpoint: "/set/data/mic_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateMicRecordTimeout" }, + { endpoint: "/set/data/mic_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "setSuccessMicRecordTimeout" }, { endpoint: "/get/data/mic_phrase_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateMicPhraseTimeout" }, - { endpoint: "/set/data/mic_phrase_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateMicPhraseTimeout" }, + { endpoint: "/set/data/mic_phrase_timeout", ns: configs, hook_name: "useTranscription", method_name: "setSuccessMicPhraseTimeout" }, { endpoint: "/get/data/mic_max_phrases", ns: configs, hook_name: "useTranscription", method_name: "updateMicMaxWords" }, - { endpoint: "/set/data/mic_max_phrases", ns: configs, hook_name: "useTranscription", method_name: "updateMicMaxWords" }, + { endpoint: "/set/data/mic_max_phrases", ns: configs, hook_name: "useTranscription", method_name: "setSuccessMicMaxWords" }, - { endpoint: "/get/data/mic_word_filter", ns: configs, hook_name: "useTranscription", method_name: "updateMicWordFilterList_FromBackend" }, - { endpoint: "/set/data/mic_word_filter", ns: configs, hook_name: "useTranscription", method_name: "updateMicWordFilterList_FromBackend" }, + { endpoint: "/get/data/mic_word_filter", ns: configs, hook_name: "useTranscription", method_name: "updateMicWordFilterList" }, + { endpoint: "/set/data/mic_word_filter", ns: configs, hook_name: "useTranscription", method_name: "setSuccessMicWordFilterList" }, // Transcription (Speaker) { endpoint: "/get/data/speaker_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerRecordTimeout" }, - { endpoint: "/set/data/speaker_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerRecordTimeout" }, + { endpoint: "/set/data/speaker_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSpeakerRecordTimeout" }, { endpoint: "/get/data/speaker_phrase_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerPhraseTimeout" }, - { endpoint: "/set/data/speaker_phrase_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerPhraseTimeout" }, + { endpoint: "/set/data/speaker_phrase_timeout", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSpeakerPhraseTimeout" }, { endpoint: "/get/data/speaker_max_phrases", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerMaxWords" }, - { endpoint: "/set/data/speaker_max_phrases", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerMaxWords" }, + { endpoint: "/set/data/speaker_max_phrases", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSpeakerMaxWords" }, // Transcription (AI Models) { endpoint: "/get/data/selected_transcription_engine", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionEngine" }, - { endpoint: "/set/data/selected_transcription_engine", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionEngine" }, + { endpoint: "/set/data/selected_transcription_engine", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedTranscriptionEngine" }, { endpoint: "/get/data/whisper_weight_type", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperWeightType" }, - { endpoint: "/set/data/whisper_weight_type", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperWeightType" }, + { endpoint: "/set/data/whisper_weight_type", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedWhisperWeightType" }, { endpoint: "/get/data/selectable_whisper_weight_type_dict", ns: configs, hook_name: "useTranscription", method_name: "updateDownloadedWhisperWeightTypeStatus" }, @@ -219,84 +219,84 @@ export const ROUTE_META_LIST = [ { endpoint: "/get/data/transcription_compute_device_list", ns: configs, hook_name: "useTranscription", method_name: "updateSelectableWhisperComputeDeviceList_FromBackend" }, { endpoint: "/get/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperComputeDevice" }, - { endpoint: "/set/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperComputeDevice" }, + { endpoint: "/set/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedWhisperComputeDevice" }, // VR { endpoint: "/get/data/overlay_small_log", ns: configs, hook_name: "useVr", method_name: "updateIsEnabledOverlaySmallLog" }, - { endpoint: "/set/enable/overlay_small_log", ns: configs, hook_name: "useVr", method_name: "updateIsEnabledOverlaySmallLog" }, - { endpoint: "/set/disable/overlay_small_log", ns: configs, hook_name: "useVr", method_name: "updateIsEnabledOverlaySmallLog" }, + { endpoint: "/set/enable/overlay_small_log", ns: configs, hook_name: "useVr", method_name: "setSuccessIsEnabledOverlaySmallLog" }, + { endpoint: "/set/disable/overlay_small_log", ns: configs, hook_name: "useVr", method_name: "setSuccessIsEnabledOverlaySmallLog" }, { endpoint: "/get/data/overlay_small_log_settings", ns: configs, hook_name: "useVr", method_name: "updateOverlaySmallLogSettings" }, - { endpoint: "/set/data/overlay_small_log_settings", ns: configs, hook_name: "useVr", method_name: "updateOverlaySmallLogSettings" }, + { endpoint: "/set/data/overlay_small_log_settings", ns: configs, hook_name: "useVr", method_name: "setSuccessOverlaySmallLogSettings" }, { endpoint: "/get/data/overlay_large_log", ns: configs, hook_name: "useVr", method_name: "updateIsEnabledOverlayLargeLog" }, - { endpoint: "/set/enable/overlay_large_log", ns: configs, hook_name: "useVr", method_name: "updateIsEnabledOverlayLargeLog" }, - { endpoint: "/set/disable/overlay_large_log", ns: configs, hook_name: "useVr", method_name: "updateIsEnabledOverlayLargeLog" }, + { endpoint: "/set/enable/overlay_large_log", ns: configs, hook_name: "useVr", method_name: "setSuccessIsEnabledOverlayLargeLog" }, + { endpoint: "/set/disable/overlay_large_log", ns: configs, hook_name: "useVr", method_name: "setSuccessIsEnabledOverlayLargeLog" }, { endpoint: "/get/data/overlay_large_log_settings", ns: configs, hook_name: "useVr", method_name: "updateOverlayLargeLogSettings" }, - { endpoint: "/set/data/overlay_large_log_settings", ns: configs, hook_name: "useVr", method_name: "updateOverlayLargeLogSettings" }, + { endpoint: "/set/data/overlay_large_log_settings", ns: configs, hook_name: "useVr", method_name: "setSuccessOverlayLargeLogSettings" }, { endpoint: "/get/data/overlay_show_only_translated_messages", ns: configs, hook_name: "useVr", method_name: "updateOverlayShowOnlyTranslatedMessages" }, - { endpoint: "/set/enable/overlay_show_only_translated_messages", ns: configs, hook_name: "useVr", method_name: "updateOverlayShowOnlyTranslatedMessages" }, - { endpoint: "/set/disable/overlay_show_only_translated_messages", ns: configs, hook_name: "useVr", method_name: "updateOverlayShowOnlyTranslatedMessages" }, + { endpoint: "/set/enable/overlay_show_only_translated_messages", ns: configs, hook_name: "useVr", method_name: "setSuccessOverlayShowOnlyTranslatedMessages" }, + { endpoint: "/set/disable/overlay_show_only_translated_messages", ns: configs, hook_name: "useVr", method_name: "setSuccessOverlayShowOnlyTranslatedMessages" }, { endpoint: "/run/send_text_overlay", ns: null, hook_name: null, method_name: null }, // Others { endpoint: "/get/data/auto_clear_message_box", ns: configs, hook_name: "useOthers", method_name: "updateEnableAutoClearMessageInputBox" }, - { endpoint: "/set/enable/auto_clear_message_box", ns: configs, hook_name: "useOthers", method_name: "updateEnableAutoClearMessageInputBox" }, - { endpoint: "/set/disable/auto_clear_message_box", ns: configs, hook_name: "useOthers", method_name: "updateEnableAutoClearMessageInputBox" }, + { endpoint: "/set/enable/auto_clear_message_box", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableAutoClearMessageInputBox" }, + { endpoint: "/set/disable/auto_clear_message_box", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableAutoClearMessageInputBox" }, { endpoint: "/get/data/send_only_translated_messages", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendOnlyTranslatedMessages" }, - { endpoint: "/set/enable/send_only_translated_messages", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendOnlyTranslatedMessages" }, - { endpoint: "/set/disable/send_only_translated_messages", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendOnlyTranslatedMessages" }, + { endpoint: "/set/enable/send_only_translated_messages", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableSendOnlyTranslatedMessages" }, + { endpoint: "/set/disable/send_only_translated_messages", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableSendOnlyTranslatedMessages" }, { endpoint: "/get/data/logger_feature", ns: configs, hook_name: "useOthers", method_name: "updateEnableAutoExportMessageLogs" }, - { endpoint: "/set/enable/logger_feature", ns: configs, hook_name: "useOthers", method_name: "updateEnableAutoExportMessageLogs" }, - { endpoint: "/set/disable/logger_feature", ns: configs, hook_name: "useOthers", method_name: "updateEnableAutoExportMessageLogs" }, + { endpoint: "/set/enable/logger_feature", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableAutoExportMessageLogs" }, + { endpoint: "/set/disable/logger_feature", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableAutoExportMessageLogs" }, { endpoint: "/get/data/vrc_mic_mute_sync", ns: configs, hook_name: "useOthers", method_name: "updateEnableVrcMicMuteSync_FromBackend" }, - { endpoint: "/set/enable/vrc_mic_mute_sync", ns: configs, hook_name: "useOthers", method_name: "updateEnableVrcMicMuteSync_FromBackend" }, - { endpoint: "/set/disable/vrc_mic_mute_sync", ns: configs, hook_name: "useOthers", method_name: "updateEnableVrcMicMuteSync_FromBackend" }, + { endpoint: "/set/enable/vrc_mic_mute_sync", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableVrcMicMuteSync" }, + { endpoint: "/set/disable/vrc_mic_mute_sync", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableVrcMicMuteSync" }, { endpoint: "/get/data/send_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendMessageToVrc" }, - { endpoint: "/set/enable/send_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendMessageToVrc" }, - { endpoint: "/set/disable/send_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendMessageToVrc" }, + { endpoint: "/set/enable/send_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableSendMessageToVrc" }, + { endpoint: "/set/disable/send_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableSendMessageToVrc" }, { endpoint: "/get/data/send_received_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendReceivedMessageToVrc" }, - { endpoint: "/set/enable/send_received_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendReceivedMessageToVrc" }, - { endpoint: "/set/disable/send_received_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendReceivedMessageToVrc" }, + { endpoint: "/set/enable/send_received_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableSendReceivedMessageToVrc" }, + { endpoint: "/set/disable/send_received_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableSendReceivedMessageToVrc" }, { endpoint: "/get/data/notification_vrc_sfx", ns: configs, hook_name: "useOthers", method_name: "updateEnableNotificationVrcSfx" }, - { endpoint: "/set/enable/notification_vrc_sfx", ns: configs, hook_name: "useOthers", method_name: "updateEnableNotificationVrcSfx" }, - { endpoint: "/set/disable/notification_vrc_sfx", ns: configs, hook_name: "useOthers", method_name: "updateEnableNotificationVrcSfx" }, + { endpoint: "/set/enable/notification_vrc_sfx", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableNotificationVrcSfx" }, + { endpoint: "/set/disable/notification_vrc_sfx", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableNotificationVrcSfx" }, // Hotkeys { endpoint: "/get/data/hotkeys", ns: configs, hook_name: "useHotkeys", method_name: "updateHotkeys" }, - { endpoint: "/set/data/hotkeys", ns: configs, hook_name: "useHotkeys", method_name: "updateHotkeys" }, + { endpoint: "/set/data/hotkeys", ns: configs, hook_name: "useHotkeys", method_name: "setSuccessHotkeys" }, // Plugins { endpoint: "/get/data/plugins_status", ns: configs, hook_name: "usePlugins", method_name: "updateSavedPluginsStatus" }, - { endpoint: "/set/data/plugins_status", ns: configs, hook_name: "usePlugins", method_name: "updateSavedPluginsStatus" }, + { endpoint: "/set/data/plugins_status", ns: configs, hook_name: "usePlugins", method_name: "setSuccessSavedPluginsStatus" }, // Advanced Settings { endpoint: "/get/data/osc_ip_address", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateOscIpAddress" }, - { endpoint: "/set/data/osc_ip_address", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateOscIpAddress" }, + { endpoint: "/set/data/osc_ip_address", ns: configs, hook_name: "useAdvancedSettings", method_name: "setSuccessOscIpAddress" }, { endpoint: "/get/data/osc_port", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateOscPort" }, - { endpoint: "/set/data/osc_port", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateOscPort" }, + { endpoint: "/set/data/osc_port", ns: configs, hook_name: "useAdvancedSettings", method_name: "setSuccessOscPort" }, { endpoint: "/get/data/websocket_server", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateEnableWebsocket" }, - { endpoint: "/set/enable/websocket_server", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateEnableWebsocket" }, - { endpoint: "/set/disable/websocket_server", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateEnableWebsocket" }, + { endpoint: "/set/enable/websocket_server", ns: configs, hook_name: "useAdvancedSettings", method_name: "setSuccessEnableWebsocket" }, + { endpoint: "/set/disable/websocket_server", ns: configs, hook_name: "useAdvancedSettings", method_name: "setSuccessEnableWebsocket" }, { endpoint: "/get/data/websocket_host", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateWebsocketHost" }, - { endpoint: "/set/data/websocket_host", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateWebsocketHost" }, + { endpoint: "/set/data/websocket_host", ns: configs, hook_name: "useAdvancedSettings", method_name: "setSuccessWebsocketHost" }, { endpoint: "/get/data/websocket_port", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateWebsocketPort" }, - { endpoint: "/set/data/websocket_port", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateWebsocketPort" }, + { endpoint: "/set/data/websocket_port", ns: configs, hook_name: "useAdvancedSettings", method_name: "setSuccessWebsocketPort" }, // Not Implemented Yet... From e02ed917210ef59771a6a0f0ab32ebf718712241 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 21 Jun 2025 09:38:38 +0900 Subject: [PATCH 38/41] [Update/bugfix] Notification UI: Adjust an animation. Add localizations. Fix stack behavior that was not updated correctly. (it still has an issue tho.) --- locales/en.yml | 3 ++ locales/ja.yml | 3 ++ .../ReactToastifyOverrideClass.scss | 4 +- .../SnackbarController.jsx | 46 +++++++++++-------- src-ui/logics/common/useNotificationStatus.js | 8 ++-- src-ui/logics/configs/plugins/usePlugins.js | 10 ++-- 6 files changed, 46 insertions(+), 28 deletions(-) diff --git a/locales/en.yml b/locales/en.yml index 24bb73a8..9e133bed 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -269,6 +269,9 @@ config_page: websocket_port: label: "WebSocket Port" + notifications: + save_success: "Settings have been saved" + plugin_notifications: downloading: Downloading the plugin. downloaded_success: Downloaded successfully. diff --git a/locales/ja.yml b/locales/ja.yml index bd0ffe60..b2ff2ad8 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -269,6 +269,9 @@ config_page: websocket_port: label: "WebSocket Port" + notifications: + save_success: "設定を保存しました。" + plugin_notifications: downloading: プラグインをダウンロード中。 downloaded_success: プラグインのダウンロードが完了しました。 diff --git a/src-ui/app/others/snackbar_controller/ReactToastifyOverrideClass.scss b/src-ui/app/others/snackbar_controller/ReactToastifyOverrideClass.scss index d8d3045e..5e0a2539 100644 --- a/src-ui/app/others/snackbar_controller/ReactToastifyOverrideClass.scss +++ b/src-ui/app/others/snackbar_controller/ReactToastifyOverrideClass.scss @@ -138,7 +138,7 @@ .fade_out { opacity: 1; animation-name: fade_out; - animation-duration: 0.2s; - animation-timing-function: ease-out; + animation-duration: 0.1s; + animation-timing-function: ease-in; animation-fill-mode: forwards; } \ No newline at end of file diff --git a/src-ui/app/others/snackbar_controller/SnackbarController.jsx b/src-ui/app/others/snackbar_controller/SnackbarController.jsx index b617b98a..fe692c10 100644 --- a/src-ui/app/others/snackbar_controller/SnackbarController.jsx +++ b/src-ui/app/others/snackbar_controller/SnackbarController.jsx @@ -35,14 +35,13 @@ export const SnackbarController = () => { } ); - let hideDuration = 5000; + let hide_duration = 5000; if (settings.options?.hide_duration === null) { - hideDuration = false; + hide_duration = false; } else if (Number(settings.options?.hide_duration)) { - hideDuration = Number(settings.options?.hide_duration); + hide_duration = Number(settings.options?.hide_duration); } - const to_hide_progress_bar = (settings.options?.to_hide_progress_bar === true) ? true : false; useEffect(() => { if (!settings.is_open) return; @@ -50,22 +49,29 @@ export const SnackbarController = () => { const message_text = settings.message; const category_id = settings.category_id ? settings.category_id : message_text; - setContainerKey(prevKey => prevKey + 1); + const to_hide_progress_bar = (settings.options?.to_hide_progress_bar === true) ? true : false; + + const asyncShowNotification = async () => { + setTimeout(() => { + toast(message_text, { + toastId: category_id, + type: settings.status, + autoClose: hide_duration, + transition: CustomTransition, + toastClassName: snackbar_classname, + hideProgressBar: to_hide_progress_bar, + progressClassName: styles.toast_progress, + closeButton: , + onClose: () => { + closeNotification(); + }, + }); + }, 100); + }; + + setContainerKey(prevKey => prevKey + 1); + asyncShowNotification(); - setTimeout(() => { - toast(message_text, { - toastId: category_id, - type: settings.status, - autoClose: hideDuration, - transition: CustomTransition, - toastClassName: snackbar_classname, - progressClassName: styles.toast_progress, - closeButton: , - onClose: () => { - closeNotification(); - }, - }); - }, 50); }, [settings]); return ( @@ -73,7 +79,7 @@ export const SnackbarController = () => { key={containerKey} position="bottom-left" transition={CustomTransition} - hideProgressBar={to_hide_progress_bar} + hideProgressBar={false} newestOnTop={false} closeOnClick={false} pauseOnFocusLoss={false} diff --git a/src-ui/logics/common/useNotificationStatus.js b/src-ui/logics/common/useNotificationStatus.js index 6c9614cd..9667aaba 100644 --- a/src-ui/logics/common/useNotificationStatus.js +++ b/src-ui/logics/common/useNotificationStatus.js @@ -1,7 +1,9 @@ import { useStore_NotificationStatus } from "@store"; +import { useI18n } from "@useI18n"; export const useNotificationStatus = () => { const { currentNotificationStatus, updateNotificationStatus } = useStore_NotificationStatus(); + const { t } = useI18n(); const showNotification_Warning = (message, options = {}) => { updateNotificationStatus({ @@ -34,12 +36,12 @@ export const useNotificationStatus = () => { }; const showNotification_SaveSuccess = (options = {}) => { - options = { hide_duration: 2000, to_hide_progress_bar: true, ...options }; + options = { hide_duration: 1000, to_hide_progress_bar: true, ...options }; updateNotificationStatus({ status: "success", is_open: true, - category_id: (options.category_id) ? options.category_id : null, - message: "設定の適用と、保存が完了しました。", + category_id: "save_success", + message: t("config_page.notifications.save_success"), options: options, }); }; diff --git a/src-ui/logics/configs/plugins/usePlugins.js b/src-ui/logics/configs/plugins/usePlugins.js index 42f7d5a9..a467aeb7 100644 --- a/src-ui/logics/configs/plugins/usePlugins.js +++ b/src-ui/logics/configs/plugins/usePlugins.js @@ -283,6 +283,10 @@ export const usePlugins = () => { }; const toggleSavedPluginsStatus = (target_plugin_id) => { + const successPluginNotification = (message) => showNotification_Success(message, { + hide_duration: 1000, + category_id: "to_enable_plugin" + }); const is_exists = currentSavedPluginsStatus.data.some( (d) => d.plugin_id === target_plugin_id ); @@ -292,8 +296,8 @@ export const usePlugins = () => { if (d.plugin_id === target_plugin_id) { d.is_enabled = !d.is_enabled; (d.is_enabled) - ? showNotification_Success(t("plugin_notifications.is_enabled")) - : showNotification_Success(t("plugin_notifications.is_disabled")); + ? successPluginNotification(t("plugin_notifications.is_enabled")) + : successPluginNotification(t("plugin_notifications.is_disabled")); } return d; }); @@ -303,7 +307,7 @@ export const usePlugins = () => { plugin_id: target_plugin_id, is_enabled: true, }); - showNotification_Success(t("plugin_notifications.is_enabled")) + successPluginNotification(t("plugin_notifications.is_enabled")) } // 「currentPluginsData.data」でis_downloadedがtrueのものだけ残す From b15a26c3d56aae0dfeed342a7ba5ecf5e22ff905 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Mon, 23 Jun 2025 11:24:18 +0900 Subject: [PATCH 39/41] [bugfix] Plugins: Add error handling. when error occurred while rendering a plugin, set status disabled and an error. --- locales/en.yml | 3 +- locales/ja.yml | 1 + .../setting_box/plugins/Plugins.jsx | 7 +- .../setting_box/plugins/Plugins.module.scss | 1 + .../app/main_page/main_section/PluginHost.jsx | 28 ++++++-- .../SnackbarController.jsx | 4 +- src-ui/logics/configs/plugins/usePlugins.js | 64 +++++++++++++------ 7 files changed, 78 insertions(+), 30 deletions(-) diff --git a/locales/en.yml b/locales/en.yml index 9e133bed..05e5601d 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -270,7 +270,7 @@ config_page: label: "WebSocket Port" notifications: - save_success: "Settings have been saved" + save_success: "Settings have been saved." plugin_notifications: downloading: Downloading the plugin. @@ -282,6 +282,7 @@ plugin_notifications: updated_error: Update failed. disabled_out_of_support: The plugin has been disabled. It's not supported on this VRCT version. + disabled_due_to_an_error: "An error was detected while running the plugin. Please report this to the plugin developer." is_enabled: The plugin has enabled. is_disabled: The plugin has disabled. \ No newline at end of file diff --git a/locales/ja.yml b/locales/ja.yml index b2ff2ad8..d36bec89 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -282,6 +282,7 @@ plugin_notifications: updated_error: プラグインのアップデートに失敗しました。 disabled_out_of_support: 現在のバージョンとの互換性がありません。プラグインを無効にしました。 + disabled_due_to_an_error: プラグイン実行中にエラーを検知しました。プラグイン開発者に報告してください。 is_enabled: プラグインを有効にしました。 is_disabled: プラグインを無効にしました。 \ No newline at end of file diff --git a/src-ui/app/config_page/setting_section/setting_box/plugins/Plugins.jsx b/src-ui/app/config_page/setting_section/setting_box/plugins/Plugins.jsx index aa4cdf75..6c80beb2 100644 --- a/src-ui/app/config_page/setting_section/setting_box/plugins/Plugins.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/plugins/Plugins.jsx @@ -105,7 +105,12 @@ const PluginDownloadContainer = () => {
{plugin.is_error ? ( -

Error: {plugin.error_message}

+
+

{t(`plugin_notifications.${plugin.error_message_type}`)}

+

plugin_version: {plugin.downloaded_plugin_info.plugin_version}

+

min_supported_vrct_version: {plugin.downloaded_plugin_info.min_supported_vrct_version}

+

max_supported_vrct_version: {plugin.downloaded_plugin_info.max_supported_vrct_version}

+
) : ( { +export const PluginHost = ({ render_components }) => { + const { setErrorPlugin } = usePlugins(); return ( <> - {render_components - .map((plugin, index) => { - const PluginComponent = plugin.component; - return PluginComponent ? : null; - })} + {render_components.map((plugin, index) => { + const PluginComponent = plugin.component; + const plugin_id = plugin.plugin_id; + + return PluginComponent ? ( + null} + onError={(_error, _info) => { + // Disable the plugin on error + setErrorPlugin(plugin_id, "disabled_due_to_an_error"); + }} + > + + + ) : null; + })} ); }; \ No newline at end of file diff --git a/src-ui/app/others/snackbar_controller/SnackbarController.jsx b/src-ui/app/others/snackbar_controller/SnackbarController.jsx index fe692c10..60edac1f 100644 --- a/src-ui/app/others/snackbar_controller/SnackbarController.jsx +++ b/src-ui/app/others/snackbar_controller/SnackbarController.jsx @@ -69,14 +69,14 @@ export const SnackbarController = () => { }, 100); }; - setContainerKey(prevKey => prevKey + 1); + // setContainerKey(prevKey => prevKey + 1); asyncShowNotification(); }, [settings]); return ( { }); }; - const toggleSavedPluginsStatus = (target_plugin_id) => { - const successPluginNotification = (message) => showNotification_Success(message, { - hide_duration: 1000, - category_id: "to_enable_plugin" - }); - const is_exists = currentSavedPluginsStatus.data.some( + const setSavedPluginEnabled = (target_plugin_id, is_enabled) => { + const notify = () => { + const msg_key = is_enabled + ? "plugin_notifications.is_enabled" + : "plugin_notifications.is_disabled"; + showNotification_Success(t(msg_key), { + hide_duration: 1000, + category_id: "switch_enable_plugin", + }); + } + + const exists = currentSavedPluginsStatus.data.some( (d) => d.plugin_id === target_plugin_id ); + let new_value = []; - if (is_exists) { + + if (exists) { new_value = currentSavedPluginsStatus.data.map((d) => { if (d.plugin_id === target_plugin_id) { - d.is_enabled = !d.is_enabled; - (d.is_enabled) - ? successPluginNotification(t("plugin_notifications.is_enabled")) - : successPluginNotification(t("plugin_notifications.is_disabled")); + d.is_enabled = is_enabled; + notify(); } return d; }); } else { - new_value.push(...currentSavedPluginsStatus.data); - new_value.push({ - plugin_id: target_plugin_id, - is_enabled: true, - }); - successPluginNotification(t("plugin_notifications.is_enabled")) + // 存在しない場合は追加 + new_value = [ + ...currentSavedPluginsStatus.data, + { plugin_id: target_plugin_id, is_enabled: is_enabled } + ]; + notify(); } - // 「currentPluginsData.data」でis_downloadedがtrueのものだけ残す + // ダウンロード済みプラグインのみ残す new_value = new_value.filter((item) => currentPluginsData.data.some( - (plugin) => plugin.plugin_id === item.plugin_id && plugin.is_downloaded + (p) => p.plugin_id === item.plugin_id && p.is_downloaded ) ); setSavedPluginsStatus(new_value); }; + const toggleSavedPluginsStatus = (plugin_id) => { + // 現在の状態を探す(未登録なら false とみなす) + const current = currentSavedPluginsStatus.data.find( + (d) => d.plugin_id === plugin_id + )?.is_enabled ?? false; + setSavedPluginEnabled(plugin_id, !current); + }; // Init時の処理 非対応のものを無効化する際に、savedDPluginsStatusから不要なものを削除する処理が邪魔になるので該当コードを削除したバージョン。Init以外で使用する時にはリファクタが必要になる。 const setTargetSavedPluginsStatus_Init = (target_plugin_id, is_enabled) => { @@ -380,6 +393,15 @@ export const usePlugins = () => { showNotification_SaveSuccess(); }; + const setErrorPlugin = (plugin_id, error_message_type) => { + const error_message = t("plugin_notifications.disabled_due_to_an_error"); + + setSavedPluginEnabled(plugin_id, false); + updateTargetPluginData(plugin_id, "is_error", true); + updateTargetPluginData(plugin_id, "error_message_type", error_message_type); + showNotification_Error(error_message); + }; + return { asyncFetchPluginsInfo, @@ -406,11 +428,15 @@ export const usePlugins = () => { currentLoadedPlugins, updateLoadedPlugins, + setSavedPluginEnabled, toggleSavedPluginsStatus, setTargetSavedPluginsStatus_Init, setSavedPluginsStatus, + handlePendingPlugin, + + setErrorPlugin, }; }; From 49366791fbc3a87ef2064aa7f249a7501c681f0a Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Mon, 23 Jun 2025 12:47:43 +0900 Subject: [PATCH 40/41] [bugfix/Chore] Fix update function.(Notification was not shown even the software update has available.) Add noop endpoints '/run/update_software' and '/run/update_cuda_software'. --- src-ui/logics/useReceiveRoutes.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src-ui/logics/useReceiveRoutes.js b/src-ui/logics/useReceiveRoutes.js index 5c0e78e1..d83054d3 100644 --- a/src-ui/logics/useReceiveRoutes.js +++ b/src-ui/logics/useReceiveRoutes.js @@ -10,6 +10,9 @@ export const ROUTE_META_LIST = [ { endpoint: "/run/enable_ai_models", ns: common, hook_name: "useIsVrctAvailable", method_name: "handleAiModelsAvailability" }, { endpoint: "/get/data/compute_mode", ns: common, hook_name: "useComputeMode", method_name: "updateComputeMode" }, + { endpoint: "/run/update_software", ns: null, hook_name: null, method_name: null }, + { endpoint: "/run/update_cuda_software", ns: null, hook_name: null, method_name: null }, + { endpoint: "/get/data/main_window_geometry", ns: common, hook_name: "useWindow", method_name: "restoreWindowGeometry" }, { endpoint: "/set/data/main_window_geometry", ns: null, hook_name: null, method_name: null }, @@ -19,7 +22,7 @@ export const ROUTE_META_LIST = [ // Software Version { endpoint: "/get/data/version", ns: common, hook_name: "useSoftwareVersion", method_name: "updateSoftwareVersion" }, // Latest Software Version Info - { endpoint: "/run/software_update_info", ns: common, hook_name: "useSoftwareVersion", method_name: "updateLatestSoftwareVersionInfo" }, + { endpoint: "/run/software_update_info", ns: common, hook_name: "useSoftwareVersion", method_name: "updateSoftwareVersionInfo" }, { endpoint: "/run/connected_network", ns: common, hook_name: "useHandleNetworkConnection", method_name: "handleNetworkConnection" }, { endpoint: "/run/enable_osc_query", ns: common, hook_name: "useHandleOscQuery", method_name: "handleOscQuery" }, From c2f40d2f5d535b8afd67d4808f5214425ca9fb23 Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Tue, 24 Jun 2025 21:23:18 +0900 Subject: [PATCH 41/41] [Update] version 3.2.0 -> 3.2.1 --- src-python/config.py | 2 +- src-tauri/tauri.conf.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src-python/config.py b/src-python/config.py index f177ca9f..a9b2785a 100644 --- a/src-python/config.py +++ b/src-python/config.py @@ -1000,7 +1000,7 @@ class Config: def init_config(self): # Read Only - self._VERSION = "3.2.0" + self._VERSION = "3.2.1" if getattr(sys, 'frozen', False): self._PATH_LOCAL = os_path.dirname(sys.executable) else: diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index b41c7fd1..898312d6 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "VRCT", - "version": "3.2.0", + "version": "3.2.1", "identifier": "com.vrct.app", "build": { "beforeDevCommand": "",