[Refactor] (Huge Refactoring) ReceiveRoutes: change the way define endpoints, hooks and methods.
Remove 'multi language translation enable/disable' related methods that is no longer in use from quite ago.
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
import { useSelectableLanguageList } from "@logics_main";
|
import { useLanguageSettings } from "@logics_main";
|
||||||
import styles from "./LanguageSelector.module.scss";
|
import styles from "./LanguageSelector.module.scss";
|
||||||
|
|
||||||
import { LanguageSelectorTopBar } from "./language_selector_top_bar/LanguageSelectorTopBar";
|
import { LanguageSelectorTopBar } from "./language_selector_top_bar/LanguageSelectorTopBar";
|
||||||
export const LanguageSelector = ({ title, onClickFunction }) => {
|
export const LanguageSelector = ({ title, onClickFunction }) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { currentSelectableLanguageList } = useSelectableLanguageList();
|
const { currentSelectableLanguageList } = useLanguageSettings();
|
||||||
|
|
||||||
const groupLanguagesByFirstLetter = (languages) => {
|
const groupLanguagesByFirstLetter = (languages) => {
|
||||||
return languages.reduce((acc, { language, country }) => {
|
return languages.reduce((acc, { language, country }) => {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { useLanguageSettings } from "@logics_main";
|
|||||||
export const LanguageSwapButton = () => {
|
export const LanguageSwapButton = () => {
|
||||||
const [isHovered, setIsHovered] = useState(false);
|
const [isHovered, setIsHovered] = useState(false);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { runLanguageSwap } = useLanguageSettings();
|
const { swapSelectedLanguages } = useLanguageSettings();
|
||||||
|
|
||||||
const label = isHovered
|
const label = isHovered
|
||||||
? t("main_page.swap_button_label")
|
? t("main_page.swap_button_label")
|
||||||
@@ -29,7 +29,7 @@ export const LanguageSwapButton = () => {
|
|||||||
className={styles.swap_button_wrapper}
|
className={styles.swap_button_wrapper}
|
||||||
onMouseEnter={handleMouseEnter}
|
onMouseEnter={handleMouseEnter}
|
||||||
onMouseLeave={handleMouseLeave}
|
onMouseLeave={handleMouseLeave}
|
||||||
onClick={runLanguageSwap}
|
onClick={swapSelectedLanguages}
|
||||||
>
|
>
|
||||||
<NarrowArrowDownSvg className={clsx(styles.narrow_arrow_down_svg, styles.reverse)} />
|
<NarrowArrowDownSvg className={clsx(styles.narrow_arrow_down_svg, styles.reverse)} />
|
||||||
<p className={labelClassName}>{label}</p>
|
<p className={labelClassName}>{label}</p>
|
||||||
|
|||||||
@@ -7,7 +7,10 @@ export const useHandleOscQuery = () => {
|
|||||||
const { showNotification_Warning } = useNotificationStatus();
|
const { showNotification_Warning } = useNotificationStatus();
|
||||||
const { updateEnableVrcMicMuteSync } = useEnableVrcMicMuteSync();
|
const { updateEnableVrcMicMuteSync } = useEnableVrcMicMuteSync();
|
||||||
|
|
||||||
const handleOscQuery = ({ is_osc_query_enabled, disabled_functions }) => {
|
const handleOscQuery = (payload) => {
|
||||||
|
const is_osc_query_enabled = payload.data;
|
||||||
|
const disabled_functions = payload.disabled_functions;
|
||||||
|
|
||||||
if (is_osc_query_enabled) {
|
if (is_osc_query_enabled) {
|
||||||
updateEnableVrcMicMuteSync(prev => ({
|
updateEnableVrcMicMuteSync(prev => ({
|
||||||
...prev.data,
|
...prev.data,
|
||||||
|
|||||||
@@ -1,10 +1,21 @@
|
|||||||
import { useStore_IsVrctAvailable } from "@store";
|
import { useStore_IsVrctAvailable } from "@store";
|
||||||
|
import { useNotificationStatus } from "@logics_common";
|
||||||
|
|
||||||
export const useIsVrctAvailable = () => {
|
export const useIsVrctAvailable = () => {
|
||||||
const { currentIsVrctAvailable, updateIsVrctAvailable } = useStore_IsVrctAvailable();
|
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 {
|
return {
|
||||||
currentIsVrctAvailable,
|
currentIsVrctAvailable,
|
||||||
updateIsVrctAvailable,
|
updateIsVrctAvailable,
|
||||||
|
|
||||||
|
handleAiModelsAvailability,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -42,6 +42,9 @@ export const useMessage = () => {
|
|||||||
messages: {message: message},
|
messages: {message: message},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
const addSystemMessageLog_FromBackend = (payload) => {
|
||||||
|
addSystemMessageLog(payload.message);
|
||||||
|
};
|
||||||
|
|
||||||
const updateSentMessageLogById = (payload) => {
|
const updateSentMessageLogById = (payload) => {
|
||||||
updateMessageLogs(updateItemById(payload.id, payload.translation));
|
updateMessageLogs(updateItemById(payload.id, payload.translation));
|
||||||
@@ -66,6 +69,7 @@ export const useMessage = () => {
|
|||||||
currentMessageLogs,
|
currentMessageLogs,
|
||||||
sendMessage,
|
sendMessage,
|
||||||
addSystemMessageLog,
|
addSystemMessageLog,
|
||||||
|
addSystemMessageLog_FromBackend,
|
||||||
updateSentMessageLogById,
|
updateSentMessageLogById,
|
||||||
addSentMessageLog,
|
addSentMessageLog,
|
||||||
addReceivedMessageLog,
|
addReceivedMessageLog,
|
||||||
|
|||||||
@@ -2,16 +2,26 @@ import { useStdoutToPython } from "@useStdoutToPython";
|
|||||||
|
|
||||||
export const useOpenFolder = () => {
|
export const useOpenFolder = () => {
|
||||||
const { asyncStdoutToPython } = useStdoutToPython();
|
const { asyncStdoutToPython } = useStdoutToPython();
|
||||||
|
|
||||||
const openFolder_MessageLogs = () => {
|
const openFolder_MessageLogs = () => {
|
||||||
asyncStdoutToPython("/run/open_filepath_logs");
|
asyncStdoutToPython("/run/open_filepath_logs");
|
||||||
};
|
};
|
||||||
|
const openedFolder_MessageLogs = () => {
|
||||||
|
console.log("Opened Directory, Message Logs");
|
||||||
|
};
|
||||||
|
|
||||||
const openFolder_ConfigFile = () => {
|
const openFolder_ConfigFile = () => {
|
||||||
asyncStdoutToPython("/run/open_filepath_config_file");
|
asyncStdoutToPython("/run/open_filepath_config_file");
|
||||||
};
|
};
|
||||||
|
const openedFolder_ConfigFile = () => {
|
||||||
|
console.log("Opened Directory, Config File");
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
openFolder_MessageLogs,
|
openFolder_MessageLogs,
|
||||||
openFolder_ConfigFile,
|
openFolder_ConfigFile,
|
||||||
|
|
||||||
|
openedFolder_MessageLogs,
|
||||||
|
openedFolder_ConfigFile,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -13,6 +13,13 @@ export const useSoftwareVersion = () => {
|
|||||||
asyncStdoutToPython("/get/data/version");
|
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) => {
|
const isPluginCompatible = (main_version, lower_version, upper_version) => {
|
||||||
// lower_version 以上かつ upper_version 以下なら互換性ありと判定
|
// lower_version 以上かつ upper_version 以下なら互換性ありと判定
|
||||||
return semver.gte(main_version, lower_version) && semver.lte(main_version, upper_version);
|
return semver.gte(main_version, lower_version) && semver.lte(main_version, upper_version);
|
||||||
@@ -32,6 +39,7 @@ export const useSoftwareVersion = () => {
|
|||||||
getSoftwareVersion,
|
getSoftwareVersion,
|
||||||
updateSoftwareVersion,
|
updateSoftwareVersion,
|
||||||
|
|
||||||
|
updateSoftwareVersionInfo,
|
||||||
currentLatestSoftwareVersionInfo,
|
currentLatestSoftwareVersionInfo,
|
||||||
updateLatestSoftwareVersionInfo,
|
updateLatestSoftwareVersionInfo,
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useStore_MicDeviceList } from "@store";
|
import { useStore_MicDeviceList } from "@store";
|
||||||
import { useStdoutToPython } from "@useStdoutToPython";
|
import { useStdoutToPython } from "@useStdoutToPython";
|
||||||
|
import { arrayToObject } from "@utils";
|
||||||
|
|
||||||
export const useMicDeviceList = () => {
|
export const useMicDeviceList = () => {
|
||||||
const { asyncStdoutToPython } = useStdoutToPython();
|
const { asyncStdoutToPython } = useStdoutToPython();
|
||||||
@@ -10,9 +11,17 @@ export const useMicDeviceList = () => {
|
|||||||
asyncStdoutToPython("/get/data/mic_device_list");
|
asyncStdoutToPython("/get/data/mic_device_list");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const updateMicDeviceList_FromBackend = (payload) => {
|
||||||
|
updateMicDeviceList(arrayToObject(payload));
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentMicDeviceList,
|
currentMicDeviceList,
|
||||||
getMicDeviceList,
|
getMicDeviceList,
|
||||||
updateMicDeviceList,
|
updateMicDeviceList,
|
||||||
|
|
||||||
|
updateMicDeviceList_FromBackend,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useStore_MicHostList } from "@store";
|
import { useStore_MicHostList } from "@store";
|
||||||
import { useStdoutToPython } from "@useStdoutToPython";
|
import { useStdoutToPython } from "@useStdoutToPython";
|
||||||
|
import { arrayToObject } from "@utils";
|
||||||
|
|
||||||
export const useMicHostList = () => {
|
export const useMicHostList = () => {
|
||||||
const { asyncStdoutToPython } = useStdoutToPython();
|
const { asyncStdoutToPython } = useStdoutToPython();
|
||||||
@@ -10,9 +11,15 @@ export const useMicHostList = () => {
|
|||||||
asyncStdoutToPython("/get/data/mic_host_list");
|
asyncStdoutToPython("/get/data/mic_host_list");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updateMicHostList_FromBackend = (payload) => {
|
||||||
|
updateMicHostList(arrayToObject(payload));
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentMicHostList,
|
currentMicHostList,
|
||||||
getMicHostList,
|
getMicHostList,
|
||||||
updateMicHostList,
|
updateMicHostList,
|
||||||
|
|
||||||
|
updateMicHostList_FromBackend,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
import { useStore_SelectedMicHost } from "@store";
|
import { useStore_SelectedMicHost } from "@store";
|
||||||
import { useStdoutToPython } from "@useStdoutToPython";
|
import { useStdoutToPython } from "@useStdoutToPython";
|
||||||
|
import { useSelectedMicDevice } from "@logics_configs";
|
||||||
|
|
||||||
export const useSelectedMicHost = () => {
|
export const useSelectedMicHost = () => {
|
||||||
const { asyncStdoutToPython } = useStdoutToPython();
|
const { asyncStdoutToPython } = useStdoutToPython();
|
||||||
const { currentSelectedMicHost, updateSelectedMicHost, pendingSelectedMicHost } = useStore_SelectedMicHost();
|
const { currentSelectedMicHost, updateSelectedMicHost, pendingSelectedMicHost } = useStore_SelectedMicHost();
|
||||||
|
|
||||||
|
const { updateSelectedMicDevice } = useSelectedMicDevice();
|
||||||
|
|
||||||
const getSelectedMicHost = () => {
|
const getSelectedMicHost = () => {
|
||||||
pendingSelectedMicHost();
|
pendingSelectedMicHost();
|
||||||
asyncStdoutToPython("/get/data/selected_mic_host");
|
asyncStdoutToPython("/get/data/selected_mic_host");
|
||||||
@@ -15,10 +18,20 @@ export const useSelectedMicHost = () => {
|
|||||||
asyncStdoutToPython("/set/data/selected_mic_host", selected_mic_host);
|
asyncStdoutToPython("/set/data/selected_mic_host", selected_mic_host);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Need refactoring (Duplicated, Host, Device)
|
||||||
|
const updateSelectedMicHostAndDevice = (payload) => {
|
||||||
|
updateSelectedMicHost(payload.host);
|
||||||
|
updateSelectedMicDevice(payload.device);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentSelectedMicHost,
|
currentSelectedMicHost,
|
||||||
getSelectedMicHost,
|
getSelectedMicHost,
|
||||||
updateSelectedMicHost,
|
updateSelectedMicHost,
|
||||||
setSelectedMicHost,
|
setSelectedMicHost,
|
||||||
|
|
||||||
|
updateSelectedMicHostAndDevice,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useStore_SpeakerDeviceList } from "@store";
|
import { useStore_SpeakerDeviceList } from "@store";
|
||||||
import { useStdoutToPython } from "@useStdoutToPython";
|
import { useStdoutToPython } from "@useStdoutToPython";
|
||||||
|
import { arrayToObject } from "@utils";
|
||||||
|
|
||||||
export const useSpeakerDeviceList = () => {
|
export const useSpeakerDeviceList = () => {
|
||||||
const { asyncStdoutToPython } = useStdoutToPython();
|
const { asyncStdoutToPython } = useStdoutToPython();
|
||||||
@@ -10,9 +11,16 @@ export const useSpeakerDeviceList = () => {
|
|||||||
asyncStdoutToPython("/get/data/speaker_device_list");
|
asyncStdoutToPython("/get/data/speaker_device_list");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updateSpeakerDeviceList_FromBackend = (payload) => {
|
||||||
|
updateSpeakerDeviceList(arrayToObject(payload));
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentSpeakerDeviceList,
|
currentSpeakerDeviceList,
|
||||||
getSpeakerDeviceList,
|
getSpeakerDeviceList,
|
||||||
updateSpeakerDeviceList,
|
updateSpeakerDeviceList,
|
||||||
|
|
||||||
|
updateSpeakerDeviceList_FromBackend,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -19,10 +19,18 @@ export const useEnableVrcMicMuteSync = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updateEnableVrcMicMuteSync_FromBackend = (payload) => {
|
||||||
|
updateEnableVrcMicMuteSync((old_value) => {
|
||||||
|
return {...old_value.data, is_enabled: payload};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentEnableVrcMicMuteSync,
|
currentEnableVrcMicMuteSync,
|
||||||
getEnableVrcMicMuteSync,
|
getEnableVrcMicMuteSync,
|
||||||
toggleEnableVrcMicMuteSync,
|
toggleEnableVrcMicMuteSync,
|
||||||
updateEnableVrcMicMuteSync,
|
updateEnableVrcMicMuteSync,
|
||||||
|
|
||||||
|
updateEnableVrcMicMuteSync_FromBackend,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -15,10 +15,27 @@ export const useMicWordFilterList = () => {
|
|||||||
asyncStdoutToPython("/set/data/mic_word_filter", selected_mic_word_filter);
|
asyncStdoutToPython("/set/data/mic_word_filter", selected_mic_word_filter);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updateMicWordFilterList_FromBackend = (payload) => {
|
||||||
|
updateMicWordFilterList((prev_list) => {
|
||||||
|
const updated_list = [...prev_list.data];
|
||||||
|
for (const value of payload) {
|
||||||
|
const existing_item = updated_list.find(item => item.value === value);
|
||||||
|
if (existing_item) {
|
||||||
|
existing_item.is_redoable = false;
|
||||||
|
} else {
|
||||||
|
updated_list.push({ value, is_redoable: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return updated_list;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentMicWordFilterList,
|
currentMicWordFilterList,
|
||||||
getMicWordFilterList,
|
getMicWordFilterList,
|
||||||
updateMicWordFilterList,
|
updateMicWordFilterList,
|
||||||
setMicWordFilterList,
|
setMicWordFilterList,
|
||||||
|
|
||||||
|
updateMicWordFilterList_FromBackend,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useStore_SelectableWhisperComputeDeviceList } from "@store";
|
import { useStore_SelectableWhisperComputeDeviceList } from "@store";
|
||||||
import { useStdoutToPython } from "@useStdoutToPython";
|
import { useStdoutToPython } from "@useStdoutToPython";
|
||||||
|
import { transformToIndexedArray } from "@utils";
|
||||||
|
|
||||||
export const useSelectableWhisperComputeDeviceList = () => {
|
export const useSelectableWhisperComputeDeviceList = () => {
|
||||||
const { asyncStdoutToPython } = useStdoutToPython();
|
const { asyncStdoutToPython } = useStdoutToPython();
|
||||||
@@ -10,9 +11,15 @@ export const useSelectableWhisperComputeDeviceList = () => {
|
|||||||
asyncStdoutToPython("/get/data/transcription_compute_device_list");
|
asyncStdoutToPython("/get/data/transcription_compute_device_list");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updateSelectableWhisperComputeDeviceList_FromBackend = (payload) => {
|
||||||
|
updateSelectableWhisperComputeDeviceList(transformToIndexedArray(payload));
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentSelectableWhisperComputeDeviceList,
|
currentSelectableWhisperComputeDeviceList,
|
||||||
getSelectableWhisperComputeDeviceList,
|
getSelectableWhisperComputeDeviceList,
|
||||||
updateSelectableWhisperComputeDeviceList,
|
updateSelectableWhisperComputeDeviceList,
|
||||||
|
|
||||||
|
updateSelectableWhisperComputeDeviceList_FromBackend,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -23,6 +23,9 @@ export const useDeepLAuthKey = () => {
|
|||||||
pendingDeepLAuthKey();
|
pendingDeepLAuthKey();
|
||||||
asyncStdoutToPython("/delete/data/deepl_auth_key");
|
asyncStdoutToPython("/delete/data/deepl_auth_key");
|
||||||
};
|
};
|
||||||
|
const deletedDeepLAuthKey = () => {
|
||||||
|
updateDeepLAuthKey("");
|
||||||
|
};
|
||||||
|
|
||||||
const savedDeepLAuthKey = (data) => {
|
const savedDeepLAuthKey = (data) => {
|
||||||
updateDeepLAuthKey(data);
|
updateDeepLAuthKey(data);
|
||||||
@@ -36,6 +39,7 @@ export const useDeepLAuthKey = () => {
|
|||||||
setDeepLAuthKey,
|
setDeepLAuthKey,
|
||||||
deleteDeepLAuthKey,
|
deleteDeepLAuthKey,
|
||||||
|
|
||||||
|
deletedDeepLAuthKey,
|
||||||
savedDeepLAuthKey,
|
savedDeepLAuthKey,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useStore_SelectableCTranslate2ComputeDeviceList } from "@store";
|
import { useStore_SelectableCTranslate2ComputeDeviceList } from "@store";
|
||||||
import { useStdoutToPython } from "@useStdoutToPython";
|
import { useStdoutToPython } from "@useStdoutToPython";
|
||||||
|
import { transformToIndexedArray } from "@utils";
|
||||||
|
|
||||||
export const useSelectableCTranslate2ComputeDeviceList = () => {
|
export const useSelectableCTranslate2ComputeDeviceList = () => {
|
||||||
const { asyncStdoutToPython } = useStdoutToPython();
|
const { asyncStdoutToPython } = useStdoutToPython();
|
||||||
@@ -10,9 +11,15 @@ export const useSelectableCTranslate2ComputeDeviceList = () => {
|
|||||||
asyncStdoutToPython("/get/data/translation_compute_device_list");
|
asyncStdoutToPython("/get/data/translation_compute_device_list");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updateSelectableCTranslate2ComputeDeviceList_FromBackend = (payload) => {
|
||||||
|
updateSelectableCTranslate2ComputeDeviceList(transformToIndexedArray(payload));
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentSelectableCTranslate2ComputeDeviceList,
|
currentSelectableCTranslate2ComputeDeviceList,
|
||||||
getSelectableCTranslate2ComputeDeviceList,
|
getSelectableCTranslate2ComputeDeviceList,
|
||||||
updateSelectableCTranslate2ComputeDeviceList,
|
updateSelectableCTranslate2ComputeDeviceList,
|
||||||
|
|
||||||
|
updateSelectableCTranslate2ComputeDeviceList_FromBackend,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -4,4 +4,3 @@ export { useLanguageSettings } from "./useLanguageSettings";
|
|||||||
export { useMainFunction } from "./useMainFunction";
|
export { useMainFunction } from "./useMainFunction";
|
||||||
export { useMessageLogScroll } from "./useMessageLogScroll";
|
export { useMessageLogScroll } from "./useMessageLogScroll";
|
||||||
export { useMessageInputBoxRatio } from "./useMessageInputBoxRatio";
|
export { useMessageInputBoxRatio } from "./useMessageInputBoxRatio";
|
||||||
export { useSelectableLanguageList } from "./useSelectableLanguageList";
|
|
||||||
@@ -1,13 +1,10 @@
|
|||||||
import { useStore_SelectedPresetTabNumber, useStore_EnableMultiTranslation, useStore_SelectedYourLanguages, useStore_SelectedTargetLanguages, useStore_TranslationEngines, useStore_SelectedTranslationEngines } from "@store";
|
import { useStore_SelectedPresetTabNumber, useStore_SelectedYourLanguages, useStore_SelectedTargetLanguages, useStore_TranslationEngines, useStore_SelectedTranslationEngines, useStore_SelectableLanguageList } from "@store";
|
||||||
import { useStdoutToPython } from "@useStdoutToPython";
|
import { useStdoutToPython } from "@useStdoutToPython";
|
||||||
|
import { translator_status } from "@ui_configs";
|
||||||
|
|
||||||
export const useLanguageSettings = () => {
|
export const useLanguageSettings = () => {
|
||||||
const { asyncStdoutToPython } = useStdoutToPython();
|
const { asyncStdoutToPython } = useStdoutToPython();
|
||||||
const {
|
|
||||||
currentEnableMultiTranslation,
|
|
||||||
updateEnableMultiTranslation,
|
|
||||||
pendingEnableMultiTranslation,
|
|
||||||
} = useStore_EnableMultiTranslation();
|
|
||||||
const {
|
const {
|
||||||
currentSelectedYourLanguages,
|
currentSelectedYourLanguages,
|
||||||
updateSelectedYourLanguages,
|
updateSelectedYourLanguages,
|
||||||
@@ -34,10 +31,11 @@ export const useLanguageSettings = () => {
|
|||||||
pendingSelectedTranslationEngines,
|
pendingSelectedTranslationEngines,
|
||||||
} = useStore_SelectedTranslationEngines();
|
} = useStore_SelectedTranslationEngines();
|
||||||
|
|
||||||
const getEnableMultiTranslation = () => {
|
const {
|
||||||
pendingEnableMultiTranslation();
|
currentSelectableLanguageList,
|
||||||
asyncStdoutToPython("/get/data/multi_language_translation");
|
updateSelectableLanguageList,
|
||||||
};
|
} = useStore_SelectableLanguageList();
|
||||||
|
|
||||||
|
|
||||||
const getSelectedPresetTabNumber = () => {
|
const getSelectedPresetTabNumber = () => {
|
||||||
pendingSelectedPresetTabNumber();
|
pendingSelectedPresetTabNumber();
|
||||||
@@ -112,6 +110,16 @@ export const useLanguageSettings = () => {
|
|||||||
asyncStdoutToPython("/get/data/translation_engines");
|
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 = () => {
|
const getSelectedTranslationEngines = () => {
|
||||||
pendingSelectedTranslationEngines();
|
pendingSelectedTranslationEngines();
|
||||||
asyncStdoutToPython("/get/data/selected_translation_engines");
|
asyncStdoutToPython("/get/data/selected_translation_engines");
|
||||||
@@ -124,12 +132,22 @@ export const useLanguageSettings = () => {
|
|||||||
asyncStdoutToPython("/set/data/selected_translation_engines", send_obj);
|
asyncStdoutToPython("/set/data/selected_translation_engines", send_obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
const runLanguageSwap = () => {
|
const swapSelectedLanguages = () => {
|
||||||
pendingSelectedYourLanguages();
|
pendingSelectedYourLanguages();
|
||||||
pendingSelectedTargetLanguages();
|
pendingSelectedTargetLanguages();
|
||||||
asyncStdoutToPython("/run/swap_your_language_and_target_language");
|
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 {
|
return {
|
||||||
currentSelectedPresetTabNumber,
|
currentSelectedPresetTabNumber,
|
||||||
@@ -137,11 +155,6 @@ export const useLanguageSettings = () => {
|
|||||||
updateSelectedPresetTabNumber,
|
updateSelectedPresetTabNumber,
|
||||||
setSelectedPresetTabNumber,
|
setSelectedPresetTabNumber,
|
||||||
|
|
||||||
currentEnableMultiTranslation,
|
|
||||||
getEnableMultiTranslation,
|
|
||||||
updateEnableMultiTranslation,
|
|
||||||
// setEnableMultiTranslation,
|
|
||||||
|
|
||||||
currentSelectedYourLanguages,
|
currentSelectedYourLanguages,
|
||||||
getSelectedYourLanguages,
|
getSelectedYourLanguages,
|
||||||
updateSelectedYourLanguages,
|
updateSelectedYourLanguages,
|
||||||
@@ -158,12 +171,18 @@ export const useLanguageSettings = () => {
|
|||||||
currentTranslationEngines,
|
currentTranslationEngines,
|
||||||
getTranslationEngines,
|
getTranslationEngines,
|
||||||
updateTranslationEngines,
|
updateTranslationEngines,
|
||||||
|
updateTranslatorAvailability,
|
||||||
|
|
||||||
currentSelectedTranslationEngines,
|
currentSelectedTranslationEngines,
|
||||||
getSelectedTranslationEngines,
|
getSelectedTranslationEngines,
|
||||||
updateSelectedTranslationEngines,
|
updateSelectedTranslationEngines,
|
||||||
setSelectedTranslationEngines,
|
setSelectedTranslationEngines,
|
||||||
|
|
||||||
runLanguageSwap,
|
swapSelectedLanguages,
|
||||||
|
updateBothSelectedLanguages,
|
||||||
|
|
||||||
|
currentSelectableLanguageList,
|
||||||
|
getSelectableLanguageList,
|
||||||
|
updateSelectableLanguageList,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
import { useStore_SelectableLanguageList } from "@store";
|
|
||||||
import { useStdoutToPython } from "@useStdoutToPython";
|
|
||||||
|
|
||||||
export const useSelectableLanguageList = () => {
|
|
||||||
const { asyncStdoutToPython } = useStdoutToPython();
|
|
||||||
const { currentSelectableLanguageList, updateSelectableLanguageList } = useStore_SelectableLanguageList();
|
|
||||||
|
|
||||||
const getSelectableLanguageList = () => {
|
|
||||||
asyncStdoutToPython("/get/data/selectable_language_list");
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
|
||||||
currentSelectableLanguageList,
|
|
||||||
getSelectableLanguageList,
|
|
||||||
updateSelectableLanguageList,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
@@ -1,572 +1,356 @@
|
|||||||
import { translator_status } from "@ui_configs";
|
import * as common from "@logics_common";
|
||||||
import { arrayToObject } from "@utils";
|
import * as main from "@logics_main";
|
||||||
|
import * as configs from "@logics_configs";
|
||||||
import { _useBackendErrorHandling } from "./_useBackendErrorHandling";
|
import { _useBackendErrorHandling } from "./_useBackendErrorHandling";
|
||||||
|
|
||||||
import {
|
export const ROUTE_META_LIST = [
|
||||||
useIsVrctAvailable,
|
// Common
|
||||||
useNotificationStatus,
|
{ endpoint: "/run/feed_watchdog", ns: null, hook_name: null, method_name: null },
|
||||||
useHandleNetworkConnection,
|
{ endpoint: "/run/initialization_progress", ns: common, hook_name: "useInitProgress", method_name: "updateInitProgress" },
|
||||||
useHandleOscQuery,
|
{ 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,
|
{ endpoint: "/get/data/main_window_geometry", ns: common, hook_name: "useWindow", method_name: "restoreWindowGeometry" },
|
||||||
useComputeMode,
|
{ endpoint: "/set/data/main_window_geometry", ns: null, hook_name: null, method_name: null },
|
||||||
useInitProgress,
|
|
||||||
useIsBackendReady,
|
|
||||||
useWindow,
|
|
||||||
useMessage,
|
|
||||||
useVolume,
|
|
||||||
} from "@logics_common";
|
|
||||||
|
|
||||||
import {
|
{ endpoint: "/run/open_filepath_logs", ns: common, hook_name: "useOpenFolder", method_name: "openedFolder_MessageLogs" },
|
||||||
useMainFunction,
|
{ endpoint: "/run/open_filepath_config_file", ns: common, hook_name: "useOpenFolder", method_name: "openedFolder_ConfigFile" },
|
||||||
useSelectableLanguageList,
|
|
||||||
useLanguageSettings,
|
|
||||||
useIsMainPageCompactMode,
|
|
||||||
useMessageInputBoxRatio,
|
|
||||||
} from "@logics_main";
|
|
||||||
|
|
||||||
import {
|
// Software Version
|
||||||
useEnableAutoMicSelect,
|
{ endpoint: "/get/data/version", ns: common, hook_name: "useSoftwareVersion", method_name: "updateSoftwareVersion" },
|
||||||
useEnableAutoSpeakerSelect,
|
// Latest Software Version Info
|
||||||
useMicHostList,
|
{ endpoint: "/run/software_update_info", ns: common, hook_name: "useSoftwareVersion", method_name: "updateLatestSoftwareVersionInfo" },
|
||||||
useSelectedMicHost,
|
|
||||||
useMicDeviceList,
|
{ endpoint: "/run/connected_network", ns: common, hook_name: "useHandleNetworkConnection", method_name: "handleNetworkConnection" },
|
||||||
useSelectedMicDevice,
|
{ endpoint: "/run/enable_osc_query", ns: common, hook_name: "useHandleOscQuery", method_name: "handleOscQuery" },
|
||||||
useSpeakerDeviceList,
|
|
||||||
useSelectedSpeakerDevice,
|
// Message (By typing)
|
||||||
useMicThreshold,
|
{ endpoint: "/run/send_message_box", ns: common, hook_name: "useMessage", method_name: "updateSentMessageLogById" },
|
||||||
useSpeakerThreshold,
|
{ endpoint: "/run/typing_message_box", ns: null, hook_name: null, method_name: null },
|
||||||
useEnableAutoClearMessageInputBox,
|
{ endpoint: "/run/stop_typing_message_box", ns: null, hook_name: null, method_name: null },
|
||||||
useEnableSendOnlyTranslatedMessages,
|
// Message Transcription
|
||||||
useEnableAutoExportMessageLogs,
|
{ endpoint: "/run/transcription_send_mic_message", ns: common, hook_name: "useMessage", method_name: "addSentMessageLog" },
|
||||||
useEnableVrcMicMuteSync,
|
{ endpoint: "/run/transcription_receive_speaker_message", ns: common, hook_name: "useMessage", method_name: "addReceivedMessageLog" },
|
||||||
useEnableSendMessageToVrc,
|
|
||||||
useEnableSendReceivedMessageToVrc,
|
// System Messages
|
||||||
useSelectedFontFamily,
|
{ endpoint: "/run/word_filter", ns: common, hook_name: "useMessage", method_name: "addSystemMessageLog_FromBackend" },
|
||||||
useUiLanguage,
|
|
||||||
useUiScaling,
|
|
||||||
useMessageLogUiScaling,
|
// Volume
|
||||||
useSendMessageButtonType,
|
{ endpoint: "/run/check_mic_volume", ns: common, hook_name: "useVolume", method_name: "updateVolumeVariable_Mic" },
|
||||||
useTransparency,
|
{ endpoint: "/run/check_speaker_volume", ns: common, hook_name: "useVolume", method_name: "updateVolumeVariable_Speaker" },
|
||||||
useMicRecordTimeout,
|
{ endpoint: "/set/enable/check_mic_threshold", ns: common, hook_name: "useVolume", method_name: "updateMicThresholdCheckStatus" },
|
||||||
useMicPhraseTimeout,
|
{ endpoint: "/set/disable/check_mic_threshold", ns: common, hook_name: "useVolume", method_name: "updateMicThresholdCheckStatus" },
|
||||||
useMicMaxWords,
|
{ endpoint: "/set/enable/check_speaker_threshold", ns: common, hook_name: "useVolume", method_name: "updateSpeakerThresholdCheckStatus" },
|
||||||
useMicWordFilterList,
|
{ endpoint: "/set/disable/check_speaker_threshold", ns: common, hook_name: "useVolume", method_name: "updateSpeakerThresholdCheckStatus" },
|
||||||
useSpeakerRecordTimeout,
|
|
||||||
useSpeakerPhraseTimeout,
|
|
||||||
useSpeakerMaxWords,
|
|
||||||
useDeepLAuthKey,
|
|
||||||
useCTranslate2WeightTypeStatus,
|
// Main Page
|
||||||
useSelectableCTranslate2ComputeDeviceList,
|
// Page Controls
|
||||||
useSelectedCTranslate2ComputeDevice,
|
{ endpoint: "/get/data/main_window_sidebar_compact_mode", ns: main, hook_name: "useIsMainPageCompactMode", method_name: "updateIsMainPageCompactMode" },
|
||||||
useSelectableWhisperComputeDeviceList,
|
{ endpoint: "/set/enable/main_window_sidebar_compact_mode", ns: main, hook_name: "useIsMainPageCompactMode", method_name: "updateIsMainPageCompactMode" },
|
||||||
useSelectedWhisperComputeDevice,
|
{ endpoint: "/set/disable/main_window_sidebar_compact_mode", ns: main, hook_name: "useIsMainPageCompactMode", method_name: "updateIsMainPageCompactMode" },
|
||||||
useSelectedCTranslate2WeightType,
|
|
||||||
useSelectedTranscriptionEngine,
|
// Main Functions
|
||||||
useSelectedWhisperWeightType,
|
{ endpoint: "/set/enable/translation", ns: main, hook_name: "useMainFunction", method_name: "updateTranslationStatus" },
|
||||||
useWhisperWeightTypeStatus,
|
{ endpoint: "/set/disable/translation", ns: main, hook_name: "useMainFunction", method_name: "updateTranslationStatus" },
|
||||||
useIsEnabledOverlaySmallLog,
|
{ endpoint: "/set/enable/transcription_send", ns: main, hook_name: "useMainFunction", method_name: "updateTranscriptionSendStatus" },
|
||||||
useOverlaySmallLogSettings,
|
{ endpoint: "/set/disable/transcription_send", ns: main, hook_name: "useMainFunction", method_name: "updateTranscriptionSendStatus" },
|
||||||
useIsEnabledOverlayLargeLog,
|
{ endpoint: "/set/enable/transcription_receive", ns: main, hook_name: "useMainFunction", method_name: "updateTranscriptionReceiveStatus" },
|
||||||
useOverlayLargeLogSettings,
|
{ endpoint: "/set/disable/transcription_receive", ns: main, hook_name: "useMainFunction", method_name: "updateTranscriptionReceiveStatus" },
|
||||||
useOverlayShowOnlyTranslatedMessages,
|
|
||||||
useEnableNotificationVrcSfx,
|
// Language Settings
|
||||||
useHotkeys,
|
{ endpoint: "/get/data/selected_tab_no", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedPresetTabNumber" },
|
||||||
usePlugins,
|
{ endpoint: "/set/data/selected_tab_no", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedPresetTabNumber" },
|
||||||
useOscIpAddress,
|
|
||||||
useOscPort,
|
{ endpoint: "/get/data/selected_your_languages", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedYourLanguages" },
|
||||||
useWebsocket,
|
{ endpoint: "/set/data/selected_your_languages", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedYourLanguages" },
|
||||||
} from "@logics_configs";
|
{ endpoint: "/get/data/selected_target_languages", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedTargetLanguages" },
|
||||||
|
{ endpoint: "/set/data/selected_target_languages", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedTargetLanguages" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/translation_engines", ns: main, hook_name: "useLanguageSettings", method_name: "updateTranslatorAvailability" },
|
||||||
|
{ endpoint: "/run/translation_engines", ns: main, hook_name: "useLanguageSettings", method_name: "updateTranslatorAvailability" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/selected_translation_engines", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedTranslationEngines" },
|
||||||
|
{ endpoint: "/set/data/selected_translation_engines", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedTranslationEngines" },
|
||||||
|
{ endpoint: "/run/selected_translation_engines", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectedTranslationEngines" },
|
||||||
|
|
||||||
|
{ endpoint: "/run/swap_your_language_and_target_language", ns: main, hook_name: "useLanguageSettings", method_name: "updateBothSelectedLanguages" },
|
||||||
|
|
||||||
|
// Language Selector
|
||||||
|
{ endpoint: "/get/data/selectable_language_list", ns: main, hook_name: "useLanguageSettings", method_name: "updateSelectableLanguageList" },
|
||||||
|
|
||||||
|
|
||||||
|
// Message Input Box
|
||||||
|
{ endpoint: "/get/data/message_box_ratio", ns: main, hook_name: "useMessageInputBoxRatio", method_name: "updateMessageInputBoxRatio" },
|
||||||
|
{ endpoint: "/set/data/message_box_ratio", ns: main, hook_name: "useMessageInputBoxRatio", method_name: "updateMessageInputBoxRatio" },
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Config Page
|
||||||
|
// Device
|
||||||
|
{ endpoint: "/get/data/auto_mic_select", ns: configs, hook_name: "useEnableAutoMicSelect", method_name: "updateEnableAutoMicSelect" },
|
||||||
|
{ endpoint: "/set/enable/auto_mic_select", ns: configs, hook_name: "useEnableAutoMicSelect", method_name: "updateEnableAutoMicSelect" },
|
||||||
|
{ endpoint: "/set/disable/auto_mic_select", ns: configs, hook_name: "useEnableAutoMicSelect", method_name: "updateEnableAutoMicSelect" },
|
||||||
|
{ endpoint: "/get/data/auto_speaker_select", ns: configs, hook_name: "useEnableAutoSpeakerSelect", method_name: "updateEnableAutoSpeakerSelect" },
|
||||||
|
{ endpoint: "/set/enable/auto_speaker_select", ns: configs, hook_name: "useEnableAutoSpeakerSelect", method_name: "updateEnableAutoSpeakerSelect" },
|
||||||
|
{ endpoint: "/set/disable/auto_speaker_select", ns: configs, hook_name: "useEnableAutoSpeakerSelect", method_name: "updateEnableAutoSpeakerSelect" },
|
||||||
|
|
||||||
|
// Device (Mic)
|
||||||
|
{ endpoint: "/get/data/mic_host_list", ns: configs, hook_name: "useMicHostList", method_name: "updateMicHostList_FromBackend" },
|
||||||
|
{ endpoint: "/run/mic_host_list", ns: configs, hook_name: "useMicHostList", method_name: "updateMicHostList_FromBackend" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/selected_mic_host", ns: configs, hook_name: "useSelectedMicHost", method_name: "updateSelectedMicHost" },
|
||||||
|
{ endpoint: "/set/data/selected_mic_host", ns: configs, hook_name: "useSelectedMicHost", method_name: "updateSelectedMicHostAndDevice" }, // Need refactoring (Duplicated, Host, Device)
|
||||||
|
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/mic_device_list", ns: configs, hook_name: "useMicDeviceList", method_name: "updateMicDeviceList_FromBackend" },
|
||||||
|
{ endpoint: "/run/mic_device_list", ns: configs, hook_name: "useMicDeviceList", method_name: "updateMicDeviceList_FromBackend" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/selected_mic_device", ns: configs, hook_name: "useSelectedMicDevice", method_name: "updateSelectedMicDevice" },
|
||||||
|
{ endpoint: "/set/data/selected_mic_device", ns: configs, hook_name: "useSelectedMicDevice", method_name: "updateSelectedMicDevice" },
|
||||||
|
|
||||||
|
{ endpoint: "/run/selected_mic_device", ns: configs, hook_name: "useSelectedMicHost", method_name: "updateSelectedMicHostAndDevice" }, // Need refactoring (Duplicated, Host, Device)
|
||||||
|
|
||||||
|
// Device (Speaker)
|
||||||
|
{ endpoint: "/get/data/speaker_device_list", ns: configs, hook_name: "useSpeakerDeviceList", method_name: "updateSpeakerDeviceList_FromBackend" },
|
||||||
|
{ endpoint: "/run/speaker_device_list", ns: configs, hook_name: "useSpeakerDeviceList", method_name: "updateSpeakerDeviceList_FromBackend" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/selected_speaker_device", ns: configs, hook_name: "useSelectedSpeakerDevice", method_name: "updateSelectedSpeakerDevice" },
|
||||||
|
{ endpoint: "/set/data/selected_speaker_device", ns: configs, hook_name: "useSelectedSpeakerDevice", method_name: "updateSelectedSpeakerDevice" },
|
||||||
|
{ endpoint: "/run/selected_speaker_device", ns: configs, hook_name: "useSelectedSpeakerDevice", method_name: "updateSelectedSpeakerDevice" },
|
||||||
|
|
||||||
|
// Device (Threshold)
|
||||||
|
{ endpoint: "/get/data/mic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateMicThreshold" },
|
||||||
|
{ endpoint: "/set/data/mic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateMicThreshold" },
|
||||||
|
{ endpoint: "/get/data/speaker_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateSpeakerThreshold" },
|
||||||
|
{ endpoint: "/set/data/speaker_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateSpeakerThreshold" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/mic_automatic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateEnableAutomaticMicThreshold" },
|
||||||
|
{ endpoint: "/set/enable/mic_automatic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateEnableAutomaticMicThreshold" },
|
||||||
|
{ endpoint: "/set/disable/mic_automatic_threshold", ns: configs, hook_name: "useMicThreshold", method_name: "updateEnableAutomaticMicThreshold" },
|
||||||
|
{ endpoint: "/get/data/speaker_automatic_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateEnableAutomaticSpeakerThreshold" },
|
||||||
|
{ endpoint: "/set/enable/speaker_automatic_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateEnableAutomaticSpeakerThreshold" },
|
||||||
|
{ endpoint: "/set/disable/speaker_automatic_threshold", ns: configs, hook_name: "useSpeakerThreshold", method_name: "updateEnableAutomaticSpeakerThreshold" },
|
||||||
|
|
||||||
|
|
||||||
|
// Appearance
|
||||||
|
{ endpoint: "/get/data/ui_language", ns: configs, hook_name: "useUiLanguage", method_name: "updateUiLanguage" },
|
||||||
|
{ endpoint: "/set/data/ui_language", ns: configs, hook_name: "useUiLanguage", method_name: "updateUiLanguage" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/ui_scaling", ns: configs, hook_name: "useUiScaling", method_name: "updateUiScaling" },
|
||||||
|
{ endpoint: "/set/data/ui_scaling", ns: configs, hook_name: "useUiScaling", method_name: "updateUiScaling" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/textbox_ui_scaling", ns: configs, hook_name: "useMessageLogUiScaling", method_name: "updateMessageLogUiScaling" },
|
||||||
|
{ endpoint: "/set/data/textbox_ui_scaling", ns: configs, hook_name: "useMessageLogUiScaling", method_name: "updateMessageLogUiScaling" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/send_message_button_type", ns: configs, hook_name: "useSendMessageButtonType", method_name: "updateSendMessageButtonType" },
|
||||||
|
{ endpoint: "/set/data/send_message_button_type", ns: configs, hook_name: "useSendMessageButtonType", method_name: "updateSendMessageButtonType" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/font_family", ns: configs, hook_name: "useSelectedFontFamily", method_name: "updateSelectedFontFamily" },
|
||||||
|
{ endpoint: "/set/data/font_family", ns: configs, hook_name: "useSelectedFontFamily", method_name: "updateSelectedFontFamily" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/transparency", ns: configs, hook_name: "useTransparency", method_name: "updateTransparency" },
|
||||||
|
{ endpoint: "/set/data/transparency", ns: configs, hook_name: "useTransparency", method_name: "updateTransparency" },
|
||||||
|
|
||||||
|
// Translation
|
||||||
|
{ endpoint: "/get/data/deepl_auth_key", ns: configs, hook_name: "useDeepLAuthKey", method_name: "updateDeepLAuthKey" },
|
||||||
|
{ endpoint: "/set/data/deepl_auth_key", ns: configs, hook_name: "useDeepLAuthKey", method_name: "savedDeepLAuthKey" },
|
||||||
|
{ endpoint: "/delete/data/deepl_auth_key", ns: configs, hook_name: "useDeepLAuthKey", method_name: "deletedDeepLAuthKey" },
|
||||||
|
|
||||||
|
// Translation (AI Models)
|
||||||
|
{ endpoint: "/get/data/ctranslate2_weight_type", ns: configs, hook_name: "useSelectedCTranslate2WeightType", method_name: "updateSelectedCTranslate2WeightType" },
|
||||||
|
{ endpoint: "/set/data/ctranslate2_weight_type", ns: configs, hook_name: "useSelectedCTranslate2WeightType", method_name: "updateSelectedCTranslate2WeightType" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/selectable_ctranslate2_weight_type_dict", ns: configs, hook_name: "useCTranslate2WeightTypeStatus", method_name: "updateDownloadedCTranslate2WeightTypeStatus" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/translation_compute_device_list", ns: configs, hook_name: "useSelectableCTranslate2ComputeDeviceList", method_name: "updateSelectableCTranslate2ComputeDeviceList_FromBackend" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/selected_translation_compute_device", ns: configs, hook_name: "useSelectedCTranslate2ComputeDevice", method_name: "updateSelectedCTranslate2ComputeDevice" },
|
||||||
|
{ endpoint: "/set/data/selected_translation_compute_device", ns: configs, hook_name: "useSelectedCTranslate2ComputeDevice", method_name: "updateSelectedCTranslate2ComputeDevice" },
|
||||||
|
|
||||||
|
{ endpoint: "/run/downloaded_ctranslate2_weight", ns: configs, hook_name: "useCTranslate2WeightTypeStatus", method_name: "downloadedCTranslate2WeightType" },
|
||||||
|
{ endpoint: "/run/download_ctranslate2_weight", ns: null, hook_name: null, method_name: null },
|
||||||
|
{ endpoint: "/run/download_progress_ctranslate2_weight", ns: configs, hook_name: "useCTranslate2WeightTypeStatus", method_name: "updateDownloadProgressCTranslate2WeightTypeStatus" },
|
||||||
|
|
||||||
|
// Transcription
|
||||||
|
// Transcription (Mic)
|
||||||
|
{ endpoint: "/get/data/mic_record_timeout", ns: configs, hook_name: "useMicRecordTimeout", method_name: "updateMicRecordTimeout" },
|
||||||
|
{ endpoint: "/set/data/mic_record_timeout", ns: configs, hook_name: "useMicRecordTimeout", method_name: "updateMicRecordTimeout" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/mic_phrase_timeout", ns: configs, hook_name: "useMicPhraseTimeout", method_name: "updateMicPhraseTimeout" },
|
||||||
|
{ endpoint: "/set/data/mic_phrase_timeout", ns: configs, hook_name: "useMicPhraseTimeout", method_name: "updateMicPhraseTimeout" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/mic_max_phrases", ns: configs, hook_name: "useMicMaxWords", method_name: "updateMicMaxWords" },
|
||||||
|
{ endpoint: "/set/data/mic_max_phrases", ns: configs, hook_name: "useMicMaxWords", method_name: "updateMicMaxWords" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/mic_word_filter", ns: configs, hook_name: "useMicWordFilterList", method_name: "updateMicWordFilterList_FromBackend" },
|
||||||
|
{ endpoint: "/set/data/mic_word_filter", ns: configs, hook_name: "useMicWordFilterList", method_name: "updateMicWordFilterList_FromBackend" },
|
||||||
|
|
||||||
|
// Transcription (Speaker)
|
||||||
|
{ endpoint: "/get/data/speaker_record_timeout", ns: configs, hook_name: "useSpeakerRecordTimeout", method_name: "updateSpeakerRecordTimeout" },
|
||||||
|
{ endpoint: "/set/data/speaker_record_timeout", ns: configs, hook_name: "useSpeakerRecordTimeout", method_name: "updateSpeakerRecordTimeout" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/speaker_phrase_timeout", ns: configs, hook_name: "useSpeakerPhraseTimeout", method_name: "updateSpeakerPhraseTimeout" },
|
||||||
|
{ endpoint: "/set/data/speaker_phrase_timeout", ns: configs, hook_name: "useSpeakerPhraseTimeout", method_name: "updateSpeakerPhraseTimeout" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/speaker_max_phrases", ns: configs, hook_name: "useSpeakerMaxWords", method_name: "updateSpeakerMaxWords" },
|
||||||
|
{ endpoint: "/set/data/speaker_max_phrases", ns: configs, hook_name: "useSpeakerMaxWords", method_name: "updateSpeakerMaxWords" },
|
||||||
|
|
||||||
|
// Transcription (AI Models)
|
||||||
|
{ endpoint: "/get/data/selected_transcription_engine", ns: configs, hook_name: "useSelectedTranscriptionEngine", method_name: "updateSelectedTranscriptionEngine" },
|
||||||
|
{ endpoint: "/set/data/selected_transcription_engine", ns: configs, hook_name: "useSelectedTranscriptionEngine", method_name: "updateSelectedTranscriptionEngine" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/whisper_weight_type", ns: configs, hook_name: "useSelectedWhisperWeightType", method_name: "updateSelectedWhisperWeightType" },
|
||||||
|
{ endpoint: "/set/data/whisper_weight_type", ns: configs, hook_name: "useSelectedWhisperWeightType", method_name: "updateSelectedWhisperWeightType" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/selectable_whisper_weight_type_dict", ns: configs, hook_name: "useWhisperWeightTypeStatus", method_name: "updateDownloadedWhisperWeightTypeStatus" },
|
||||||
|
|
||||||
|
{ endpoint: "/run/downloaded_whisper_weight", ns: configs, hook_name: "useWhisperWeightTypeStatus", method_name: "downloadedWhisperWeightType" },
|
||||||
|
{ endpoint: "/run/download_whisper_weight", ns: null, hook_name: null, method_name: null },
|
||||||
|
{ endpoint: "/run/download_progress_whisper_weight", ns: configs, hook_name: "useWhisperWeightTypeStatus", method_name: "updateDownloadProgressWhisperWeightTypeStatus" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/transcription_compute_device_list", ns: configs, hook_name: "useSelectableWhisperComputeDeviceList", method_name: "updateSelectableWhisperComputeDeviceList_FromBackend" },
|
||||||
|
{ endpoint: "/get/data/selected_transcription_compute_device", ns: configs, hook_name: "useSelectedWhisperComputeDevice", method_name: "updateSelectedWhisperComputeDevice" },
|
||||||
|
{ endpoint: "/set/data/selected_transcription_compute_device", ns: configs, hook_name: "useSelectedWhisperComputeDevice", method_name: "updateSelectedWhisperComputeDevice" },
|
||||||
|
|
||||||
|
// VR
|
||||||
|
{ endpoint: "/get/data/overlay_small_log", ns: configs, hook_name: "useIsEnabledOverlaySmallLog", method_name: "updateIsEnabledOverlaySmallLog" },
|
||||||
|
{ endpoint: "/set/enable/overlay_small_log", ns: configs, hook_name: "useIsEnabledOverlaySmallLog", method_name: "updateIsEnabledOverlaySmallLog" },
|
||||||
|
{ endpoint: "/set/disable/overlay_small_log", ns: configs, hook_name: "useIsEnabledOverlaySmallLog", method_name: "updateIsEnabledOverlaySmallLog" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/overlay_small_log_settings", ns: configs, hook_name: "useOverlaySmallLogSettings", method_name: "updateOverlaySmallLogSettings" },
|
||||||
|
{ endpoint: "/set/data/overlay_small_log_settings", ns: configs, hook_name: "useOverlaySmallLogSettings", method_name: "updateOverlaySmallLogSettings" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/overlay_large_log", ns: configs, hook_name: "useIsEnabledOverlayLargeLog", method_name: "updateIsEnabledOverlayLargeLog" },
|
||||||
|
{ endpoint: "/set/enable/overlay_large_log", ns: configs, hook_name: "useIsEnabledOverlayLargeLog", method_name: "updateIsEnabledOverlayLargeLog" },
|
||||||
|
{ endpoint: "/set/disable/overlay_large_log", ns: configs, hook_name: "useIsEnabledOverlayLargeLog", method_name: "updateIsEnabledOverlayLargeLog" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/overlay_large_log_settings", ns: configs, hook_name: "useOverlayLargeLogSettings", method_name: "updateOverlayLargeLogSettings" },
|
||||||
|
{ endpoint: "/set/data/overlay_large_log_settings", ns: configs, hook_name: "useOverlayLargeLogSettings", method_name: "updateOverlayLargeLogSettings" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/overlay_show_only_translated_messages", ns: configs, hook_name: "useOverlayShowOnlyTranslatedMessages", method_name: "updateOverlayShowOnlyTranslatedMessages" },
|
||||||
|
{ endpoint: "/set/enable/overlay_show_only_translated_messages", ns: configs, hook_name: "useOverlayShowOnlyTranslatedMessages", method_name: "updateOverlayShowOnlyTranslatedMessages" },
|
||||||
|
{ endpoint: "/set/disable/overlay_show_only_translated_messages", ns: configs, hook_name: "useOverlayShowOnlyTranslatedMessages", method_name: "updateOverlayShowOnlyTranslatedMessages" },
|
||||||
|
|
||||||
|
{ endpoint: "/run/send_text_overlay", ns: null, hook_name: null, method_name: null },
|
||||||
|
|
||||||
|
|
||||||
|
// Others
|
||||||
|
{ endpoint: "/get/data/auto_clear_message_box", ns: configs, hook_name: "useEnableAutoClearMessageInputBox", method_name: "updateEnableAutoClearMessageInputBox" },
|
||||||
|
{ endpoint: "/set/enable/auto_clear_message_box", ns: configs, hook_name: "useEnableAutoClearMessageInputBox", method_name: "updateEnableAutoClearMessageInputBox" },
|
||||||
|
{ endpoint: "/set/disable/auto_clear_message_box", ns: configs, hook_name: "useEnableAutoClearMessageInputBox", method_name: "updateEnableAutoClearMessageInputBox" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/send_only_translated_messages", ns: configs, hook_name: "useEnableSendOnlyTranslatedMessages", method_name: "updateEnableSendOnlyTranslatedMessages" },
|
||||||
|
{ endpoint: "/set/enable/send_only_translated_messages", ns: configs, hook_name: "useEnableSendOnlyTranslatedMessages", method_name: "updateEnableSendOnlyTranslatedMessages" },
|
||||||
|
{ endpoint: "/set/disable/send_only_translated_messages", ns: configs, hook_name: "useEnableSendOnlyTranslatedMessages", method_name: "updateEnableSendOnlyTranslatedMessages" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/logger_feature", ns: configs, hook_name: "useEnableAutoExportMessageLogs", method_name: "updateEnableAutoExportMessageLogs" },
|
||||||
|
{ endpoint: "/set/enable/logger_feature", ns: configs, hook_name: "useEnableAutoExportMessageLogs", method_name: "updateEnableAutoExportMessageLogs" },
|
||||||
|
{ endpoint: "/set/disable/logger_feature", ns: configs, hook_name: "useEnableAutoExportMessageLogs", method_name: "updateEnableAutoExportMessageLogs" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/vrc_mic_mute_sync", ns: configs, hook_name: "useEnableVrcMicMuteSync", method_name: "updateEnableVrcMicMuteSync_FromBackend" },
|
||||||
|
{ endpoint: "/set/enable/vrc_mic_mute_sync", ns: configs, hook_name: "useEnableVrcMicMuteSync", method_name: "updateEnableVrcMicMuteSync_FromBackend" },
|
||||||
|
{ endpoint: "/set/disable/vrc_mic_mute_sync", ns: configs, hook_name: "useEnableVrcMicMuteSync", method_name: "updateEnableVrcMicMuteSync_FromBackend" },
|
||||||
|
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/send_message_to_vrc", ns: configs, hook_name: "useEnableSendMessageToVrc", method_name: "updateEnableSendMessageToVrc" },
|
||||||
|
{ endpoint: "/set/enable/send_message_to_vrc", ns: configs, hook_name: "useEnableSendMessageToVrc", method_name: "updateEnableSendMessageToVrc" },
|
||||||
|
{ endpoint: "/set/disable/send_message_to_vrc", ns: configs, hook_name: "useEnableSendMessageToVrc", method_name: "updateEnableSendMessageToVrc" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/send_received_message_to_vrc", ns: configs, hook_name: "useEnableSendReceivedMessageToVrc", method_name: "updateEnableSendReceivedMessageToVrc" },
|
||||||
|
{ endpoint: "/set/enable/send_received_message_to_vrc", ns: configs, hook_name: "useEnableSendReceivedMessageToVrc", method_name: "updateEnableSendReceivedMessageToVrc" },
|
||||||
|
{ endpoint: "/set/disable/send_received_message_to_vrc", ns: configs, hook_name: "useEnableSendReceivedMessageToVrc", method_name: "updateEnableSendReceivedMessageToVrc" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/notification_vrc_sfx", ns: configs, hook_name: "useEnableNotificationVrcSfx", method_name: "updateEnableNotificationVrcSfx" },
|
||||||
|
{ endpoint: "/set/enable/notification_vrc_sfx", ns: configs, hook_name: "useEnableNotificationVrcSfx", method_name: "updateEnableNotificationVrcSfx" },
|
||||||
|
{ endpoint: "/set/disable/notification_vrc_sfx", ns: configs, hook_name: "useEnableNotificationVrcSfx", method_name: "updateEnableNotificationVrcSfx" },
|
||||||
|
|
||||||
|
// Hotkeys
|
||||||
|
{ endpoint: "/get/data/hotkeys", ns: configs, hook_name: "useHotkeys", method_name: "updateHotkeys" },
|
||||||
|
{ endpoint: "/set/data/hotkeys", ns: configs, hook_name: "useHotkeys", method_name: "updateHotkeys" },
|
||||||
|
|
||||||
|
// Plugins
|
||||||
|
{ endpoint: "/get/data/plugins_status", ns: configs, hook_name: "usePlugins", method_name: "updateSavedPluginsStatus" },
|
||||||
|
{ endpoint: "/set/data/plugins_status", ns: configs, hook_name: "usePlugins", method_name: "updateSavedPluginsStatus" },
|
||||||
|
|
||||||
|
// Advanced Settings
|
||||||
|
{ endpoint: "/get/data/osc_ip_address", ns: configs, hook_name: "useOscIpAddress", method_name: "updateOscIpAddress" },
|
||||||
|
{ endpoint: "/set/data/osc_ip_address", ns: configs, hook_name: "useOscIpAddress", method_name: "updateOscIpAddress" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/osc_port", ns: configs, hook_name: "useOscPort", method_name: "updateOscPort" },
|
||||||
|
{ endpoint: "/set/data/osc_port", ns: configs, hook_name: "useOscPort", method_name: "updateOscPort" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/websocket_server", ns: configs, hook_name: "useWebsocket", method_name: "updateEnableWebsocket" },
|
||||||
|
{ endpoint: "/set/enable/websocket_server", ns: configs, hook_name: "useWebsocket", method_name: "updateEnableWebsocket" },
|
||||||
|
{ endpoint: "/set/disable/websocket_server", ns: configs, hook_name: "useWebsocket", method_name: "updateEnableWebsocket" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/websocket_host", ns: configs, hook_name: "useWebsocket", method_name: "updateWebsocketHost" },
|
||||||
|
{ endpoint: "/set/data/websocket_host", ns: configs, hook_name: "useWebsocket", method_name: "updateWebsocketHost" },
|
||||||
|
|
||||||
|
{ endpoint: "/get/data/websocket_port", ns: configs, hook_name: "useWebsocket", method_name: "updateWebsocketPort" },
|
||||||
|
{ endpoint: "/set/data/websocket_port", ns: configs, hook_name: "useWebsocket", method_name: "updateWebsocketPort" },
|
||||||
|
|
||||||
|
|
||||||
|
// Not Implemented Yet...
|
||||||
|
{ endpoint: "/get/data/mic_avg_logprob", ns: null, hook_name: null, method_name: null }, // Not implemented on UI yet
|
||||||
|
{ endpoint: "/get/data/mic_no_speech_prob", ns: null, hook_name: null, method_name: null }, // Not implemented on UI yet
|
||||||
|
{ endpoint: "/get/data/speaker_avg_logprob", ns: null, hook_name: null, method_name: null }, // Not implemented on UI yet
|
||||||
|
{ endpoint: "/get/data/speaker_no_speech_prob", ns: null, hook_name: null, method_name: null }, // Not implemented on UI yet
|
||||||
|
{ endpoint: "/get/data/convert_message_to_romaji", ns: null, hook_name: null, method_name: null }, // Not implemented on UI yet
|
||||||
|
{ endpoint: "/get/data/convert_message_to_hiragana", ns: null, hook_name: null, method_name: null }, // Not implemented on UI yet
|
||||||
|
{ endpoint: "/get/data/transcription_engines", ns: null, hook_name: null, method_name: null }, // Not implemented on UI yet. (if ai_models has not been detected, this will be blank array[]. if the ai_models are ok but just network has not connected, it'l be only ["Whisper"])
|
||||||
|
];
|
||||||
|
|
||||||
export const useReceiveRoutes = () => {
|
export const useReceiveRoutes = () => {
|
||||||
const { updateIsVrctAvailable } = useIsVrctAvailable();
|
const { showNotification_Error } = common.useNotificationStatus();
|
||||||
const { updateComputeMode } = useComputeMode();
|
const { errorHandling_Backend } = _useBackendErrorHandling();
|
||||||
const { updateInitProgress } = useInitProgress();
|
const { updateIsBackendReady } = common.useIsBackendReady();
|
||||||
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 { updateEnableAutoClearMessageInputBox } = useEnableAutoClearMessageInputBox();
|
const handleInvalidEndpoint = (parsed_data) => {
|
||||||
const { updateEnableSendOnlyTranslatedMessages } = useEnableSendOnlyTranslatedMessages();
|
console.error(`Invalid endpoint: ${parsed_data.endpoint}\nresult: ${JSON.stringify(parsed_data.result)}`);
|
||||||
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 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 receiveRoutes = (parsed_data) => {
|
||||||
const initDataSyncProcess = (payload) => {
|
const { endpoint, status, result } = parsed_data;
|
||||||
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 handleInvalidEndpoint = (parsed_data) => {
|
if (endpoint === "/run/initialization_complete") {
|
||||||
console.error(`Invalid endpoint: ${parsed_data.endpoint}\nresult: ${JSON.stringify(parsed_data.result)}`);
|
Object.entries(result).forEach(([ep, value]) => {
|
||||||
};
|
if (ep in routes) {
|
||||||
|
routes[ep](value);
|
||||||
if (parsed_data.endpoint === "/run/initialization_complete") {
|
} else {
|
||||||
initDataSyncProcess(parsed_data.result);
|
handleInvalidEndpoint({ endpoint: ep, result: value });
|
||||||
|
}
|
||||||
|
});
|
||||||
updateIsBackendReady(true);
|
updateIsBackendReady(true);
|
||||||
return;
|
return;
|
||||||
};
|
}
|
||||||
|
|
||||||
switch (parsed_data.status) {
|
|
||||||
|
switch (status) {
|
||||||
case 200:
|
case 200:
|
||||||
const route = routes[parsed_data.endpoint];
|
if (endpoint in routes) {
|
||||||
if (route) {
|
routes[endpoint](result);
|
||||||
route(parsed_data.result);
|
|
||||||
} else {
|
} else {
|
||||||
handleInvalidEndpoint(parsed_data);
|
handleInvalidEndpoint(parsed_data);
|
||||||
}
|
}
|
||||||
@@ -580,31 +364,24 @@ export const useReceiveRoutes = () => {
|
|||||||
result: parsed_data.result,
|
result: parsed_data.result,
|
||||||
});
|
});
|
||||||
break;
|
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:
|
case 348:
|
||||||
// console.log(`from backend: %c ${JSON.stringify(parsed_data)}`, style_348);
|
// console.log(`from backend: %c ${JSON.stringify(parsed_data)}`, style_348);
|
||||||
break;
|
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:
|
default:
|
||||||
console.log("Received data status does not match.", parsed_data);
|
console.log("Received data status does not match.", parsed_data);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return { receiveRoutes };
|
return { receiveRoutes };
|
||||||
};
|
};
|
||||||
|
|
||||||
const style_348 = [
|
const style_348 = [
|
||||||
"color: gray",
|
"color: gray",
|
||||||
].join(";");
|
].join(";");
|
||||||
|
|
||||||
const transformToIndexedArray = (devices) => {
|
|
||||||
return devices.reduce((result, device, index) => {
|
|
||||||
result[index] = device;
|
|
||||||
return result;
|
|
||||||
}, {});
|
|
||||||
};
|
|
||||||
@@ -153,7 +153,6 @@ export const { atomInstance: Atom_TranscriptionReceiveStatus, useHook: useStore_
|
|||||||
export const { atomInstance: Atom_ForegroundStatus, useHook: useStore_ForegroundStatus } = createAtomWithHook(false, "ForegroundStatus", {is_state_ok: true});
|
export const { atomInstance: Atom_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_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_SelectedYourLanguages, useHook: useStore_SelectedYourLanguages } = createAtomWithHook({}, "SelectedYourLanguages");
|
||||||
export const { atomInstance: Atom_SelectedTargetLanguages, useHook: useStore_SelectedTargetLanguages } = createAtomWithHook({}, "SelectedTargetLanguages");
|
export const { atomInstance: Atom_SelectedTargetLanguages, useHook: useStore_SelectedTargetLanguages } = createAtomWithHook({}, "SelectedTargetLanguages");
|
||||||
|
|
||||||
|
|||||||
@@ -58,3 +58,11 @@ export const genNumArray = (count, start_from = 0) => {
|
|||||||
export const genNumObjArray = (count, start_from = 0) => {
|
export const genNumObjArray = (count, start_from = 0) => {
|
||||||
return arrayToObject(genNumArray(count, start_from));
|
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;
|
||||||
|
}, {});
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user