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
diff --git a/src-ui/app/snackbar_controller/SnackbarController.jsx b/src-ui/app/snackbar_controller/SnackbarController.jsx
deleted file mode 100644
index e503e695..00000000
--- a/src-ui/app/snackbar_controller/SnackbarController.jsx
+++ /dev/null
@@ -1,46 +0,0 @@
-import clsx from "clsx";
-import Snackbar from "@mui/material/Snackbar";
-import Slide from "@mui/material/Slide";
-
-import styles from "./SnackbarController.module.scss";
-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 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;
-
- return (
-
- );
-};
-
-const SlideTransition = (props) => {
- return
;
-};
diff --git a/src-ui/app/snackbar_controller/SnackbarController.module.scss b/src-ui/app/snackbar_controller/SnackbarController.module.scss
deleted file mode 100644
index 075e4419..00000000
--- a/src-ui/app/snackbar_controller/SnackbarController.module.scss
+++ /dev/null
@@ -1,19 +0,0 @@
-.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);
- }
-}
-
-.snackbar_message {
- font-size: 1.4rem;
-}
\ No newline at end of file
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/_useBackendErrorHandling.js b/src-ui/logics/_useBackendErrorHandling.js
index d5987a1b..3af72764 100644
--- a/src-ui/logics/_useBackendErrorHandling.js
+++ b/src-ui/logics/_useBackendErrorHandling.js
@@ -1,41 +1,50 @@
-import { useTranslation } from "react-i18next";
+import { useI18n } from "@useI18n";
import {
useNotificationStatus,
} from "@logics_common";
import {
- useMicRecordTimeout,
- useMicPhraseTimeout,
- useMicMaxWords,
+ useMainFunction,
+} from "@logics_main";
- useSpeakerRecordTimeout,
- useSpeakerPhraseTimeout,
- useSpeakerMaxWords,
+import {
+ useTranscription,
- useDeepLAuthKey,
+ useTranslation,
- useOscIpAddress,
- useWebsocket,
+ useOthers,
+
+ 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 } = useMicRecordTimeout();
- const { updateMicPhraseTimeout } = useMicPhraseTimeout();
- const { updateMicMaxWords } = useMicMaxWords();
+ const {
+ updateMicRecordTimeout,
+ updateMicPhraseTimeout,
+ updateMicMaxWords,
- const { updateSpeakerRecordTimeout } = useSpeakerRecordTimeout();
- const { updateSpeakerPhraseTimeout } = useSpeakerPhraseTimeout();
- const { updateSpeakerMaxWords } = useSpeakerMaxWords();
+ updateSpeakerRecordTimeout,
+ updateSpeakerPhraseTimeout,
+ updateSpeakerMaxWords,
+ } = useTranscription();
- const { updateDeepLAuthKey } = useDeepLAuthKey();
+ const { updateTranslationStatus, updateTranscriptionSendStatus, updateTranscriptionReceiveStatus } = useMainFunction();
- const { updateOscIpAddress } = useOscIpAddress();
- const { updateEnableWebsocket, updateWebsocketHost, updateWebsocketPort } = useWebsocket();
+ const { updateDeepLAuthKey } = useTranslation();
+
+ const { updateEnableVrcMicMuteSync } = useOthers();
+
+ const {
+ updateOscIpAddress,
+ updateEnableWebsocket,
+ updateWebsocketHost,
+ updateWebsocketPort,
+ } = useAdvancedSettings();
const errorHandling_Backend = ({message, data, endpoint, result}) => {
switch (endpoint) {
@@ -70,16 +79,53 @@ 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);
- 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;
@@ -130,6 +176,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":
diff --git a/src-ui/logics/common/useHandleOscQuery.js b/src-ui/logics/common/useHandleOscQuery.js
index 2e6b1681..f952aaac 100644
--- a/src-ui/logics/common/useHandleOscQuery.js
+++ b/src-ui/logics/common/useHandleOscQuery.js
@@ -1,44 +1,47 @@
-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 = ({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 = "";
+ const handleOscQuery = (payload) => {
+ const is_osc_query_enabled = payload.data;
+ const disabled_functions = payload.disabled_functions;
- 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,
+ 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
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 416555a6..78986b55 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();
@@ -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/useNotificationStatus.js b/src-ui/logics/common/useNotificationStatus.js
index f4aab3ed..9667aaba 100644
--- a/src-ui/logics/common/useNotificationStatus.js
+++ b/src-ui/logics/common/useNotificationStatus.js
@@ -1,15 +1,15 @@
import { useStore_NotificationStatus } from "@store";
+import { useI18n } from "@useI18n";
export const useNotificationStatus = () => {
const { currentNotificationStatus, updateNotificationStatus } = useStore_NotificationStatus();
-
- const generateRandomKey = () => Math.random();
+ const { t } = useI18n();
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 +19,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,14 +29,24 @@ 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 closeNotification = (event, reason) => {
- if (reason === "clickaway") return;
+ const showNotification_SaveSuccess = (options = {}) => {
+ options = { hide_duration: 1000, to_hide_progress_bar: true, ...options };
+ updateNotificationStatus({
+ status: "success",
+ is_open: true,
+ category_id: "save_success",
+ message: t("config_page.notifications.save_success"),
+ options: options,
+ });
+ };
+
+ const closeNotification = () => {
updateNotificationStatus((prev) => ({
...prev.data,
is_open: false,
@@ -50,6 +60,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/common/useOpenFolder.js b/src-ui/logics/common/useOpenFolder.js
index 202ef5ad..6ecfd6bd 100644
--- a/src-ui/logics/common/useOpenFolder.js
+++ b/src-ui/logics/common/useOpenFolder.js
@@ -1,17 +1,27 @@
-import { useStdoutToPython } from "@logics/useStdoutToPython";
+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 18f24a7f..ea6e99ad 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();
@@ -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/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..3e7f4059 100644
--- a/src-ui/logics/common/useWindow.js
+++ b/src-ui/logics/common/useWindow.js
@@ -1,13 +1,13 @@
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 { 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/useAdvancedSettings.js b/src-ui/logics/configs/advanced_settings/useAdvancedSettings.js
new file mode 100644
index 00000000..7bf5652e
--- /dev/null
+++ b/src-ui/logics/configs/advanced_settings/useAdvancedSettings.js
@@ -0,0 +1,150 @@
+import {
+ useStore_OscIpAddress,
+ useStore_OscPort,
+ useStore_EnableWebsocket,
+ useStore_WebsocketHost,
+ useStore_WebsocketPort,
+} from "@store";
+import { useStdoutToPython } from "@useStdoutToPython";
+import { useNotificationStatus } from "@logics_common";
+
+export const useAdvancedSettings = () => {
+ const { asyncStdoutToPython } = useStdoutToPython();
+ const { showNotification_Error, showNotification_SaveSuccess } = 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);
+ };
+
+ const setSuccessOscIpAddress = (osc_ip_address) => {
+ updateOscIpAddress(osc_ip_address);
+ showNotification_SaveSuccess();
+ };
+
+ // OSC Port
+ const getOscPort = () => {
+ pendingOscPort();
+ asyncStdoutToPython("/get/data/osc_port");
+ };
+
+ const setOscPort = (osc_port) => {
+ pendingOscPort();
+ asyncStdoutToPython("/set/data/osc_port", osc_port);
+ };
+
+ const setSuccessOscPort = (osc_port) => {
+ updateOscPort(osc_port);
+ showNotification_SaveSuccess();
+ };
+
+ const saveErrorOscPort = ({ data, message, _result }) => {
+ updateOscPort(d => d.data);
+ showNotification_Error(_result);
+ };
+
+ // WebSocket Enable
+ const getEnableWebsocket = () => {
+ pendingEnableWebsocket();
+ asyncStdoutToPython("/get/data/websocket_server");
+ };
+
+ const toggleEnableWebsocket = () => {
+ pendingEnableWebsocket();
+ if (currentEnableWebsocket.data) {
+ asyncStdoutToPython("/set/disable/websocket_server");
+ } else {
+ asyncStdoutToPython("/set/enable/websocket_server");
+ }
+ };
+
+ const setSuccessEnableWebsocket = (is_enabled) => {
+ updateEnableWebsocket(is_enabled);
+ showNotification_SaveSuccess();
+ };
+
+ // WebSocket Host
+ const getWebsocketHost = () => {
+ pendingWebsocketHost();
+ asyncStdoutToPython("/get/data/websocket_host");
+ };
+
+ const setWebsocketHost = (websocket_host) => {
+ pendingWebsocketHost();
+ 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");
+ };
+
+ const setWebsocketPort = (websocket_port) => {
+ pendingWebsocketPort();
+ asyncStdoutToPython("/set/data/websocket_port", websocket_port);
+ };
+
+ const setSuccessWebsocketPort = (websocket_port) => {
+ updateWebsocketPort(websocket_port);
+ showNotification_SaveSuccess();
+ };
+
+ return {
+ // OSC IP Address
+ currentOscIpAddress,
+ getOscIpAddress,
+ updateOscIpAddress,
+ setOscIpAddress,
+ setSuccessOscIpAddress,
+
+ // OSC Port
+ currentOscPort,
+ getOscPort,
+ updateOscPort,
+ setOscPort,
+ setSuccessOscPort,
+ saveErrorOscPort,
+
+ // WebSocket Enable
+ currentEnableWebsocket,
+ getEnableWebsocket,
+ updateEnableWebsocket,
+ toggleEnableWebsocket,
+ setSuccessEnableWebsocket,
+
+ // WebSocket Host
+ currentWebsocketHost,
+ getWebsocketHost,
+ updateWebsocketHost,
+ setWebsocketHost,
+ setSuccessWebsocketHost,
+
+ // WebSocket Port
+ currentWebsocketPort,
+ getWebsocketPort,
+ updateWebsocketPort,
+ setWebsocketPort,
+ setSuccessWebsocketPort,
+ };
+};
\ 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 702a6d98..00000000
--- a/src-ui/logics/configs/advanced_settings/useOscIpAddress.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_OscIpAddress } from "@store";
-import { useStdoutToPython } from "@logics/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 d3e28557..00000000
--- a/src-ui/logics/configs/advanced_settings/useOscPort.js
+++ /dev/null
@@ -1,33 +0,0 @@
-import { useStore_OscPort } from "@store";
-import { useStdoutToPython } from "@logics/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/advanced_settings/useWebsocket.js b/src-ui/logics/configs/advanced_settings/useWebsocket.js
deleted file mode 100644
index 51361489..00000000
--- a/src-ui/logics/configs/advanced_settings/useWebsocket.js
+++ /dev/null
@@ -1,67 +0,0 @@
-import {
- useStore_EnableWebsocket,
- useStore_WebsocketHost,
- useStore_WebsocketPort,
-} from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
-
-export const useWebsocket = () => {
- const { asyncStdoutToPython } = useStdoutToPython();
- const { currentEnableWebsocket, updateEnableWebsocket, pendingEnableWebsocket } = useStore_EnableWebsocket();
- const { currentWebsocketHost, updateWebsocketHost, pendingWebsocketHost } = useStore_WebsocketHost();
- const { currentWebsocketPort, updateWebsocketPort, pendingWebsocketPort } = useStore_WebsocketPort();
-
- const getEnableWebsocket = () => {
- pendingEnableWebsocket();
- asyncStdoutToPython("/get/data/websocket_server");
- };
-
- const toggleEnableWebsocket = () => {
- pendingEnableWebsocket();
- if (currentEnableWebsocket.data) {
- asyncStdoutToPython("/set/disable/websocket_server");
- } else {
- asyncStdoutToPython("/set/enable/websocket_server");
- }
- };
-
-
- const getWebsocketHost = () => {
- pendingWebsocketHost();
- asyncStdoutToPython("/get/data/websocket_host");
- };
-
- const setWebsocketHost = (websocket_host) => {
- pendingWebsocketHost();
- asyncStdoutToPython("/set/data/websocket_host", websocket_host);
- };
-
-
- const getWebsocketPort = () => {
- pendingWebsocketPort();
- asyncStdoutToPython("/get/data/websocket_port");
- };
-
- const setWebsocketPort = (websocket_port) => {
- pendingWebsocketPort();
- asyncStdoutToPython("/set/data/websocket_port", websocket_port);
- };
-
- return {
- currentEnableWebsocket,
- updateEnableWebsocket,
- getEnableWebsocket,
- toggleEnableWebsocket,
-
- currentWebsocketHost,
- updateWebsocketHost,
- getWebsocketHost,
- setWebsocketHost,
-
- currentWebsocketPort,
- updateWebsocketPort,
- getWebsocketPort,
- setWebsocketPort,
-
- };
-};
\ 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..dbf5c310
--- /dev/null
+++ b/src-ui/logics/configs/appearance/useAppearance.js
@@ -0,0 +1,201 @@
+import {
+ useStore_UiLanguage,
+ useStore_UiScaling,
+ useStore_MessageLogUiScaling,
+ useStore_SendMessageButtonType,
+ useStore_ShowResendButton,
+ useStore_SelectedFontFamily,
+ 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();
+ // 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);
+ };
+
+ const setSuccessUiLanguage = (selected_ui_language) => {
+ updateUiLanguage(selected_ui_language);
+ showNotification_SaveSuccess();
+ };
+
+ // UI Scaling
+ const getUiScaling = () => {
+ pendingUiScaling();
+ asyncStdoutToPython("/get/data/ui_scaling");
+ };
+
+ const setUiScaling = (selected_ui_scaling) => {
+ pendingUiScaling();
+ 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();
+ asyncStdoutToPython("/get/data/textbox_ui_scaling");
+ };
+
+ const setMessageLogUiScaling = (selected_ui_scaling) => {
+ pendingMessageLogUiScaling();
+ 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();
+ 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);
+ };
+
+ const setSuccessSendMessageButtonType = (send_message_button_type) => {
+ updateSendMessageButtonType(send_message_button_type);
+ showNotification_SaveSuccess();
+ };
+
+ // 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");
+ }
+ };
+ const setSuccessShowResendButton = (to_show) => {
+ updateShowResendButton(to_show);
+ showNotification_SaveSuccess();
+ };
+
+ // 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);
+ };
+
+ const setSuccessSelectedFontFamily = (selected_font_family) => {
+ updateSelectedFontFamily(selected_font_family);
+ showNotification_SaveSuccess();
+ };
+
+ // Transparency
+ const getTransparency = () => {
+ pendingTransparency();
+ asyncStdoutToPython("/get/data/transparency");
+ };
+
+ const setTransparency = (selected_transparency) => {
+ pendingTransparency();
+ asyncStdoutToPython("/set/data/transparency", selected_transparency);
+ };
+
+ const setSuccessTransparency = (selected_transparency) => {
+ updateTransparency(selected_transparency);
+ showNotification_SaveSuccess();
+ };
+
+
+ return {
+ // UI Language
+ currentUiLanguage,
+ 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
+ currentShowResendButton,
+ 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/appearance/useMessageLogUiScaling.js b/src-ui/logics/configs/appearance/useMessageLogUiScaling.js
deleted file mode 100644
index 625f6263..00000000
--- a/src-ui/logics/configs/appearance/useMessageLogUiScaling.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_MessageLogUiScaling } from "@store";
-import { useStdoutToPython } from "@logics/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/useRestoreWindowGeometry.js b/src-ui/logics/configs/appearance/useRestoreWindowGeometry.js
deleted file mode 100644
index 2cc618be..00000000
--- a/src-ui/logics/configs/appearance/useRestoreWindowGeometry.js
+++ /dev/null
@@ -1,28 +0,0 @@
-// import { useStore_RestoreWindowGeometry } from "@store";
-// import { useStdoutToPython } from "@logics/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/appearance/useSelectedFontFamily.js b/src-ui/logics/configs/appearance/useSelectedFontFamily.js
deleted file mode 100644
index bfb43029..00000000
--- a/src-ui/logics/configs/appearance/useSelectedFontFamily.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_SelectedFontFamily } from "@store";
-import { useStdoutToPython } from "@logics/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 f69a51f2..00000000
--- a/src-ui/logics/configs/appearance/useSendMessageButtonType.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_SendMessageButtonType } from "@store";
-import { useStdoutToPython } from "@logics/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 = (selected_type) => {
- pendingSendMessageButtonType();
- asyncStdoutToPython("/set/data/send_message_button_type", selected_type);
- };
-
- return {
- currentSendMessageButtonType,
- getSendMessageButtonType,
- setSendMessageButtonType,
- updateSendMessageButtonType,
- };
-};
\ 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 9ab7429f..00000000
--- a/src-ui/logics/configs/appearance/useTransparency.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_Transparency } from "@store";
-import { useStdoutToPython } from "@logics/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 149a8fb3..00000000
--- a/src-ui/logics/configs/appearance/useUiLanguage.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_UiLanguage } from "@store";
-import { useStdoutToPython } from "@logics/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 501118f1..00000000
--- a/src-ui/logics/configs/appearance/useUiScaling.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_UiScaling } from "@store";
-import { useStdoutToPython } from "@logics/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/device/useDevice.js b/src-ui/logics/configs/device/useDevice.js
new file mode 100644
index 00000000..b0919ad1
--- /dev/null
+++ b/src-ui/logics/configs/device/useDevice.js
@@ -0,0 +1,306 @@
+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";
+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();
+
+ 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 { currentMicThreshold, updateMicThreshold } = useStore_MicThreshold();
+ const { currentEnableAutomaticMicThreshold, updateEnableAutomaticMicThreshold, pendingEnableAutomaticMicThreshold } = useStore_EnableAutomaticMicThreshold();
+
+ const { currentSpeakerThreshold, updateSpeakerThreshold } = useStore_SpeakerThreshold();
+ const { currentEnableAutomaticSpeakerThreshold, updateEnableAutomaticSpeakerThreshold, 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");
+ }
+ };
+
+ const setSuccessEnableAutoMicSelect = (enabled) => {
+ updateEnableAutoMicSelect(enabled);
+ showNotification_SaveSuccess();
+ };
+
+ // 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");
+ }
+ };
+
+ const setSuccessEnableAutoSpeakerSelect = (enabled) => {
+ updateEnableAutoSpeakerSelect(enabled);
+ showNotification_SaveSuccess();
+ };
+
+ // 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);
+ };
+
+ const setSuccessSelectedMicHost = (payload) => {
+ updateSelectedMicHostAndDevice(payload); // Receive host and device from backend.
+ showNotification_SaveSuccess();
+ };
+
+ // 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);
+ };
+
+ 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 = () => {
+ pendingSelectedSpeakerDevice();
+ asyncStdoutToPython("/get/data/selected_speaker_device");
+ };
+
+ const setSelectedSpeakerDevice = (selected_speaker_device) => {
+ pendingSelectedSpeakerDevice();
+ asyncStdoutToPython("/set/data/selected_speaker_device", selected_speaker_device);
+ };
+
+ const setSuccessSelectedSpeakerDevice = (selected_speaker_device) => {
+ updateSelectedSpeakerDevice(selected_speaker_device);
+ showNotification_SaveSuccess();
+ };
+
+ // Threshold (Mic)
+ const getMicThreshold = () => {
+ asyncStdoutToPython("/get/data/mic_threshold");
+ };
+
+ const setMicThreshold = (mic_threshold) => {
+ 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");
+ };
+
+ const toggleEnableAutomaticMicThreshold = () => {
+ pendingEnableAutomaticMicThreshold();
+ if (currentEnableAutomaticMicThreshold.data) {
+ asyncStdoutToPython("/set/disable/mic_automatic_threshold");
+ } else {
+ asyncStdoutToPython("/set/enable/mic_automatic_threshold");
+ }
+ };
+
+ const setSuccessEnableAutomaticMicThreshold = (enabled) => {
+ updateEnableAutomaticMicThreshold(enabled);
+ showNotification_SaveSuccess();
+ };
+
+ // Threshold (Speaker)
+ const getSpeakerThreshold = () => {
+ asyncStdoutToPython("/get/data/speaker_threshold");
+ };
+
+ const setSpeakerThreshold = (speaker_threshold) => {
+ 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");
+ };
+
+ const toggleEnableAutomaticSpeakerThreshold = () => {
+ pendingEnableAutomaticSpeakerThreshold();
+ if (currentEnableAutomaticSpeakerThreshold.data) {
+ asyncStdoutToPython("/set/disable/speaker_automatic_threshold");
+ } else {
+ asyncStdoutToPython("/set/enable/speaker_automatic_threshold");
+ }
+ };
+
+ const setSuccessEnableAutomaticSpeakerThreshold = (enabled) => {
+ updateEnableAutomaticSpeakerThreshold(enabled);
+ showNotification_SaveSuccess();
+ };
+
+ return {
+ currentEnableAutoMicSelect,
+ getEnableAutoMicSelect,
+ updateEnableAutoMicSelect,
+ toggleEnableAutoMicSelect,
+ setSuccessEnableAutoMicSelect,
+
+ currentEnableAutoSpeakerSelect,
+ getEnableAutoSpeakerSelect,
+ updateEnableAutoSpeakerSelect,
+ toggleEnableAutoSpeakerSelect,
+ setSuccessEnableAutoSpeakerSelect,
+
+ currentMicDeviceList,
+ getMicDeviceList,
+ updateMicDeviceList,
+ updateMicDeviceList_FromBackend,
+
+ currentMicHostList,
+ getMicHostList,
+ updateMicHostList,
+ updateMicHostList_FromBackend,
+
+ currentSpeakerDeviceList,
+ getSpeakerDeviceList,
+ 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/device/useEnableAutoMicSelect.js b/src-ui/logics/configs/device/useEnableAutoMicSelect.js
deleted file mode 100644
index 1370d055..00000000
--- a/src-ui/logics/configs/device/useEnableAutoMicSelect.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import { useStore_EnableAutoMicSelect } from "@store";
-import { useStdoutToPython } from "@logics/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 d43184de..00000000
--- a/src-ui/logics/configs/device/useEnableAutoSpeakerSelect.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import { useStore_EnableAutoSpeakerSelect } from "@store";
-import { useStdoutToPython } from "@logics/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 196b32cf..00000000
--- a/src-ui/logics/configs/device/useMicDeviceList.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import { useStore_MicDeviceList } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
-
-export const useMicDeviceList = () => {
- const { asyncStdoutToPython } = useStdoutToPython();
- const { currentMicDeviceList, updateMicDeviceList, pendingMicDeviceList } = useStore_MicDeviceList();
-
- const getMicDeviceList = () => {
- pendingMicDeviceList();
- asyncStdoutToPython("/get/data/mic_device_list");
- };
-
- return {
- currentMicDeviceList,
- getMicDeviceList,
- updateMicDeviceList,
- };
-};
\ 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 ed61f80a..00000000
--- a/src-ui/logics/configs/device/useMicHostList.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import { useStore_MicHostList } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
-
-export const useMicHostList = () => {
- const { asyncStdoutToPython } = useStdoutToPython();
- const { currentMicHostList, updateMicHostList, pendingMicHostList } = useStore_MicHostList();
-
- const getMicHostList = () => {
- pendingMicHostList();
- asyncStdoutToPython("/get/data/mic_host_list");
- };
-
- return {
- currentMicHostList,
- getMicHostList,
- updateMicHostList,
- };
-};
\ 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 ab6bda6c..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 "@logics/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 798eae5a..00000000
--- a/src-ui/logics/configs/device/useSelectedMicDevice.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_SelectedMicDevice } from "@store";
-import { useStdoutToPython } from "@logics/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 0ef9c882..00000000
--- a/src-ui/logics/configs/device/useSelectedMicHost.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_SelectedMicHost } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
-
-export const useSelectedMicHost = () => {
- const { asyncStdoutToPython } = useStdoutToPython();
- const { currentSelectedMicHost, updateSelectedMicHost, pendingSelectedMicHost } = useStore_SelectedMicHost();
-
- const getSelectedMicHost = () => {
- pendingSelectedMicHost();
- asyncStdoutToPython("/get/data/selected_mic_host");
- };
-
- const setSelectedMicHost = (selected_mic_host) => {
- pendingSelectedMicHost();
- asyncStdoutToPython("/set/data/selected_mic_host", selected_mic_host);
- };
-
- return {
- currentSelectedMicHost,
- getSelectedMicHost,
- updateSelectedMicHost,
- setSelectedMicHost,
- };
-};
\ 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 b8d85693..00000000
--- a/src-ui/logics/configs/device/useSelectedSpeakerDevice.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_SelectedSpeakerDevice } from "@store";
-import { useStdoutToPython } from "@logics/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 2848111c..00000000
--- a/src-ui/logics/configs/device/useSpeakerDeviceList.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import { useStore_SpeakerDeviceList } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
-
-export const useSpeakerDeviceList = () => {
- const { asyncStdoutToPython } = useStdoutToPython();
- const { currentSpeakerDeviceList, updateSpeakerDeviceList, pendingSpeakerDeviceList } = useStore_SpeakerDeviceList();
-
- const getSpeakerDeviceList = () => {
- pendingSpeakerDeviceList();
- asyncStdoutToPython("/get/data/speaker_device_list");
- };
-
- return {
- currentSpeakerDeviceList,
- getSpeakerDeviceList,
- updateSpeakerDeviceList,
- };
-};
\ 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 29824b01..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 "@logics/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/hotkeys/useHotkeys.js b/src-ui/logics/configs/hotkeys/useHotkeys.js
index a2bbe35d..df7db416 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";
@@ -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/index.js b/src-ui/logics/configs/index.js
index 03214771..54e7d133 100644
--- a/src-ui/logics/configs/index.js
+++ b/src-ui/logics/configs/index.js
@@ -1,66 +1,12 @@
-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 { useMessageLogUiScaling } from "./appearance/useMessageLogUiScaling";
-export { useSelectedFontFamily } from "./appearance/useSelectedFontFamily";
-export { useTransparency } from "./appearance/useTransparency";
-export { useSendMessageButtonType } from "./others/useSendMessageButtonType";
-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 { useDevice } from "./device/useDevice";
+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 d04c6094..00000000
--- a/src-ui/logics/configs/others/useEnableAutoClearMessageInputBox.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import { useStore_EnableAutoClearMessageInputBox } from "@store";
-import { useStdoutToPython } from "@logics/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 8249a83a..00000000
--- a/src-ui/logics/configs/others/useEnableAutoExportMessageLogs.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import { useStore_EnableAutoExportMessageLogs } from "@store";
-import { useStdoutToPython } from "@logics/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 24e1096a..00000000
--- a/src-ui/logics/configs/others/useEnableNotificationVrcSfx.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import { useStore_EnableNotificationVrcSfx } from "@store";
-import { useStdoutToPython } from "@logics/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 10ef4b0c..00000000
--- a/src-ui/logics/configs/others/useEnableSendMessageToVrc.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import { useStore_EnableSendMessageToVrc } from "@store";
-import { useStdoutToPython } from "@logics/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 7e9abefb..00000000
--- a/src-ui/logics/configs/others/useEnableSendOnlyTranslatedMessages.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import { useStore_EnableSendOnlyTranslatedMessages } from "@store";
-import { useStdoutToPython } from "@logics/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 5eeeb102..00000000
--- a/src-ui/logics/configs/others/useEnableSendReceivedMessageToVrc.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import { useStore_EnableSendReceivedMessageToVrc } from "@store";
-import { useStdoutToPython } from "@logics/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 6515ffc2..00000000
--- a/src-ui/logics/configs/others/useEnableVrcMicMuteSync.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import { useStore_EnableVrcMicMuteSync } from "@store";
-import { useStdoutToPython } from "@logics/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");
- }
- };
-
- return {
- currentEnableVrcMicMuteSync,
- getEnableVrcMicMuteSync,
- toggleEnableVrcMicMuteSync,
- updateEnableVrcMicMuteSync,
- };
-};
\ 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..62a14364
--- /dev/null
+++ b/src-ui/logics/configs/others/useOthers.js
@@ -0,0 +1,229 @@
+import {
+ useStore_EnableAutoClearMessageInputBox,
+ useStore_EnableSendOnlyTranslatedMessages,
+ useStore_EnableAutoExportMessageLogs,
+ useStore_EnableVrcMicMuteSync,
+ useStore_EnableSendMessageToVrc,
+ useStore_EnableNotificationVrcSfx,
+ useStore_EnableSendReceivedMessageToVrc,
+} from "@store";
+import { useStdoutToPython } from "@useStdoutToPython";
+import { useNotificationStatus } from "@logics_common";
+
+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();
+
+ const { showNotification_SaveSuccess } = useNotificationStatus();
+
+ // 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");
+ }
+ };
+
+ const setSuccessEnableAutoClearMessageInputBox = (enabled) => {
+ updateEnableAutoClearMessageInputBox(enabled);
+ showNotification_SaveSuccess();
+ };
+
+ // 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");
+ }
+ };
+
+ const setSuccessEnableSendOnlyTranslatedMessages = (enabled) => {
+ updateEnableSendOnlyTranslatedMessages(enabled);
+ showNotification_SaveSuccess();
+ };
+
+ // 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");
+ }
+ };
+
+ const setSuccessEnableAutoExportMessageLogs = (enabled) => {
+ updateEnableAutoExportMessageLogs(enabled);
+ showNotification_SaveSuccess();
+ };
+
+ // 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 setSuccessEnableVrcMicMuteSync = (is_enabled) => {
+ updateEnableVrcMicMuteSync(old => ({ ...old.data, is_enabled: is_enabled }));
+ showNotification_SaveSuccess();
+ };
+
+ // 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");
+ }
+ };
+
+ const setSuccessEnableSendMessageToVrc = (enabled) => {
+ updateEnableSendMessageToVrc(enabled);
+ showNotification_SaveSuccess();
+ };
+
+ // 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");
+ }
+ };
+
+ const setSuccessEnableNotificationVrcSfx = (enabled) => {
+ updateEnableNotificationVrcSfx(enabled);
+ showNotification_SaveSuccess();
+ };
+
+ // 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");
+ }
+ };
+
+ 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,
+ setSuccessEnableVrcMicMuteSync,
+
+ // Send Message To VRCT
+ currentEnableSendMessageToVrc,
+ getEnableSendMessageToVrc,
+ toggleEnableSendMessageToVrc,
+ updateEnableSendMessageToVrc,
+ setSuccessEnableSendMessageToVrc,
+
+ // Sounds
+ // Notification VRC SFX
+ currentEnableNotificationVrcSfx,
+ getEnableNotificationVrcSfx,
+ toggleEnableNotificationVrcSfx,
+ updateEnableNotificationVrcSfx,
+ setSuccessEnableNotificationVrcSfx,
+
+ // Speaker2Chatbox
+ // Send Received Message To VRC
+ currentEnableSendReceivedMessageToVrc,
+ getEnableSendReceivedMessageToVrc,
+ toggleEnableSendReceivedMessageToVrc,
+ updateEnableSendReceivedMessageToVrc,
+ setSuccessEnableSendReceivedMessageToVrc,
+ };
+};
\ No newline at end of file
diff --git a/src-ui/logics/configs/others/useSendMessageButtonType.js b/src-ui/logics/configs/others/useSendMessageButtonType.js
deleted file mode 100644
index a6a22add..00000000
--- a/src-ui/logics/configs/others/useSendMessageButtonType.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_SendMessageButtonType } from "@store";
-import { useStdoutToPython } from "@logics/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/plugins/usePlugins.js b/src-ui/logics/configs/plugins/usePlugins.js
index d4d398fa..bec290ba 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,
@@ -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";
@@ -36,8 +36,8 @@ import * as logics_common from "@logics_common";
const PLUGIN_LIST_URL = getPluginsList();
export const usePlugins = () => {
- const { t } = useTranslation();
- const { showNotification_Success, showNotification_Error } = useNotificationStatus();
+ const { t, i18n } = useI18n();
+ const { showNotification_SaveSuccess, showNotification_Success, showNotification_Error } = useNotificationStatus();
const { asyncStdoutToPython } = useStdoutToPython();
const { currentFetchedPluginsInfo, updateFetchedPluginsInfo, pendingFetchedPluginsInfo, errorFetchedPluginsInfo } = useStore_FetchedPluginsInfo();
@@ -50,8 +50,6 @@ export const usePlugins = () => {
const { asyncTauriFetchGithub } = useFetch();
- const { i18n } = useTranslation();
-
const generatePluginContext = (downloaded_plugin_info) => {
const plugin_context = {
registerComponent: (component) => {
@@ -284,40 +282,57 @@ export const usePlugins = () => {
});
};
- const toggleSavedPluginsStatus = (target_plugin_id) => {
- 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)
- ? showNotification_Success(t("plugin_notifications.is_enabled"))
- : showNotification_Success(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,
- });
- showNotification_Success(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) => {
@@ -373,6 +388,19 @@ export const usePlugins = () => {
});
}
+ const setSuccessSavedPluginsStatus = (plugins_status) => {
+ updateSavedPluginsStatus(plugins_status);
+ 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 {
@@ -387,6 +415,7 @@ export const usePlugins = () => {
currentSavedPluginsStatus,
updateSavedPluginsStatus,
+ setSuccessSavedPluginsStatus,
currentPluginsData,
updatePluginsData,
@@ -399,11 +428,15 @@ export const usePlugins = () => {
currentLoadedPlugins,
updateLoadedPlugins,
+ setSavedPluginEnabled,
toggleSavedPluginsStatus,
setTargetSavedPluginsStatus_Init,
setSavedPluginsStatus,
+
handlePendingPlugin,
+
+ setErrorPlugin,
};
};
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/logics/configs/transcription/useMicMaxWords.js b/src-ui/logics/configs/transcription/useMicMaxWords.js
deleted file mode 100644
index 7415d655..00000000
--- a/src-ui/logics/configs/transcription/useMicMaxWords.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_MicMaxWords } from "@store";
-import { useStdoutToPython } from "@logics/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 02601b0c..00000000
--- a/src-ui/logics/configs/transcription/useMicPhraseTimeout.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_MicPhraseTimeout } from "@store";
-import { useStdoutToPython } from "@logics/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 27798804..00000000
--- a/src-ui/logics/configs/transcription/useMicRecordTimeout.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_MicRecordTimeout } from "@store";
-import { useStdoutToPython } from "@logics/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 cca40b0a..00000000
--- a/src-ui/logics/configs/transcription/useMicWordFilterList.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_MicWordFilterList } from "@store";
-import { useStdoutToPython } from "@logics/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);
- };
-
- return {
- currentMicWordFilterList,
- getMicWordFilterList,
- updateMicWordFilterList,
- setMicWordFilterList,
- };
-};
\ 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 94ae24f6..00000000
--- a/src-ui/logics/configs/transcription/useSelectableWhisperComputeDeviceList.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import { useStore_SelectableWhisperComputeDeviceList } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
-
-export const useSelectableWhisperComputeDeviceList = () => {
- const { asyncStdoutToPython } = useStdoutToPython();
- const { currentSelectableWhisperComputeDeviceList, updateSelectableWhisperComputeDeviceList, pendingSelectableWhisperComputeDeviceList } = useStore_SelectableWhisperComputeDeviceList();
-
- const getSelectableWhisperComputeDeviceList = () => {
- pendingSelectableWhisperComputeDeviceList();
- asyncStdoutToPython("/get/data/transcription_compute_device_list");
- };
-
- return {
- currentSelectableWhisperComputeDeviceList,
- getSelectableWhisperComputeDeviceList,
- updateSelectableWhisperComputeDeviceList,
- };
-};
\ 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 43f0b6ab..00000000
--- a/src-ui/logics/configs/transcription/useSelectedTranscriptionEngine.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_SelectedTranscriptionEngine } from "@store";
-import { useStdoutToPython } from "@logics/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 f2d34af1..00000000
--- a/src-ui/logics/configs/transcription/useSelectedWhisperComputeDevice.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_SelectedWhisperComputeDevice } from "@store";
-import { useStdoutToPython } from "@logics/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 02993646..00000000
--- a/src-ui/logics/configs/transcription/useSelectedWhisperWeightType.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_SelectedWhisperWeightType } from "@store";
-import { useStdoutToPython } from "@logics/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 8678ceb2..00000000
--- a/src-ui/logics/configs/transcription/useSpeakerMaxWords.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_SpeakerMaxWords } from "@store";
-import { useStdoutToPython } from "@logics/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 af9e8fba..00000000
--- a/src-ui/logics/configs/transcription/useSpeakerPhraseTimeout.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_SpeakerPhraseTimeout } from "@store";
-import { useStdoutToPython } from "@logics/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 5d17754c..00000000
--- a/src-ui/logics/configs/transcription/useSpeakerRecordTimeout.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_SpeakerRecordTimeout } from "@store";
-import { useStdoutToPython } from "@logics/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..0c4b8b2b
--- /dev/null
+++ b/src-ui/logics/configs/transcription/useTranscription.js
@@ -0,0 +1,341 @@
+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";
+import { useNotificationStatus } from "@logics_common";
+
+export const useTranscription = () => {
+ const { asyncStdoutToPython } = useStdoutToPython();
+ const { showNotification_SaveSuccess } = useNotificationStatus();
+
+ // 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 setSuccessMicRecordTimeout = (value) => {
+ updateMicRecordTimeout(value);
+ showNotification_SaveSuccess();
+ };
+
+ 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 setSuccessMicPhraseTimeout = (value) => {
+ updateMicPhraseTimeout(value);
+ showNotification_SaveSuccess();
+ };
+
+ 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 setSuccessMicMaxWords = (value) => {
+ updateMicMaxWords(value);
+ showNotification_SaveSuccess();
+ };
+
+ 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 setSuccessMicWordFilterList = (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;
+ });
+ showNotification_SaveSuccess();
+ };
+
+ // 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 setSuccessSpeakerRecordTimeout = (value) => {
+ updateSpeakerRecordTimeout(value);
+ showNotification_SaveSuccess();
+ };
+
+ 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 setSuccessSpeakerPhraseTimeout = (value) => {
+ updateSpeakerPhraseTimeout(value);
+ showNotification_SaveSuccess();
+ };
+
+ 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);
+ };
+
+ const setSuccessSpeakerMaxWords = (value) => {
+ updateSpeakerMaxWords(value);
+ showNotification_SaveSuccess();
+ };
+
+ // 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);
+ };
+
+ const setSuccessSelectedTranscriptionEngine = (engine) => {
+ updateSelectedTranscriptionEngine(engine);
+ showNotification_SaveSuccess();
+ };
+
+ // 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);
+ };
+
+ const setSuccessSelectedWhisperWeightType = (wt) => {
+ updateSelectedWhisperWeightType(wt);
+ showNotification_SaveSuccess();
+ };
+
+ // 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);
+ };
+
+ 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,
+ 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,
+ updateDownloadedWhisperWeightTypeStatus,
+ updateDownloadProgressWhisperWeightTypeStatus,
+ pendingWhisperWeightType,
+ downloadedWhisperWeightType,
+ downloadWhisperWeight,
+
+ currentSelectedWhisperWeightType,
+ getSelectedWhisperWeightType,
+ updateSelectedWhisperWeightType,
+ setSelectedWhisperWeightType,
+ setSuccessSelectedWhisperWeightType,
+
+ currentSelectableWhisperComputeDeviceList,
+ getSelectableWhisperComputeDeviceList,
+ updateSelectableWhisperComputeDeviceList,
+ updateSelectableWhisperComputeDeviceList_FromBackend,
+
+ currentSelectedWhisperComputeDevice,
+ getSelectedWhisperComputeDevice,
+ updateSelectedWhisperComputeDevice,
+ setSelectedWhisperComputeDevice,
+ setSuccessSelectedWhisperComputeDevice,
+ };
+};
\ 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 482273d2..00000000
--- a/src-ui/logics/configs/transcription/useWhisperWeightTypeStatus.js
+++ /dev/null
@@ -1,60 +0,0 @@
-import { useStore_WhisperWeightTypeStatus } from "@store";
-import { useStdoutToPython } from "@logics/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 4f840765..00000000
--- a/src-ui/logics/configs/translation/useCTranslate2WeightTypeStatus.js
+++ /dev/null
@@ -1,60 +0,0 @@
-import { useStore_CTranslate2WeightTypeStatus } from "@store";
-import { useStdoutToPython } from "@logics/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 a568dfe9..00000000
--- a/src-ui/logics/configs/translation/useDeepLAuthKey.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import { useStore_DeepLAuthKey } from "@store";
-import { useStdoutToPython } from "@logics/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 savedDeepLAuthKey = (data) => {
- updateDeepLAuthKey(data);
- showNotification_Success(t("config_page.translation.deepl_auth_key.auth_key_success"));
- };
-
- return {
- currentDeepLAuthKey,
- getDeepLAuthKey,
- updateDeepLAuthKey,
- setDeepLAuthKey,
- deleteDeepLAuthKey,
-
- 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 e2ca89ca..00000000
--- a/src-ui/logics/configs/translation/useSelectableCTranslate2ComputeDeviceList.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import { useStore_SelectableCTranslate2ComputeDeviceList } from "@store";
-import { useStdoutToPython } from "@logics/useStdoutToPython";
-
-export const useSelectableCTranslate2ComputeDeviceList = () => {
- const { asyncStdoutToPython } = useStdoutToPython();
- const { currentSelectableCTranslate2ComputeDeviceList, updateSelectableCTranslate2ComputeDeviceList, pendingSelectableCTranslate2ComputeDeviceList } = useStore_SelectableCTranslate2ComputeDeviceList();
-
- const getSelectableCTranslate2ComputeDeviceList = () => {
- pendingSelectableCTranslate2ComputeDeviceList();
- asyncStdoutToPython("/get/data/translation_compute_device_list");
- };
-
- return {
- currentSelectableCTranslate2ComputeDeviceList,
- getSelectableCTranslate2ComputeDeviceList,
- updateSelectableCTranslate2ComputeDeviceList,
- };
-};
\ 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 37f6623d..00000000
--- a/src-ui/logics/configs/translation/useSelectedCTranslate2ComputeDevice.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_SelectedCTranslate2ComputeDevice } from "@store";
-import { useStdoutToPython } from "@logics/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 8641a2ac..00000000
--- a/src-ui/logics/configs/translation/useSelectedCTranslate2WeightType.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_SelectedCTranslate2WeightType } from "@store";
-import { useStdoutToPython } from "@logics/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..b282bf90
--- /dev/null
+++ b/src-ui/logics/configs/translation/useTranslation.js
@@ -0,0 +1,168 @@
+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_SaveSuccess } = 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 setSuccessSelectedCTranslate2WeightType = (selected_ctranslate2_weight_type) => {
+ updateSelectedCTranslate2WeightType(selected_ctranslate2_weight_type);
+ showNotification_SaveSuccess();
+ };
+
+
+ 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 setSuccessSelectedCTranslate2ComputeDevice = (selected_translation_compute_device) => {
+ updateSelectedCTranslate2ComputeDevice(selected_translation_compute_device);
+ showNotification_SaveSuccess();
+ };
+
+
+ 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 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 deleteSuccessDeepLAuthKey = () => {
+ updateDeepLAuthKey("");
+ };
+
+
+ return {
+ currentCTranslate2WeightTypeStatus,
+ updateCTranslate2WeightTypeStatus,
+ updateDownloadedCTranslate2WeightTypeStatus,
+ updateDownloadProgressCTranslate2WeightTypeStatus,
+ pendingCTranslate2WeightType,
+ downloadedCTranslate2WeightType,
+ downloadCTranslate2Weight,
+
+ currentSelectedCTranslate2WeightType,
+ getSelectedCTranslate2WeightType,
+ updateSelectedCTranslate2WeightType,
+ setSelectedCTranslate2WeightType,
+ setSuccessSelectedCTranslate2WeightType,
+
+ currentSelectableCTranslate2ComputeDeviceList,
+ getSelectableCTranslate2ComputeDeviceList,
+ updateSelectableCTranslate2ComputeDeviceList,
+ updateSelectableCTranslate2ComputeDeviceList_FromBackend,
+
+ currentSelectedCTranslate2ComputeDevice,
+ getSelectedCTranslate2ComputeDevice,
+ updateSelectedCTranslate2ComputeDevice,
+ setSelectedCTranslate2ComputeDevice,
+ setSuccessSelectedCTranslate2ComputeDevice,
+
+ currentDeepLAuthKey,
+ getDeepLAuthKey,
+ updateDeepLAuthKey,
+ setDeepLAuthKey,
+ deleteDeepLAuthKey,
+ deleteSuccessDeepLAuthKey,
+ setSuccessDeepLAuthKey,
+ };
+};
\ 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 0e1f8881..00000000
--- a/src-ui/logics/configs/vr/useIsEnabledOverlayLargeLog.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import { useStore_IsEnabledOverlayLargeLog } from "@store";
-import { useStdoutToPython } from "@logics/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 e51a34c3..00000000
--- a/src-ui/logics/configs/vr/useIsEnabledOverlaySmallLog.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import { useStore_IsEnabledOverlaySmallLog } from "@store";
-import { useStdoutToPython } from "@logics/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 548189e3..00000000
--- a/src-ui/logics/configs/vr/useOverlayLargeLogSettings.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_OverlayLargeLogSettings } from "@store";
-import { useStdoutToPython } from "@logics/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 895581ae..00000000
--- a/src-ui/logics/configs/vr/useOverlayShowOnlyTranslatedMessages.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import { useStore_OverlayShowOnlyTranslatedMessages } from "@store";
-import { useStdoutToPython } from "@logics/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 03b61393..00000000
--- a/src-ui/logics/configs/vr/useOverlaySmallLogSettings.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useStore_OverlaySmallLogSettings } from "@store";
-import { useStdoutToPython } from "@logics/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 268881ec..00000000
--- a/src-ui/logics/configs/vr/useSendTextToOverlay.js
+++ /dev/null
@@ -1,13 +0,0 @@
-import { useStdoutToPython } from "@logics/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..ee65c538
--- /dev/null
+++ b/src-ui/logics/configs/vr/useVr.js
@@ -0,0 +1,145 @@
+import {
+ useStore_IsEnabledOverlaySmallLog,
+ useStore_IsEnabledOverlayLargeLog,
+ useStore_OverlaySmallLogSettings,
+ useStore_OverlayLargeLogSettings,
+ 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();
+ 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 setSuccessIsEnabledOverlaySmallLog = (enabled) => {
+ updateIsEnabledOverlaySmallLog(enabled);
+ showNotification_SaveSuccess();
+ };
+
+ 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 setSuccessIsEnabledOverlayLargeLog = (enabled) => {
+ updateIsEnabledOverlayLargeLog(enabled);
+ showNotification_SaveSuccess();
+ };
+
+ 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 setSuccessOverlaySmallLogSettings = (settings) => {
+ updateOverlaySmallLogSettings(settings);
+ showNotification_SaveSuccess();
+ };
+
+ 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 setSuccessOverlayLargeLogSettings = (settings) => {
+ updateOverlayLargeLogSettings(settings);
+ showNotification_SaveSuccess();
+ };
+
+ 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 setSuccessOverlayShowOnlyTranslatedMessages = (enabled) => {
+ updateOverlayShowOnlyTranslatedMessages(enabled);
+ showNotification_SaveSuccess();
+ };
+
+ const sendTextToOverlay = (text) => {
+ asyncStdoutToPython("/run/send_text_overlay", text);
+ };
+
+ return {
+ currentIsEnabledOverlaySmallLog,
+ getIsEnabledOverlaySmallLog,
+ toggleIsEnabledOverlaySmallLog,
+ updateIsEnabledOverlaySmallLog,
+ setSuccessIsEnabledOverlaySmallLog,
+
+ currentIsEnabledOverlayLargeLog,
+ getIsEnabledOverlayLargeLog,
+ toggleIsEnabledOverlayLargeLog,
+ updateIsEnabledOverlayLargeLog,
+ setSuccessIsEnabledOverlayLargeLog,
+
+ currentOverlaySmallLogSettings,
+ getOverlaySmallLogSettings,
+ updateOverlaySmallLogSettings,
+ setOverlaySmallLogSettings,
+ setSuccessOverlaySmallLogSettings,
+
+ currentOverlayLargeLogSettings,
+ getOverlayLargeLogSettings,
+ updateOverlayLargeLogSettings,
+ setOverlayLargeLogSettings,
+ setSuccessOverlayLargeLogSettings,
+
+ currentOverlayShowOnlyTranslatedMessages,
+ getOverlayShowOnlyTranslatedMessages,
+ toggleOverlayShowOnlyTranslatedMessages,
+ updateOverlayShowOnlyTranslatedMessages,
+ setSuccessOverlayShowOnlyTranslatedMessages,
+
+ sendTextToOverlay,
+ };
+};
\ No newline at end of file
diff --git a/src-ui/logics/main/index.js b/src-ui/logics/main/index.js
index 7cd492d6..827e8cef 100644
--- a/src-ui/logics/main/index.js
+++ b/src-ui/logics/main/index.js
@@ -1,7 +1,5 @@
-export { useIsVisibleResendButton } from "./useIsVisibleResendButton";
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/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/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/main/useLanguageSettings.js b/src-ui/logics/main/useLanguageSettings.js
index 163f9f37..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 { useStdoutToPython } from "@logics/useStdoutToPython";
+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/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
deleted file mode 100644
index ef771d7f..00000000
--- a/src-ui/logics/main/useSelectableLanguageList.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import { useStore_SelectableLanguageList } from "@store";
-import { useStdoutToPython } from "@logics/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..d83054d3 100644
--- a/src-ui/logics/useReceiveRoutes.js
+++ b/src-ui/logics/useReceiveRoutes.js
@@ -1,572 +1,364 @@
-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: "/run/update_software", ns: null, hook_name: null, method_name: null },
+ { endpoint: "/run/update_cuda_software", ns: null, hook_name: null, method_name: null },
-import {
- useMainFunction,
- useSelectableLanguageList,
- useLanguageSettings,
- useIsMainPageCompactMode,
- useMessageInputBoxRatio,
-} from "@logics_main";
+ { 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 {
- 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";
+ { 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" },
+
+ // 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: "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" },
+
+ // 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: "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: "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: "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: "setSuccessSelectedMicDevice" },
+
+ { 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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "setSuccessSelectedFontFamily" },
+
+ { endpoint: "/get/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: "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: "setSuccessSelectedCTranslate2WeightType" },
+
+ { endpoint: "/get/data/selectable_ctranslate2_weight_type_dict", ns: configs, hook_name: "useTranslation", method_name: "updateDownloadedCTranslate2WeightTypeStatus" },
+
+ { 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: "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: "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: "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: "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: "setSuccessMicMaxWords" },
+
+ { 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: "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: "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: "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: "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: "setSuccessSelectedWhisperWeightType" },
+
+ { 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: "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: "useTranscription", method_name: "updateDownloadProgressWhisperWeightTypeStatus" },
+
+ { 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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "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: "setSuccessWebsocketPort" },
+
+
+ // 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 +372,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/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..7d2fac28 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,
@@ -15,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,
@@ -31,10 +29,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}`,
});
@@ -152,7 +147,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");
@@ -169,10 +163,9 @@ 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});
@@ -213,6 +206,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");
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
diff --git a/vite.config.js b/vite.config.js
index 092db909..b678f171 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -56,7 +56,11 @@ export default defineConfig(async () => {
resolve: {
alias: {
"@root": path.resolve(__dirname),
- "@test_data": path.resolve(__dirname, "./test_data.js"),
+
+ "@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"),
"@ui_configs": path.resolve(__dirname, "src-ui/ui_configs.js"),
"@scss_mixins": path.resolve(__dirname, "src-ui/common_css/mixins.scss"),