[Refactor/TMP1] Refactor UI components and connect to backend APIs. (Device, Appearance)

This commit is contained in:
Sakamoto Shiina
2025-10-21 13:17:37 +09:00
parent caeb8b6888
commit 36fb857dbb
11 changed files with 1510 additions and 438 deletions

View File

@@ -28,12 +28,12 @@ import poster_showcase_section_title from "@images/about_vrct/poster_showcase_se
import clsx from "clsx"; import clsx from "clsx";
import { useI18n } from "@useI18n"; import { useI18n } from "@useI18n";
import { useStore_UiLanguage } from "@store"; import { useAppearance } from "@logics_configs";
import { PosterShowcaseContents } from "./poster_showcase_contents/PosterShowcaseContents"; import { PosterShowcaseContents } from "./poster_showcase_contents/PosterShowcaseContents";
export const AboutVrct = () => { export const AboutVrct = () => {
const { t } = useI18n(); const { t } = useI18n();
const { currentUiLanguage } = useStore_UiLanguage(); const { currentUiLanguage } = useAppearance();
return ( return (
<div className={styles.container}> <div className={styles.container}>
<div className={styles.dev_section}> <div className={styles.dev_section}>

View File

@@ -1,6 +1,6 @@
import clsx from "clsx"; import clsx from "clsx";
import styles from "./PostersContents.module.scss"; import styles from "./PostersContents.module.scss";
import { useStore_UiLanguage } from "@store"; import { useAppearance } from "@logics_configs";
import { useStore_VrctPosterIndex } from "@store"; import { useStore_VrctPosterIndex } from "@store";
import ArrowLeftSvg from "@images/arrow_left.svg?react"; import ArrowLeftSvg from "@images/arrow_left.svg?react";
@@ -30,7 +30,7 @@ import poster_images_authors_m_en from "@images/about_vrct/vrct_posters/authors/
export const PostersContents = () => { export const PostersContents = () => {
const { currentVrctPosterIndex, updateVrctPosterIndex } = useStore_VrctPosterIndex(); const { currentVrctPosterIndex, updateVrctPosterIndex } = useStore_VrctPosterIndex();
const { currentUiLanguage } = useStore_UiLanguage(); const { currentUiLanguage } = useAppearance();
const updateIndex = (delta) => { const updateIndex = (delta) => {

View File

@@ -232,8 +232,8 @@ const WhisperWeightType_Box = () => {
const { t } = useI18n(); const { t } = useI18n();
const { const {
currentWhisperWeightTypeStatus, currentWhisperWeightTypeStatus,
pendingWhisperWeightType, pendingWhisperWeightTypeStatus,
downloadWhisperWeight, downloadWhisperWeightTypeStatus,
} = useTranscription(); } = useTranscription();
const { currentSelectedWhisperWeightType, setSelectedWhisperWeightType } = useTranscription(); const { currentSelectedWhisperWeightType, setSelectedWhisperWeightType } = useTranscription();
@@ -242,8 +242,8 @@ const WhisperWeightType_Box = () => {
}; };
const downloadStartFunction = (id) => { const downloadStartFunction = (id) => {
pendingWhisperWeightType(id); pendingWhisperWeightTypeStatus(id);
downloadWhisperWeight(id); downloadWhisperWeightTypeStatus(id);
}; };
const new_labels = [ const new_labels = [

View File

@@ -34,8 +34,8 @@ const CTranslate2WeightType_Box = () => {
const { t } = useI18n(); const { t } = useI18n();
const { const {
currentCTranslate2WeightTypeStatus, currentCTranslate2WeightTypeStatus,
pendingCTranslate2WeightType, pendingCTranslate2WeightTypeStatus,
downloadCTranslate2Weight, downloadCTranslate2WeightTypeStatus,
currentSelectedCTranslate2WeightType, currentSelectedCTranslate2WeightType,
setSelectedCTranslate2WeightType, setSelectedCTranslate2WeightType,
@@ -46,8 +46,8 @@ const CTranslate2WeightType_Box = () => {
}; };
const downloadStartFunction = (id) => { const downloadStartFunction = (id) => {
pendingCTranslate2WeightType(id); pendingCTranslate2WeightTypeStatus(id);
downloadCTranslate2Weight(id); downloadCTranslate2WeightTypeStatus(id);
}; };
const new_labels = [ const new_labels = [

View File

@@ -5,6 +5,7 @@ import "./_index_css/root.css";
import { getCurrentWindow } from "@tauri-apps/api/window"; import { getCurrentWindow } from "@tauri-apps/api/window";
import { store } from "@store"; import { store } from "@store";
store.appWindow = getCurrentWindow(); store.appWindow = getCurrentWindow();
import { App } from "./App"; import { App } from "./App";

View File

@@ -1,201 +1,207 @@
import { import { useAppearance_S } from "../../../ui_config_setter";
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 = () => { export const useAppearance = () => {
const { t } = useI18n(); return {...useAppearance_S()};
const { asyncStdoutToPython } = useStdoutToPython(); }
const { showNotification_SaveSuccess } = useNotificationStatus();
// UI Language // import {
const { currentUiLanguage, updateUiLanguage, pendingUiLanguage } = useStore_UiLanguage(); // useStore_UiLanguage,
// UI Scaling // useStore_UiScaling,
const { currentUiScaling, updateUiScaling, pendingUiScaling } = useStore_UiScaling(); // useStore_MessageLogUiScaling,
// Message Log Ui Scaling // useStore_SendMessageButtonType,
const { currentMessageLogUiScaling, updateMessageLogUiScaling, pendingMessageLogUiScaling } = useStore_MessageLogUiScaling(); // useStore_ShowResendButton,
// Send Message Button Type // useStore_SelectedFontFamily,
const { currentSendMessageButtonType, updateSendMessageButtonType, pendingSendMessageButtonType } = useStore_SendMessageButtonType(); // useStore_Transparency,
// Show Resend Button // } from "@store";
const { currentShowResendButton, updateShowResendButton, pendingShowResendButton } = useStore_ShowResendButton(); // import { useStdoutToPython } from "@useStdoutToPython";
// Selected Font Family // import { useI18n } from "@useI18n";
const { currentSelectedFontFamily, updateSelectedFontFamily, pendingSelectedFontFamily } = useStore_SelectedFontFamily(); // import { useNotificationStatus } from "@logics_common";
// Transparency
const { currentTransparency, updateTransparency, pendingTransparency } = useStore_Transparency(); // 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 // // UI Language
const getUiLanguage = () => { // const getUiLanguage = () => {
pendingUiLanguage(); // pendingUiLanguage();
asyncStdoutToPython("/get/data/ui_language"); // asyncStdoutToPython("/get/data/ui_language");
}; // };
const setUiLanguage = (selected_ui_language) => { // const setUiLanguage = (selected_ui_language) => {
pendingUiLanguage(); // pendingUiLanguage();
asyncStdoutToPython("/set/data/ui_language", selected_ui_language); // asyncStdoutToPython("/set/data/ui_language", selected_ui_language);
}; // };
const setSuccessUiLanguage = (selected_ui_language) => { // const setSuccessUiLanguage = (selected_ui_language) => {
updateUiLanguage(selected_ui_language); // updateUiLanguage(selected_ui_language);
showNotification_SaveSuccess(); // showNotification_SaveSuccess();
}; // };
// UI Scaling // // UI Scaling
const getUiScaling = () => { // const getUiScaling = () => {
pendingUiScaling(); // pendingUiScaling();
asyncStdoutToPython("/get/data/ui_scaling"); // asyncStdoutToPython("/get/data/ui_scaling");
}; // };
const setUiScaling = (selected_ui_scaling) => { // const setUiScaling = (selected_ui_scaling) => {
pendingUiScaling(); // pendingUiScaling();
asyncStdoutToPython("/set/data/ui_scaling", selected_ui_scaling); // asyncStdoutToPython("/set/data/ui_scaling", selected_ui_scaling);
}; // };
const setSuccessUiScaling = (selected_ui_scaling) => { // const setSuccessUiScaling = (selected_ui_scaling) => {
updateUiScaling(selected_ui_scaling); // updateUiScaling(selected_ui_scaling);
showNotification_SaveSuccess(); // showNotification_SaveSuccess();
}; // };
// Message Log Ui Scaling // // Message Log Ui Scaling
const getMessageLogUiScaling = () => { // const getMessageLogUiScaling = () => {
pendingMessageLogUiScaling(); // pendingMessageLogUiScaling();
asyncStdoutToPython("/get/data/textbox_ui_scaling"); // asyncStdoutToPython("/get/data/textbox_ui_scaling");
}; // };
const setMessageLogUiScaling = (selected_ui_scaling) => { // const setMessageLogUiScaling = (selected_ui_scaling) => {
pendingMessageLogUiScaling(); // pendingMessageLogUiScaling();
asyncStdoutToPython("/set/data/textbox_ui_scaling", selected_ui_scaling); // asyncStdoutToPython("/set/data/textbox_ui_scaling", selected_ui_scaling);
}; // };
const setSuccessMessageLogUiScaling = (selected_ui_scaling) => { // const setSuccessMessageLogUiScaling = (selected_ui_scaling) => {
updateMessageLogUiScaling(selected_ui_scaling); // updateMessageLogUiScaling(selected_ui_scaling);
showNotification_SaveSuccess(); // showNotification_SaveSuccess();
}; // };
// Send Message Button Type // // Send Message Button Type
const getSendMessageButtonType = () => { // const getSendMessageButtonType = () => {
pendingSendMessageButtonType(); // pendingSendMessageButtonType();
asyncStdoutToPython("/get/data/send_message_button_type"); // asyncStdoutToPython("/get/data/send_message_button_type");
}; // };
const setSendMessageButtonType = (send_message_button_type) => { // const setSendMessageButtonType = (send_message_button_type) => {
pendingSendMessageButtonType(); // pendingSendMessageButtonType();
asyncStdoutToPython("/set/data/send_message_button_type", send_message_button_type); // asyncStdoutToPython("/set/data/send_message_button_type", send_message_button_type);
}; // };
const setSuccessSendMessageButtonType = (send_message_button_type) => { // const setSuccessSendMessageButtonType = (send_message_button_type) => {
updateSendMessageButtonType(send_message_button_type); // updateSendMessageButtonType(send_message_button_type);
showNotification_SaveSuccess(); // showNotification_SaveSuccess();
}; // };
// Show Resend Button // // Show Resend Button
const getShowResendButton = () => { // const getShowResendButton = () => {
pendingShowResendButton(); // pendingShowResendButton();
asyncStdoutToPython("/get/data/show_resend_button"); // asyncStdoutToPython("/get/data/show_resend_button");
}; // };
const toggleShowResendButton = () => { // const toggleShowResendButton = () => {
pendingShowResendButton(); // pendingShowResendButton();
if (currentShowResendButton.data) { // if (currentShowResendButton.data) {
asyncStdoutToPython("/set/disable/show_resend_button"); // asyncStdoutToPython("/set/disable/show_resend_button");
} else { // } else {
asyncStdoutToPython("/set/enable/show_resend_button"); // asyncStdoutToPython("/set/enable/show_resend_button");
} // }
}; // };
const setSuccessShowResendButton = (to_show) => { // const setSuccessShowResendButton = (to_show) => {
updateShowResendButton(to_show); // updateShowResendButton(to_show);
showNotification_SaveSuccess(); // showNotification_SaveSuccess();
}; // };
// Selected Font Family // // Selected Font Family
const getSelectedFontFamily = () => { // const getSelectedFontFamily = () => {
pendingSelectedFontFamily(); // pendingSelectedFontFamily();
asyncStdoutToPython("/get/data/font_family"); // asyncStdoutToPython("/get/data/font_family");
}; // };
const setSelectedFontFamily = (selected_font_family) => { // const setSelectedFontFamily = (selected_font_family) => {
pendingSelectedFontFamily(); // pendingSelectedFontFamily();
asyncStdoutToPython("/set/data/font_family", selected_font_family); // asyncStdoutToPython("/set/data/font_family", selected_font_family);
}; // };
const setSuccessSelectedFontFamily = (selected_font_family) => { // const setSuccessSelectedFontFamily = (selected_font_family) => {
updateSelectedFontFamily(selected_font_family); // updateSelectedFontFamily(selected_font_family);
showNotification_SaveSuccess(); // showNotification_SaveSuccess();
}; // };
// Transparency // // Transparency
const getTransparency = () => { // const getTransparency = () => {
pendingTransparency(); // pendingTransparency();
asyncStdoutToPython("/get/data/transparency"); // asyncStdoutToPython("/get/data/transparency");
}; // };
const setTransparency = (selected_transparency) => { // const setTransparency = (selected_transparency) => {
pendingTransparency(); // pendingTransparency();
asyncStdoutToPython("/set/data/transparency", selected_transparency); // asyncStdoutToPython("/set/data/transparency", selected_transparency);
}; // };
const setSuccessTransparency = (selected_transparency) => { // const setSuccessTransparency = (selected_transparency) => {
updateTransparency(selected_transparency); // updateTransparency(selected_transparency);
showNotification_SaveSuccess(); // showNotification_SaveSuccess();
}; // };
return { // return {
// UI Language // // UI Language
currentUiLanguage, // currentUiLanguage,
getUiLanguage, // getUiLanguage,
updateUiLanguage, // updateUiLanguage,
setUiLanguage, // setUiLanguage,
setSuccessUiLanguage, // setSuccessUiLanguage,
// UI Scaling // // UI Scaling
currentUiScaling, // currentUiScaling,
getUiScaling, // getUiScaling,
updateUiScaling, // updateUiScaling,
setUiScaling, // setUiScaling,
setSuccessUiScaling, // setSuccessUiScaling,
// Message Log Ui Scaling // // Message Log Ui Scaling
currentMessageLogUiScaling, // currentMessageLogUiScaling,
getMessageLogUiScaling, // getMessageLogUiScaling,
updateMessageLogUiScaling, // updateMessageLogUiScaling,
setMessageLogUiScaling, // setMessageLogUiScaling,
setSuccessMessageLogUiScaling, // setSuccessMessageLogUiScaling,
// Send Message Button Type // // Send Message Button Type
currentSendMessageButtonType, // currentSendMessageButtonType,
getSendMessageButtonType, // getSendMessageButtonType,
setSendMessageButtonType, // setSendMessageButtonType,
setSuccessSendMessageButtonType, // setSuccessSendMessageButtonType,
updateSendMessageButtonType, // updateSendMessageButtonType,
// Show Resend Button // // Show Resend Button
currentShowResendButton, // currentShowResendButton,
getShowResendButton, // getShowResendButton,
updateShowResendButton, // updateShowResendButton,
toggleShowResendButton, // toggleShowResendButton,
setSuccessShowResendButton, // setSuccessShowResendButton,
// Selected Font Family // // Selected Font Family
currentSelectedFontFamily, // currentSelectedFontFamily,
getSelectedFontFamily, // getSelectedFontFamily,
updateSelectedFontFamily, // updateSelectedFontFamily,
setSelectedFontFamily, // setSelectedFontFamily,
setSuccessSelectedFontFamily, // setSuccessSelectedFontFamily,
// Transparency // // Transparency
currentTransparency, // currentTransparency,
getTransparency, // getTransparency,
updateTransparency, // updateTransparency,
setTransparency, // setTransparency,
setSuccessTransparency, // setSuccessTransparency,
}; // };
}; // };

View File

@@ -1,11 +1,24 @@
export { useDevice } from "./device/useDevice"; // export { useDevice } from "./device/useDevice";
export { useAppearance } from "./appearance/useAppearance"; // export { useAppearance } from "./appearance/useAppearance";
export { useOthers } from "./others/useOthers";
export { useTranscription } from "./transcription/useTranscription"; export {
export { useTranslation } from "./translation/useTranslation"; useAppearance,
export { useVr } from "./vr/useVr"; useDevice,
useOthers,
useTranscription,
useTranslation,
useVr,
// useHotkeys,
useAdvancedSettings,
} from "../../ui_config_setter.js";
// 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 { useHotkeys } from "./hotkeys/useHotkeys";
export { useAdvancedSettings } from "./advanced_settings/useAdvancedSettings"; // export { useAdvancedSettings } from "./advanced_settings/useAdvancedSettings";
export { useSupporters } from "./supporters/useSupporters"; export { useSupporters } from "./supporters/useSupporters";
export { usePlugins } from "./plugins/usePlugins"; export { usePlugins } from "./plugins/usePlugins";

View File

@@ -2,8 +2,9 @@ import * as common from "@logics_common";
import * as main from "@logics_main"; import * as main from "@logics_main";
import * as configs from "@logics_configs"; import * as configs from "@logics_configs";
import { _useBackendErrorHandling } from "./_useBackendErrorHandling"; import { _useBackendErrorHandling } from "./_useBackendErrorHandling";
import { SETTINGS_ARRAY } from "../ui_config_setter";
export const ROUTE_META_LIST = [ export const STATIC_ROUTE_META_LIST = [
// Common // Common
{ endpoint: "/run/feed_watchdog", ns: null, hook_name: null, method_name: null }, { 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/initialization_progress", ns: common, hook_name: "useInitProgress", method_name: "updateInitProgress" },
@@ -92,154 +93,154 @@ export const ROUTE_META_LIST = [
// Config Page // // Config Page
// Device // // Device
{ endpoint: "/get/data/auto_mic_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoMicSelect" }, // // { 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/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: "/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: "/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/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" }, // // { endpoint: "/set/disable/auto_speaker_select", ns: configs, hook_name: "useDevice", method_name: "setSuccessEnableAutoSpeakerSelect" },
// Device (Mic) // // // Device (Mic)
{ endpoint: "/get/data/mic_host_list", ns: configs, hook_name: "useDevice", method_name: "updateMicHostList_FromBackend" }, // // { endpoint: "/get/data/mic_host_list", ns: configs, hook_name: "useDevice", method_name: "updateMicHostList_FromBackend" },
{ endpoint: "/run/mic_host_list", ns: configs, hook_name: "useDevice", method_name: "updateMicHostList_FromBackend" }, // // { endpoint: "/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: "/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: "/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: "/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: "/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: "/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: "/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" }, // // { endpoint: "/run/selected_mic_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedMicHostAndDevice" },
// Device (Speaker) // // // Device (Speaker)
{ endpoint: "/get/data/speaker_device_list", ns: configs, hook_name: "useDevice", method_name: "updateSpeakerDeviceList_FromBackend" }, // // { endpoint: "/get/data/speaker_device_list", ns: configs, hook_name: "useDevice", method_name: "updateSpeakerDeviceList_FromBackend" },
{ endpoint: "/run/speaker_device_list", ns: configs, hook_name: "useDevice", method_name: "updateSpeakerDeviceList_FromBackend" }, // // { endpoint: "/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: "/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: "/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" }, // // { endpoint: "/run/selected_speaker_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedSpeakerDevice" },
// Device (Threshold) // // // Device (Threshold)
{ endpoint: "/get/data/mic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateMicThreshold" }, // // { 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: "/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: "/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: "/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: "/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/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: "/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: "/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/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" }, // // { endpoint: "/set/disable/speaker_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "setSuccessEnableAutomaticSpeakerThreshold" },
// Appearance // // Appearance
{ endpoint: "/get/data/ui_language", ns: configs, hook_name: "useAppearance", method_name: "updateUiLanguage" }, // // { endpoint: "/get/data/ui_language", ns: configs, hook_name: "useAppearance", method_name: "updateUiLanguage" },
{ endpoint: "/set/data/ui_language", ns: configs, hook_name: "useAppearance", method_name: "setSuccessUiLanguage" }, // // { 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: "/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: "/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: "/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: "/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: "/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: "/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: "/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/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: "/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: "/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: "/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: "/get/data/transparency", ns: configs, hook_name: "useAppearance", method_name: "updateTransparency" },
{ endpoint: "/set/data/transparency", ns: configs, hook_name: "useAppearance", method_name: "setSuccessTransparency" }, // // { endpoint: "/set/data/transparency", ns: configs, hook_name: "useAppearance", method_name: "setSuccessTransparency" },
// Translation // // Translation
{ endpoint: "/get/data/deepl_auth_key", ns: configs, hook_name: "useTranslation", method_name: "updateDeepLAuthKey" }, // { 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: "/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" }, // { endpoint: "/delete/data/deepl_auth_key", ns: configs, hook_name: "useTranslation", method_name: "deleteSuccessDeepLAuthKey" },
// Translation (AI Models) // // Translation (AI Models)
{ endpoint: "/get/data/selectable_ctranslate2_weight_type_dict", ns: configs, hook_name: "useTranslation", method_name: "updateDownloadedCTranslate2WeightTypeStatus" }, // { endpoint: "/get/data/selectable_ctranslate2_weight_type_dict", ns: configs, hook_name: "useTranslation", method_name: "updateDownloadedCTranslate2WeightTypeStatus" },
{ endpoint: "/get/data/ctranslate2_weight_type", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedCTranslate2WeightType" }, // { endpoint: "/get/data/ctranslate2_weight_type", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedCTranslate2WeightType" },
{ endpoint: "/set/data/ctranslate2_weight_type", ns: configs, hook_name: "useTranslation", method_name: "setSuccessSelectedCTranslate2WeightType" }, // { endpoint: "/set/data/ctranslate2_weight_type", ns: configs, hook_name: "useTranslation", method_name: "setSuccessSelectedCTranslate2WeightType" },
{ endpoint: "/run/selected_translation_compute_type", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedTranslationComputeType" }, // { endpoint: "/run/selected_translation_compute_type", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedTranslationComputeType" },
{ endpoint: "/get/data/selected_translation_compute_type", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedTranslationComputeType" }, // { endpoint: "/get/data/selected_translation_compute_type", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedTranslationComputeType" },
{ endpoint: "/set/data/selected_translation_compute_type", ns: configs, hook_name: "useTranslation", method_name: "setSuccessSelectedTranslationComputeType" }, // { endpoint: "/set/data/selected_translation_compute_type", ns: configs, hook_name: "useTranslation", method_name: "setSuccessSelectedTranslationComputeType" },
{ endpoint: "/run/downloaded_ctranslate2_weight", ns: configs, hook_name: "useTranslation", method_name: "downloadedCTranslate2WeightType" }, // { endpoint: "/run/downloaded_ctranslate2_weight", ns: configs, hook_name: "useTranslation", method_name: "downloadedCTranslate2WeightType" },
{ endpoint: "/run/download_ctranslate2_weight", ns: null, hook_name: null, method_name: null }, // { endpoint: "/run/download_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: "/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: "updateSelectableTranslationComputeDeviceList_FromBackend" }, // { endpoint: "/get/data/translation_compute_device_list", ns: configs, hook_name: "useTranslation", method_name: "updateSelectableTranslationComputeDeviceList_FromBackend" },
{ endpoint: "/get/data/selected_translation_compute_device", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedTranslationComputeDevice" }, // { endpoint: "/get/data/selected_translation_compute_device", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedTranslationComputeDevice" },
{ endpoint: "/set/data/selected_translation_compute_device", ns: configs, hook_name: "useTranslation", method_name: "setSuccessSelectedTranslationComputeDevice" }, // { endpoint: "/set/data/selected_translation_compute_device", ns: configs, hook_name: "useTranslation", method_name: "setSuccessSelectedTranslationComputeDevice" },
// Transcription // // Transcription
// Transcription (Mic) // // Transcription (Mic)
{ endpoint: "/get/data/mic_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateMicRecordTimeout" }, // { endpoint: "/get/data/mic_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateMicRecordTimeout" },
{ endpoint: "/set/data/mic_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "setSuccessMicRecordTimeout" }, // { 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: "/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: "/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: "/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: "/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: "getSuccessMicWordFilterList" }, // { endpoint: "/get/data/mic_word_filter", ns: configs, hook_name: "useTranscription", method_name: "getSuccessMicWordFilterList" },
{ endpoint: "/set/data/mic_word_filter", ns: configs, hook_name: "useTranscription", method_name: "setSuccessMicWordFilterList" }, // { endpoint: "/set/data/mic_word_filter", ns: configs, hook_name: "useTranscription", method_name: "setSuccessMicWordFilterList" },
// Transcription (Speaker) // // Transcription (Speaker)
{ endpoint: "/get/data/speaker_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerRecordTimeout" }, // { endpoint: "/get/data/speaker_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerRecordTimeout" },
{ endpoint: "/set/data/speaker_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSpeakerRecordTimeout" }, // { 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: "/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: "/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: "/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" }, // { endpoint: "/set/data/speaker_max_phrases", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSpeakerMaxWords" },
// Transcription (AI Models) // // Transcription (AI Models)
{ endpoint: "/get/data/selected_transcription_engine", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionEngine" }, // { endpoint: "/get/data/selected_transcription_engine", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionEngine" },
{ endpoint: "/set/data/selected_transcription_engine", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedTranscriptionEngine" }, // { endpoint: "/set/data/selected_transcription_engine", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedTranscriptionEngine" },
{ endpoint: "/get/data/selectable_whisper_weight_type_dict", ns: configs, hook_name: "useTranscription", method_name: "updateDownloadedWhisperWeightTypeStatus" }, // { endpoint: "/get/data/selectable_whisper_weight_type_dict", ns: configs, hook_name: "useTranscription", method_name: "updateDownloadedWhisperWeightTypeStatus" },
{ endpoint: "/get/data/whisper_weight_type", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperWeightType" }, // { endpoint: "/get/data/whisper_weight_type", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperWeightType" },
{ endpoint: "/set/data/whisper_weight_type", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedWhisperWeightType" }, // { endpoint: "/set/data/whisper_weight_type", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedWhisperWeightType" },
{ endpoint: "/run/selected_transcription_compute_type", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionComputeType" }, // { endpoint: "/run/selected_transcription_compute_type", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionComputeType" },
{ endpoint: "/get/data/selected_transcription_compute_type", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionComputeType" }, // { endpoint: "/get/data/selected_transcription_compute_type", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionComputeType" },
{ endpoint: "/set/data/selected_transcription_compute_type", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedTranscriptionComputeType" }, // { endpoint: "/set/data/selected_transcription_compute_type", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedTranscriptionComputeType" },
{ endpoint: "/run/downloaded_whisper_weight", ns: configs, hook_name: "useTranscription", method_name: "downloadedWhisperWeightType" }, // { endpoint: "/run/downloaded_whisper_weight", ns: configs, hook_name: "useTranscription", method_name: "downloadedWhisperWeightType" },
{ endpoint: "/run/download_whisper_weight", ns: null, hook_name: null, method_name: null }, // { endpoint: "/run/download_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: "/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: "updateSelectableTranscriptionComputeDeviceList_FromBackend" }, // { endpoint: "/get/data/transcription_compute_device_list", ns: configs, hook_name: "useTranscription", method_name: "updateSelectableTranscriptionComputeDeviceList_FromBackend" },
{ endpoint: "/get/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionComputeDevice" }, // { endpoint: "/get/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionComputeDevice" },
{ endpoint: "/set/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedTranscriptionComputeDevice" }, // { endpoint: "/set/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedTranscriptionComputeDevice" },
// Transcription (Advanced) // // Transcription (Advanced)
{ endpoint: "/get/data/mic_avg_logprob", ns: configs, hook_name: "useTranscription", method_name: "updateMicAvgLogprob" }, // { endpoint: "/get/data/mic_avg_logprob", ns: configs, hook_name: "useTranscription", method_name: "updateMicAvgLogprob" },
{ endpoint: "/set/data/mic_avg_logprob", ns: configs, hook_name: "useTranscription", method_name: "setSuccessMicAvgLogprob" }, // { endpoint: "/set/data/mic_avg_logprob", ns: configs, hook_name: "useTranscription", method_name: "setSuccessMicAvgLogprob" },
{ endpoint: "/get/data/mic_no_speech_prob", ns: configs, hook_name: "useTranscription", method_name: "updateMicNoSpeechProb" }, // { endpoint: "/get/data/mic_no_speech_prob", ns: configs, hook_name: "useTranscription", method_name: "updateMicNoSpeechProb" },
{ endpoint: "/set/data/mic_no_speech_prob", ns: configs, hook_name: "useTranscription", method_name: "setSuccessMicNoSpeechProb" }, // { endpoint: "/set/data/mic_no_speech_prob", ns: configs, hook_name: "useTranscription", method_name: "setSuccessMicNoSpeechProb" },
{ endpoint: "/get/data/speaker_avg_logprob", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerAvgLogprob" }, // { endpoint: "/get/data/speaker_avg_logprob", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerAvgLogprob" },
{ endpoint: "/set/data/speaker_avg_logprob", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSpeakerAvgLogprob" }, // { endpoint: "/set/data/speaker_avg_logprob", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSpeakerAvgLogprob" },
{ endpoint: "/get/data/speaker_no_speech_prob", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerNoSpeechProb" }, // { endpoint: "/get/data/speaker_no_speech_prob", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerNoSpeechProb" },
{ endpoint: "/set/data/speaker_no_speech_prob", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSpeakerNoSpeechProb" }, // { endpoint: "/set/data/speaker_no_speech_prob", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSpeakerNoSpeechProb" },
// VR // VR
{ endpoint: "/get/data/overlay_small_log", ns: configs, hook_name: "useVr", method_name: "updateIsEnabledOverlaySmallLog" }, { endpoint: "/get/data/overlay_small_log", ns: configs, hook_name: "useVr", method_name: "updateIsEnabledOverlaySmallLog" },
@@ -263,49 +264,49 @@ export const ROUTE_META_LIST = [
{ endpoint: "/run/send_text_overlay", ns: null, hook_name: null, method_name: null }, { endpoint: "/run/send_text_overlay", ns: null, hook_name: null, method_name: null },
// Others // // Others
{ endpoint: "/get/data/auto_clear_message_box", ns: configs, hook_name: "useOthers", method_name: "updateEnableAutoClearMessageInputBox" }, // { endpoint: "/get/data/auto_clear_message_box", ns: configs, hook_name: "useOthers", method_name: "updateEnableAutoClearMessageInputBox" },
{ endpoint: "/set/enable/auto_clear_message_box", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableAutoClearMessageInputBox" }, // { 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: "/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: "/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/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: "/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: "/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/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: "/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: "getSuccessEnableVrcMicMuteSync" }, // { endpoint: "/get/data/vrc_mic_mute_sync", ns: configs, hook_name: "useOthers", method_name: "getSuccessEnableVrcMicMuteSync" },
{ endpoint: "/set/enable/vrc_mic_mute_sync", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableVrcMicMuteSync" }, // { 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: "/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: "/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/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: "/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: "/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/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: "/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: "/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/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" }, // { endpoint: "/set/disable/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" }, // { endpoint: "/set/disable/notification_vrc_sfx", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableNotificationVrcSfx" },
{ endpoint: "/get/data/send_message_format_parts", ns: configs, hook_name: "useOthers", method_name: "updateSendMessageFormatParts" }, // { endpoint: "/get/data/send_message_format_parts", ns: configs, hook_name: "useOthers", method_name: "updateSendMessageFormatParts" },
{ endpoint: "/set/data/send_message_format_parts", ns: configs, hook_name: "useOthers", method_name: "setSuccessSendMessageFormatParts" }, // { endpoint: "/set/data/send_message_format_parts", ns: configs, hook_name: "useOthers", method_name: "setSuccessSendMessageFormatParts" },
{ endpoint: "/get/data/received_message_format_parts", ns: configs, hook_name: "useOthers", method_name: "updateReceivedMessageFormatParts" }, // { endpoint: "/get/data/received_message_format_parts", ns: configs, hook_name: "useOthers", method_name: "updateReceivedMessageFormatParts" },
{ endpoint: "/set/data/received_message_format_parts", ns: configs, hook_name: "useOthers", method_name: "setSuccessReceivedMessageFormatParts" }, // { endpoint: "/set/data/received_message_format_parts", ns: configs, hook_name: "useOthers", method_name: "setSuccessReceivedMessageFormatParts" },
{ endpoint: "/get/data/convert_message_to_romaji", ns: configs, hook_name: "useOthers", method_name: "updateConvertMessageToRomaji" }, // { endpoint: "/get/data/convert_message_to_romaji", ns: configs, hook_name: "useOthers", method_name: "updateConvertMessageToRomaji" },
{ endpoint: "/set/enable/convert_message_to_romaji", ns: configs, hook_name: "useOthers", method_name: "setSuccessConvertMessageToRomaji" }, // { endpoint: "/set/enable/convert_message_to_romaji", ns: configs, hook_name: "useOthers", method_name: "setSuccessConvertMessageToRomaji" },
{ endpoint: "/set/disable/convert_message_to_romaji", ns: configs, hook_name: "useOthers", method_name: "setSuccessConvertMessageToRomaji" }, // { endpoint: "/set/disable/convert_message_to_romaji", ns: configs, hook_name: "useOthers", method_name: "setSuccessConvertMessageToRomaji" },
{ endpoint: "/get/data/convert_message_to_hiragana", ns: configs, hook_name: "useOthers", method_name: "updateConvertMessageToHiragana" }, // { endpoint: "/get/data/convert_message_to_hiragana", ns: configs, hook_name: "useOthers", method_name: "updateConvertMessageToHiragana" },
{ endpoint: "/set/enable/convert_message_to_hiragana", ns: configs, hook_name: "useOthers", method_name: "setSuccessConvertMessageToHiragana" }, // { endpoint: "/set/enable/convert_message_to_hiragana", ns: configs, hook_name: "useOthers", method_name: "setSuccessConvertMessageToHiragana" },
{ endpoint: "/set/disable/convert_message_to_hiragana", ns: configs, hook_name: "useOthers", method_name: "setSuccessConvertMessageToHiragana" }, // { endpoint: "/set/disable/convert_message_to_hiragana", ns: configs, hook_name: "useOthers", method_name: "setSuccessConvertMessageToHiragana" },
// Hotkeys // Hotkeys
{ endpoint: "/get/data/hotkeys", ns: configs, hook_name: "useHotkeys", method_name: "updateHotkeys" }, { endpoint: "/get/data/hotkeys", ns: configs, hook_name: "useHotkeys", method_name: "updateHotkeys" },
@@ -315,29 +316,25 @@ export const ROUTE_META_LIST = [
{ endpoint: "/get/data/plugins_status", ns: configs, hook_name: "usePlugins", method_name: "updateSavedPluginsStatus" }, { 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" }, { endpoint: "/set/data/plugins_status", ns: configs, hook_name: "usePlugins", method_name: "setSuccessSavedPluginsStatus" },
// Advanced Settings // // Advanced Settings
{ endpoint: "/get/data/osc_ip_address", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateOscIpAddress" }, // { endpoint: "/get/data/osc_ip_address", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateOscIpAddress" },
{ endpoint: "/set/data/osc_ip_address", ns: configs, hook_name: "useAdvancedSettings", method_name: "setSuccessOscIpAddress" }, // { 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: "/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: "/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: "/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/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: "/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: "/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: "/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: "/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" }, // { endpoint: "/set/data/websocket_port", ns: configs, hook_name: "useAdvancedSettings", method_name: "setSuccessWebsocketPort" },
// Not Implemented Yet... // // 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/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"]) { 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"])
]; ];
@@ -346,6 +343,8 @@ export const useReceiveRoutes = () => {
const { errorHandling_Backend } = _useBackendErrorHandling(); const { errorHandling_Backend } = _useBackendErrorHandling();
const { updateIsBackendReady } = common.useIsBackendReady(); const { updateIsBackendReady } = common.useIsBackendReady();
const ROUTE_META_LIST = buildRouteMetaList();
const handleInvalidEndpoint = (parsed_data) => { const handleInvalidEndpoint = (parsed_data) => {
console.error(`Invalid endpoint: ${parsed_data.endpoint}\nresult: ${JSON.stringify(parsed_data.result)}`); console.error(`Invalid endpoint: ${parsed_data.endpoint}\nresult: ${JSON.stringify(parsed_data.result)}`);
}; };
@@ -353,7 +352,13 @@ export const useReceiveRoutes = () => {
const hook_results = {}; const hook_results = {};
ROUTE_META_LIST.forEach(({ ns, hook_name }) => { ROUTE_META_LIST.forEach(({ ns, hook_name }) => {
if (ns && hook_name && !(hook_name in hook_results)) { if (ns && hook_name && !(hook_name in hook_results)) {
hook_results[hook_name] = ns[hook_name](); const hookFn = ns[hook_name];
if (typeof hookFn === "function") {
hook_results[hook_name] = hookFn();
} else {
console.warn(`Hook not found on namespace: ${hook_name}`);
hook_results[hook_name] = {};
}
} }
}); });
@@ -364,7 +369,7 @@ export const useReceiveRoutes = () => {
const result_obj = hook_results[hook_name] || {}; const result_obj = hook_results[hook_name] || {};
const fn = result_obj[method_name]; const fn = result_obj[method_name];
if (fn === undefined && method_name !== null) { if (fn === undefined && method_name !== null) {
console.error("Method not found.", {endpoint, hook_name, method_name, result_obj, fn}); console.error("Method not found.", { endpoint, hook_name, method_name, result_obj, fn });
} }
return [endpoint, typeof fn === "function" ? fn : noop]; return [endpoint, typeof fn === "function" ? fn : noop];
}) })
@@ -386,7 +391,6 @@ export const useReceiveRoutes = () => {
return; return;
} }
switch (status) { switch (status) {
case 200: case 200:
if (endpoint in routes) { if (endpoint in routes) {
@@ -425,3 +429,167 @@ export const useReceiveRoutes = () => {
const style_348 = [ const style_348 = [
"color: gray", "color: gray",
].join(";"); ].join(";");
// Automatically set 'configs' for now.(This is only used in config)
const buildRouteMetaList = () => {
const namespace_module = configs;
const generated = [];
for (const s of SETTINGS_ARRAY) {
const category = s.Category;
const base = s.Base_Name;
const ep = s.base_endpoint_name;
const hookName = `use${category}`;
const setSuccessMethodName = `setSuccess${base}`;
const updateFromBackendMethodName = `updateFromBackend${base}`;
if (s.add_endpoint_run_array?.includes("from_backend")) {
generated.push({
endpoint: `/run/${ep}`,
ns: namespace_module,
hook_name: hookName,
method_name: updateFromBackendMethodName,
});
}
generated.push({
endpoint: `/get/data/${ep}`,
ns: namespace_module,
hook_name: hookName,
method_name: updateFromBackendMethodName,
});
if (s.logics_template_id !== "get_list") {
generated.push({
endpoint: `/set/data/${ep}`,
ns: namespace_module,
hook_name: hookName,
method_name: setSuccessMethodName,
});
}
if (s.logics_template_id === "toggle_enable_disable" || s.ui_template_id === "toggle") {
generated.push({
endpoint: `/set/enable/${ep}`,
ns: namespace_module,
hook_name: hookName,
method_name: setSuccessMethodName,
});
generated.push({
endpoint: `/set/disable/${ep}`,
ns: namespace_module,
hook_name: hookName,
method_name: setSuccessMethodName,
});
}
if (s.logics_template_id === "weight_download_status") {
generated.push({
endpoint: `/get/data/selectable_${ep}_type_dict`,
ns: namespace_module,
hook_name: hookName,
method_name: `updateDownloaded${base}`,
});
generated.push({
endpoint: `/set/data/${ep}`,
ns: namespace_module,
hook_name: hookName,
method_name: setSuccessMethodName,
});
generated.push({
endpoint: `/run/download_progress_${ep}`,
ns: namespace_module,
hook_name: hookName,
method_name: `updateDownloadProgress${base}`,
});
generated.push({
endpoint: `/run/downloaded_${ep}`,
ns: namespace_module,
hook_name: hookName,
method_name: `downloaded${base}`,
});
generated.push({
endpoint: `/run/pending_${ep}`,
ns: namespace_module,
hook_name: hookName,
method_name: `pending${base}`,
});
generated.push({
endpoint: `/run/download_${ep}`,
ns: namespace_module,
hook_name: hookName,
method_name: `downloaded${base}`,
});
generated.push({
endpoint: `/get/data/${ep}`,
ns: namespace_module,
hook_name: hookName,
method_name: updateFromBackendMethodName,
});
continue;
}
}
const mergedMap = new Map();
for (const item of STATIC_ROUTE_META_LIST) {
if (!item || !item.endpoint) continue;
mergedMap.set(item.endpoint, {
endpoint: item.endpoint,
ns: item.ns ?? null,
hook_name: item.hook_name ?? null,
method_name: item.method_name ?? null,
});
}
for (const gen of generated) {
const ep = gen.endpoint;
const existing = mergedMap.get(ep);
if (!existing) {
mergedMap.set(ep, { ...gen });
continue;
}
const merged = {
endpoint: ep,
ns: existing.ns ?? gen.ns ?? null,
hook_name: existing.hook_name ?? gen.hook_name ?? null,
method_name: existing.method_name ?? gen.method_name ?? null,
};
mergedMap.set(ep, merged);
}
const mergedList = [];
for (const item of STATIC_ROUTE_META_LIST) {
if (!item || !item.endpoint) continue;
const merged = mergedMap.get(item.endpoint);
if (merged) {
mergedList.push(merged);
mergedMap.delete(item.endpoint);
}
}
for (const gen of generated) {
const ep = gen.endpoint;
if (mergedMap.has(ep)) {
mergedList.push(mergedMap.get(ep));
mergedMap.delete(ep);
}
}
for (const remaining of mergedMap.values()) {
mergedList.push(remaining);
}
return mergedList;
};

View File

@@ -33,6 +33,7 @@ const generatePropertyNames = (base_name) => ({
add: `add${base_name}`, add: `add${base_name}`,
}); });
export const dynamicStoreRegistry = {};
export const createAtomWithHook = (initialValue, base_name, options) => { export const createAtomWithHook = (initialValue, base_name, options) => {
const property_names = generatePropertyNames(base_name); const property_names = generatePropertyNames(base_name);
@@ -109,10 +110,58 @@ export const createAtomWithHook = (initialValue, base_name, options) => {
}; };
}; };
// dynamic registry に登録(キー名は既存の命名規約に合わせる)
try {
const hookName = `useStore_${base_name}`;
const atomName = `Atom_${base_name}`;
dynamicStoreRegistry[hookName] = useHook;
dynamicStoreRegistry[atomName] = atomInstance;
} catch (e) {
// 登録失敗でも処理中断しない(開発用に console.warn してもよい)
// console.warn("dynamic registration failed for", base_name, e);
}
return { atomInstance, useHook }; return { atomInstance, useHook };
}; };
/**
* getStoreHook(baseName)
* dynamicStoreRegistry から useStore_<baseName> を返すヘルパー。
* 存在しなければ undefined を返す。
*/
export const getStoreHook = (baseName) => {
const hookName = `useStore_${baseName}`;
return dynamicStoreRegistry[hookName];
};
/**
* registerMany(settingsArray)
* settingsArray を走査して createAtomWithHook を呼び出し、
* dynamicStoreRegistry に登録します。
*
* settingsArray の各要素は少なくとも Base_Name と default_value を持つことを期待します。
*/
export const registerMany = (settingsArray = []) => {
for (const s of settingsArray) {
try {
// 既に同名の atom が registry にあればスキップ(上書き防止)
const hookName = `useStore_${s.Base_Name}`;
if (dynamicStoreRegistry[hookName]) {
continue;
}
// createAtomWithHook が registry に登録してくれる
createAtomWithHook(s.default_value, s.Base_Name, s.options || {});
} catch (e) {
// 個別エラーは無視して続行
// console.warn("registerMany failed for", s.Base_Name, e);
}
}
};
// Common // Common
export const { atomInstance: Atom_IsBackendReady, useHook: useStore_IsBackendReady } = createAtomWithHook(false, "IsBackendReady"); export const { atomInstance: Atom_IsBackendReady, useHook: useStore_IsBackendReady } = createAtomWithHook(false, "IsBackendReady");
export const { atomInstance: Atom_IsVrctAvailable, useHook: useStore_IsVrctAvailable } = createAtomWithHook(true, "IsVrctAvailable"); export const { atomInstance: Atom_IsVrctAvailable, useHook: useStore_IsVrctAvailable } = createAtomWithHook(true, "IsVrctAvailable");
@@ -178,16 +227,16 @@ export const { atomInstance: Atom_SettingBoxScrollPosition, useHook: useStore_Se
export const { atomInstance: Atom_IsOpenedDropdownMenu, useHook: useStore_IsOpenedDropdownMenu } = createAtomWithHook("", "IsOpenedDropdownMenu"); export const { atomInstance: Atom_IsOpenedDropdownMenu, useHook: useStore_IsOpenedDropdownMenu } = createAtomWithHook("", "IsOpenedDropdownMenu");
// Device // Device
export const { atomInstance: Atom_EnableAutoMicSelect, useHook: useStore_EnableAutoMicSelect } = createAtomWithHook(true, "EnableAutoMicSelect"); // export const { atomInstance: Atom_EnableAutoMicSelect, useHook: useStore_EnableAutoMicSelect } = createAtomWithHook(true, "EnableAutoMicSelect");
export const { atomInstance: Atom_EnableAutoSpeakerSelect, useHook: useStore_EnableAutoSpeakerSelect } = createAtomWithHook(true, "EnableAutoSpeakerSelect"); // export const { atomInstance: Atom_EnableAutoSpeakerSelect, useHook: useStore_EnableAutoSpeakerSelect } = createAtomWithHook(true, "EnableAutoSpeakerSelect");
export const { atomInstance: Atom_MicHostList, useHook: useStore_MicHostList } = createAtomWithHook({}, "MicHostList"); // export const { atomInstance: Atom_MicHostList, useHook: useStore_MicHostList } = createAtomWithHook({}, "MicHostList");
export const { atomInstance: Atom_SelectedMicHost, useHook: useStore_SelectedMicHost } = createAtomWithHook("Nothing Selected", "SelectedMicHost"); // export const { atomInstance: Atom_SelectedMicHost, useHook: useStore_SelectedMicHost } = createAtomWithHook("Nothing Selected", "SelectedMicHost");
export const { atomInstance: Atom_MicDeviceList, useHook: useStore_MicDeviceList } = createAtomWithHook({}, "MicDeviceList"); // export const { atomInstance: Atom_MicDeviceList, useHook: useStore_MicDeviceList } = createAtomWithHook({}, "MicDeviceList");
export const { atomInstance: Atom_SelectedMicDevice, useHook: useStore_SelectedMicDevice } = createAtomWithHook("Nothing Selected", "SelectedMicDevice"); // export const { atomInstance: Atom_SelectedMicDevice, useHook: useStore_SelectedMicDevice } = createAtomWithHook("Nothing Selected", "SelectedMicDevice");
export const { atomInstance: Atom_SpeakerDeviceList, useHook: useStore_SpeakerDeviceList } = createAtomWithHook({}, "SpeakerDeviceList"); // export const { atomInstance: Atom_SpeakerDeviceList, useHook: useStore_SpeakerDeviceList } = createAtomWithHook({}, "SpeakerDeviceList");
export const { atomInstance: Atom_SelectedSpeakerDevice, useHook: useStore_SelectedSpeakerDevice } = createAtomWithHook("Nothing Selected", "SelectedSpeakerDevice"); // export const { atomInstance: Atom_SelectedSpeakerDevice, useHook: useStore_SelectedSpeakerDevice } = createAtomWithHook("Nothing Selected", "SelectedSpeakerDevice");
export const { atomInstance: Atom_MicVolume, useHook: useStore_MicVolume } = createAtomWithHook(0, "MicVolume"); export const { atomInstance: Atom_MicVolume, useHook: useStore_MicVolume } = createAtomWithHook(0, "MicVolume");
export const { atomInstance: Atom_SpeakerVolume, useHook: useStore_SpeakerVolume } = createAtomWithHook(0, "SpeakerVolume"); export const { atomInstance: Atom_SpeakerVolume, useHook: useStore_SpeakerVolume } = createAtomWithHook(0, "SpeakerVolume");
@@ -195,57 +244,57 @@ export const { atomInstance: Atom_SpeakerVolume, useHook: useStore_SpeakerVolume
export const { atomInstance: Atom_MicThresholdCheckStatus, useHook: useStore_MicThresholdCheckStatus } = createAtomWithHook(false, "MicThresholdCheckStatus", {is_state_ok: true}); export const { atomInstance: Atom_MicThresholdCheckStatus, useHook: useStore_MicThresholdCheckStatus } = createAtomWithHook(false, "MicThresholdCheckStatus", {is_state_ok: true});
export const { atomInstance: Atom_SpeakerThresholdCheckStatus, useHook: useStore_SpeakerThresholdCheckStatus } = createAtomWithHook(false, "SpeakerThresholdCheckStatus", {is_state_ok: true}); export const { atomInstance: Atom_SpeakerThresholdCheckStatus, useHook: useStore_SpeakerThresholdCheckStatus } = createAtomWithHook(false, "SpeakerThresholdCheckStatus", {is_state_ok: true});
export const { atomInstance: Atom_MicThreshold, useHook: useStore_MicThreshold } = createAtomWithHook(0, "MicThreshold"); // export const { atomInstance: Atom_MicThreshold, useHook: useStore_MicThreshold } = createAtomWithHook(0, "MicThreshold");
export const { atomInstance: Atom_SpeakerThreshold, useHook: useStore_SpeakerThreshold } = createAtomWithHook(0, "SpeakerThreshold"); // export const { atomInstance: Atom_SpeakerThreshold, useHook: useStore_SpeakerThreshold } = createAtomWithHook(0, "SpeakerThreshold");
export const { atomInstance: Atom_EnableAutomaticMicThreshold, useHook: useStore_EnableAutomaticMicThreshold } = createAtomWithHook(false, "EnableAutomaticMicThreshold"); // export const { atomInstance: Atom_EnableAutomaticMicThreshold, useHook: useStore_EnableAutomaticMicThreshold } = createAtomWithHook(false, "EnableAutomaticMicThreshold");
export const { atomInstance: Atom_EnableAutomaticSpeakerThreshold, useHook: useStore_EnableAutomaticSpeakerThreshold } = createAtomWithHook(false, "EnableAutomaticSpeakerThreshold"); // export const { atomInstance: Atom_EnableAutomaticSpeakerThreshold, useHook: useStore_EnableAutomaticSpeakerThreshold } = createAtomWithHook(false, "EnableAutomaticSpeakerThreshold");
// Appearance // Appearance
export const { atomInstance: Atom_UiLanguage, useHook: useStore_UiLanguage } = createAtomWithHook("en", "UiLanguage"); // export const { atomInstance: Atom_UiLanguage, useHook: useStore_UiLanguage } = createAtomWithHook("en", "UiLanguage");
export const { atomInstance: Atom_UiScaling, useHook: useStore_UiScaling } = createAtomWithHook(100, "UiScaling"); // 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_MessageLogUiScaling, useHook: useStore_MessageLogUiScaling } = createAtomWithHook(100, "MessageLogUiScaling");
export const { atomInstance: Atom_SendMessageButtonType, useHook: useStore_SendMessageButtonType } = createAtomWithHook("show", "SendMessageButtonType"); // 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_ShowResendButton, useHook: useStore_ShowResendButton } = createAtomWithHook(false, "ShowResendButton");
export const { atomInstance: Atom_SelectedFontFamily, useHook: useStore_SelectedFontFamily } = createAtomWithHook("Yu Gothic UI", "SelectedFontFamily"); // 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_SelectableFontFamilyList, useHook: useStore_SelectableFontFamilyList } = createAtomWithHook({}, "SelectableFontFamilyList");
export const { atomInstance: Atom_Transparency, useHook: useStore_Transparency } = createAtomWithHook(100, "Transparency"); // export const { atomInstance: Atom_Transparency, useHook: useStore_Transparency } = createAtomWithHook(100, "Transparency");
export const { atomInstance: Atom_IsOpenedMicWordFilterList, useHook: useStore_IsOpenedMicWordFilterList } = createAtomWithHook(false, "IsOpenedMicWordFilterList"); export const { atomInstance: Atom_IsOpenedMicWordFilterList, useHook: useStore_IsOpenedMicWordFilterList } = createAtomWithHook(false, "IsOpenedMicWordFilterList");
export const { atomInstance: Atom_MicWordFilterList, useHook: useStore_MicWordFilterList } = createAtomWithHook([], "MicWordFilterList"); // export const { atomInstance: Atom_MicWordFilterList, useHook: useStore_MicWordFilterList } = createAtomWithHook([], "MicWordFilterList");
// Translation // Translation
export const { atomInstance: Atom_DeepLAuthKey, useHook: useStore_DeepLAuthKey } = createAtomWithHook(null, "DeepLAuthKey"); // export const { atomInstance: Atom_DeepLAuthKey, useHook: useStore_DeepLAuthKey } = createAtomWithHook(null, "DeepLAuthKey");
export const { atomInstance: Atom_SelectedCTranslate2WeightType, useHook: useStore_SelectedCTranslate2WeightType } = createAtomWithHook("", "SelectedCTranslate2WeightType"); // export const { atomInstance: Atom_SelectedCTranslate2WeightType, useHook: useStore_SelectedCTranslate2WeightType } = createAtomWithHook("", "SelectedCTranslate2WeightType");
export const { atomInstance: Atom_CTranslate2WeightTypeStatus, useHook: useStore_CTranslate2WeightTypeStatus } = createAtomWithHook(ctranslate2_weight_type_status, "CTranslate2WeightTypeStatus"); // export const { atomInstance: Atom_CTranslate2WeightTypeStatus, useHook: useStore_CTranslate2WeightTypeStatus } = createAtomWithHook(ctranslate2_weight_type_status, "CTranslate2WeightTypeStatus");
export const { atomInstance: Atom_SelectableTranslationComputeDeviceList, useHook: useStore_SelectableTranslationComputeDeviceList } = createAtomWithHook({}, "SelectableTranslationComputeDeviceList"); // export const { atomInstance: Atom_SelectableTranslationComputeDeviceList, useHook: useStore_SelectableTranslationComputeDeviceList } = createAtomWithHook({}, "SelectableTranslationComputeDeviceList");
export const { atomInstance: Atom_SelectedTranslationComputeDevice, useHook: useStore_SelectedTranslationComputeDevice } = createAtomWithHook("", "SelectedTranslationComputeDevice"); // export const { atomInstance: Atom_SelectedTranslationComputeDevice, useHook: useStore_SelectedTranslationComputeDevice } = createAtomWithHook("", "SelectedTranslationComputeDevice");
export const { atomInstance: Atom_SelectedTranslationComputeType, useHook: useStore_SelectedTranslationComputeType } = createAtomWithHook("", "SelectedTranslationComputeType"); // export const { atomInstance: Atom_SelectedTranslationComputeType, useHook: useStore_SelectedTranslationComputeType } = createAtomWithHook("", "SelectedTranslationComputeType");
// Transcription // Transcription
export const { atomInstance: Atom_MicRecordTimeout, useHook: useStore_MicRecordTimeout } = createAtomWithHook(0, "MicRecordTimeout"); // export const { atomInstance: Atom_MicRecordTimeout, useHook: useStore_MicRecordTimeout } = createAtomWithHook(0, "MicRecordTimeout");
export const { atomInstance: Atom_MicPhraseTimeout, useHook: useStore_MicPhraseTimeout } = createAtomWithHook(0, "MicPhraseTimeout"); // export const { atomInstance: Atom_MicPhraseTimeout, useHook: useStore_MicPhraseTimeout } = createAtomWithHook(0, "MicPhraseTimeout");
export const { atomInstance: Atom_MicMaxWords, useHook: useStore_MicMaxWords } = createAtomWithHook(0, "MicMaxWords"); // export const { atomInstance: Atom_MicMaxWords, useHook: useStore_MicMaxWords } = createAtomWithHook(0, "MicMaxWords");
export const { atomInstance: Atom_SpeakerRecordTimeout, useHook: useStore_SpeakerRecordTimeout } = createAtomWithHook(0, "SpeakerRecordTimeout"); // export const { atomInstance: Atom_SpeakerRecordTimeout, useHook: useStore_SpeakerRecordTimeout } = createAtomWithHook(0, "SpeakerRecordTimeout");
export const { atomInstance: Atom_SpeakerPhraseTimeout, useHook: useStore_SpeakerPhraseTimeout } = createAtomWithHook(0, "SpeakerPhraseTimeout"); // export const { atomInstance: Atom_SpeakerPhraseTimeout, useHook: useStore_SpeakerPhraseTimeout } = createAtomWithHook(0, "SpeakerPhraseTimeout");
export const { atomInstance: Atom_SpeakerMaxWords, useHook: useStore_SpeakerMaxWords } = createAtomWithHook(0, "SpeakerMaxWords"); // export const { atomInstance: Atom_SpeakerMaxWords, useHook: useStore_SpeakerMaxWords } = createAtomWithHook(0, "SpeakerMaxWords");
export const { atomInstance: Atom_SelectedWhisperWeightType, useHook: useStore_SelectedWhisperWeightType } = createAtomWithHook("", "SelectedWhisperWeightType"); // export const { atomInstance: Atom_SelectedWhisperWeightType, useHook: useStore_SelectedWhisperWeightType } = createAtomWithHook("", "SelectedWhisperWeightType");
export const { atomInstance: Atom_WhisperWeightTypeStatus, useHook: useStore_WhisperWeightTypeStatus } = createAtomWithHook(whisper_weight_type_status, "WhisperWeightTypeStatus"); // export const { atomInstance: Atom_WhisperWeightTypeStatus, useHook: useStore_WhisperWeightTypeStatus } = createAtomWithHook(whisper_weight_type_status, "WhisperWeightTypeStatus");
export const { atomInstance: Atom_SelectedTranscriptionEngine, useHook: useStore_SelectedTranscriptionEngine } = createAtomWithHook(whisper_weight_type_status, "SelectedTranscriptionEngine"); // export const { atomInstance: Atom_SelectedTranscriptionEngine, useHook: useStore_SelectedTranscriptionEngine } = createAtomWithHook(whisper_weight_type_status, "SelectedTranscriptionEngine");
export const { atomInstance: Atom_SelectableTranscriptionComputeDeviceList, useHook: useStore_SelectableTranscriptionComputeDeviceList } = createAtomWithHook({}, "SelectableTranscriptionComputeDeviceList"); // export const { atomInstance: Atom_SelectableTranscriptionComputeDeviceList, useHook: useStore_SelectableTranscriptionComputeDeviceList } = createAtomWithHook({}, "SelectableTranscriptionComputeDeviceList");
export const { atomInstance: Atom_SelectedTranscriptionComputeDevice, useHook: useStore_SelectedTranscriptionComputeDevice } = createAtomWithHook("", "SelectedTranscriptionComputeDevice"); // export const { atomInstance: Atom_SelectedTranscriptionComputeDevice, useHook: useStore_SelectedTranscriptionComputeDevice } = createAtomWithHook("", "SelectedTranscriptionComputeDevice");
export const { atomInstance: Atom_SelectedTranscriptionComputeType, useHook: useStore_SelectedTranscriptionComputeType } = createAtomWithHook("", "SelectedTranscriptionComputeType"); // export const { atomInstance: Atom_SelectedTranscriptionComputeType, useHook: useStore_SelectedTranscriptionComputeType } = createAtomWithHook("", "SelectedTranscriptionComputeType");
export const { atomInstance: Atom_MicAvgLogprob, useHook: useStore_MicAvgLogprob } = createAtomWithHook(-0.8, "MicAvgLogprob"); // export const { atomInstance: Atom_MicAvgLogprob, useHook: useStore_MicAvgLogprob } = createAtomWithHook(-0.8, "MicAvgLogprob");
export const { atomInstance: Atom_MicNoSpeechProb, useHook: useStore_MicNoSpeechProb } = createAtomWithHook(0.6, "MicNoSpeechProb"); // export const { atomInstance: Atom_MicNoSpeechProb, useHook: useStore_MicNoSpeechProb } = createAtomWithHook(0.6, "MicNoSpeechProb");
export const { atomInstance: Atom_SpeakerAvgLogprob, useHook: useStore_SpeakerAvgLogprob } = createAtomWithHook(-0.8, "SpeakerAvgLogprob"); // export const { atomInstance: Atom_SpeakerAvgLogprob, useHook: useStore_SpeakerAvgLogprob } = createAtomWithHook(-0.8, "SpeakerAvgLogprob");
export const { atomInstance: Atom_SpeakerNoSpeechProb, useHook: useStore_SpeakerNoSpeechProb } = createAtomWithHook(0.6, "SpeakerNoSpeechProb"); // export const { atomInstance: Atom_SpeakerNoSpeechProb, useHook: useStore_SpeakerNoSpeechProb } = createAtomWithHook(0.6, "SpeakerNoSpeechProb");
// VR // VR
@@ -276,45 +325,45 @@ export const { atomInstance: Atom_IsEnabledOverlayLargeLog, useHook: useStore_Is
export const { atomInstance: Atom_OverlayShowOnlyTranslatedMessages, useHook: useStore_OverlayShowOnlyTranslatedMessages } = createAtomWithHook(false, "OverlayShowOnlyTranslatedMessages"); export const { atomInstance: Atom_OverlayShowOnlyTranslatedMessages, useHook: useStore_OverlayShowOnlyTranslatedMessages } = createAtomWithHook(false, "OverlayShowOnlyTranslatedMessages");
// Others // Others
export const { atomInstance: Atom_EnableAutoClearMessageInputBox, useHook: useStore_EnableAutoClearMessageInputBox } = createAtomWithHook(true, "EnableAutoClearMessageInputBox"); // export const { atomInstance: Atom_EnableAutoClearMessageInputBox, useHook: useStore_EnableAutoClearMessageInputBox } = createAtomWithHook(true, "EnableAutoClearMessageInputBox");
export const { atomInstance: Atom_EnableSendOnlyTranslatedMessages, useHook: useStore_EnableSendOnlyTranslatedMessages } = createAtomWithHook(false, "EnableSendOnlyTranslatedMessages"); // export const { atomInstance: Atom_EnableSendOnlyTranslatedMessages, useHook: useStore_EnableSendOnlyTranslatedMessages } = createAtomWithHook(false, "EnableSendOnlyTranslatedMessages");
export const { atomInstance: Atom_EnableAutoExportMessageLogs, useHook: useStore_EnableAutoExportMessageLogs } = createAtomWithHook(false, "EnableAutoExportMessageLogs"); // export const { atomInstance: Atom_EnableAutoExportMessageLogs, useHook: useStore_EnableAutoExportMessageLogs } = createAtomWithHook(false, "EnableAutoExportMessageLogs");
export const { atomInstance: Atom_EnableVrcMicMuteSync, useHook: useStore_EnableVrcMicMuteSync } = createAtomWithHook(false, "EnableVrcMicMuteSync"); // export const { atomInstance: Atom_EnableVrcMicMuteSync, useHook: useStore_EnableVrcMicMuteSync } = createAtomWithHook(false, "EnableVrcMicMuteSync");
export const { atomInstance: Atom_EnableSendMessageToVrc, useHook: useStore_EnableSendMessageToVrc } = createAtomWithHook(true, "EnableSendMessageToVrc"); // export const { atomInstance: Atom_EnableSendMessageToVrc, useHook: useStore_EnableSendMessageToVrc } = createAtomWithHook(true, "EnableSendMessageToVrc");
export const { atomInstance: Atom_EnableSendReceivedMessageToVrc, useHook: useStore_EnableSendReceivedMessageToVrc } = createAtomWithHook(false, "EnableSendReceivedMessageToVrc"); // export const { atomInstance: Atom_EnableSendReceivedMessageToVrc, useHook: useStore_EnableSendReceivedMessageToVrc } = createAtomWithHook(false, "EnableSendReceivedMessageToVrc");
export const { atomInstance: Atom_EnableNotificationVrcSfx, useHook: useStore_EnableNotificationVrcSfx } = createAtomWithHook(true, "EnableNotificationVrcSfx"); // export const { atomInstance: Atom_EnableNotificationVrcSfx, useHook: useStore_EnableNotificationVrcSfx } = createAtomWithHook(true, "EnableNotificationVrcSfx");
export const { atomInstance: Atom_MessageFormat_ExampleViewFilter, useHook: useStore_MessageFormat_ExampleViewFilter } = createAtomWithHook({ // export const { atomInstance: Atom_MessageFormat_ExampleViewFilter, useHook: useStore_MessageFormat_ExampleViewFilter } = createAtomWithHook({
send: "Simplified", // send: "Simplified",
received: "Simplified", // received: "Simplified",
}, "MessageFormat_ExampleViewFilter"); // }, "MessageFormat_ExampleViewFilter");
export const { atomInstance: Atom_SendMessageFormatParts, useHook: useStore_SendMessageFormatParts } = createAtomWithHook({ // export const { atomInstance: Atom_SendMessageFormatParts, useHook: useStore_SendMessageFormatParts } = createAtomWithHook({
message: { // message: {
prefix: "", // prefix: "",
suffix: "" // suffix: ""
}, // },
separator: "\n", // separator: "\n",
translation: { // translation: {
prefix: "", // prefix: "",
separator: "\n", // separator: "\n",
suffix: "" // suffix: ""
}, // },
translation_first: false, // translation_first: false,
}, "SendMessageFormatParts"); // }, "SendMessageFormatParts");
export const { atomInstance: Atom_ReceivedMessageFormatParts, useHook: useStore_ReceivedMessageFormatParts } = createAtomWithHook({ // export const { atomInstance: Atom_ReceivedMessageFormatParts, useHook: useStore_ReceivedMessageFormatParts } = createAtomWithHook({
message: { // message: {
prefix: "", // prefix: "",
suffix: "" // suffix: ""
}, // },
separator: "\n", // separator: "\n",
translation: { // translation: {
prefix: "", // prefix: "",
separator: "\n", // separator: "\n",
suffix: "" // suffix: ""
}, // },
translation_first: false, // translation_first: false,
}, "ReceivedMessageFormatParts"); // }, "ReceivedMessageFormatParts");
export const { atomInstance: Atom_ConvertMessageToRomaji, useHook: useStore_ConvertMessageToRomaji } = createAtomWithHook(false, "ConvertMessageToRomaji"); // export const { atomInstance: Atom_ConvertMessageToRomaji, useHook: useStore_ConvertMessageToRomaji } = createAtomWithHook(false, "ConvertMessageToRomaji");
export const { atomInstance: Atom_ConvertMessageToHiragana, useHook: useStore_ConvertMessageToHiragana } = createAtomWithHook(false, "ConvertMessageToHiragana"); // export const { atomInstance: Atom_ConvertMessageToHiragana, useHook: useStore_ConvertMessageToHiragana } = createAtomWithHook(false, "ConvertMessageToHiragana");
// Hotkeys // Hotkeys
@@ -332,12 +381,12 @@ export const { atomInstance: Atom_SavedPluginsStatus, useHook: useStore_SavedPlu
export const { atomInstance: Atom_PluginsData, useHook: useStore_PluginsData } = createAtomWithHook([], "PluginsData"); export const { atomInstance: Atom_PluginsData, useHook: useStore_PluginsData } = createAtomWithHook([], "PluginsData");
// Advanced Settings // Advanced Settings
export const { atomInstance: Atom_OscIpAddress, useHook: useStore_OscIpAddress } = createAtomWithHook("127.0.0.1", "OscIpAddress"); // export const { atomInstance: Atom_OscIpAddress, useHook: useStore_OscIpAddress } = createAtomWithHook("127.0.0.1", "OscIpAddress");
export const { atomInstance: Atom_OscPort, useHook: useStore_OscPort } = createAtomWithHook("9000", "OscPort"); // export const { atomInstance: Atom_OscPort, useHook: useStore_OscPort } = createAtomWithHook("9000", "OscPort");
export const { atomInstance: Atom_EnableWebsocket, useHook: useStore_EnableWebsocket } = createAtomWithHook(true, "EnableWebsocket"); // export const { atomInstance: Atom_EnableWebsocket, useHook: useStore_EnableWebsocket } = createAtomWithHook(true, "EnableWebsocket");
export const { atomInstance: Atom_WebsocketHost, useHook: useStore_WebsocketHost } = createAtomWithHook("127.0.0.1", "WebsocketHost"); // export const { atomInstance: Atom_WebsocketHost, useHook: useStore_WebsocketHost } = createAtomWithHook("127.0.0.1", "WebsocketHost");
export const { atomInstance: Atom_WebsocketPort, useHook: useStore_WebsocketPort } = createAtomWithHook("2231", "WebsocketPort"); // export const { atomInstance: Atom_WebsocketPort, useHook: useStore_WebsocketPort } = createAtomWithHook("2231", "WebsocketPort");

648
src-ui/ui_config_setter.js Normal file
View File

@@ -0,0 +1,648 @@
import { createAtomWithHook } from "@store";
import {
ctranslate2_weight_type_status,
whisper_weight_type_status,
} from "@ui_configs";
import { useSettingsLogics } from "./useSettingsLogics";
export const SETTINGS_ARRAY = [
// Device
{
Category: "Device",
Base_Name: "EnableAutoMicSelect",
default_value: true,
ui_template_id: "toggle",
logics_template_id: "toggle_enable_disable",
base_endpoint_name: "auto_mic_select",
},
{
Category: "Device",
Base_Name: "MicHostList",
default_value: [],
ui_template_id: "list",
logics_template_id: "get_set",
add_endpoint_run_array: ["from_backend"],
base_endpoint_name: "mic_host_list",
response_transform: "arrayToObject",
},
{
Category: "Device",
Base_Name: "MicDeviceList",
default_value: [],
ui_template_id: "list",
logics_template_id: "get_set",
add_endpoint_run_array: ["from_backend"],
base_endpoint_name: "mic_device_list",
response_transform: "arrayToObject",
},
{
Category: "Device",
Base_Name: "SelectedMicHost",
default_value: "",
ui_template_id: "select",
logics_template_id: "get_set",
add_endpoint_run_array: ["from_backend"],
base_endpoint_name: "selected_mic_host",
},
{
Category: "Device",
Base_Name: "SelectedMicDevice",
default_value: "",
ui_template_id: "select",
logics_template_id: "get_set",
add_endpoint_run_array: ["from_backend"],
base_endpoint_name: "selected_mic_device",
},
{
Category: "Device",
Base_Name: "EnableAutomaticMicThreshold",
default_value: true,
ui_template_id: "toggle",
logics_template_id: "toggle_enable_disable",
base_endpoint_name: "mic_automatic_threshold",
},
{
Category: "Device",
Base_Name: "MicThreshold",
default_value: 0,
ui_template_id: "slider",
logics_template_id: "get_set",
base_endpoint_name: "mic_threshold",
},
{
Category: "Device",
Base_Name: "EnableAutoSpeakerSelect",
default_value: true,
ui_template_id: "toggle",
logics_template_id: "toggle_enable_disable",
base_endpoint_name: "auto_speaker_select",
},
{
Category: "Device",
Base_Name: "SpeakerDeviceList",
default_value: [],
ui_template_id: "list",
logics_template_id: "get_set",
add_endpoint_run_array: ["from_backend"],
base_endpoint_name: "speaker_device_list",
response_transform: "arrayToObject",
},
{
Category: "Device",
Base_Name: "SelectedSpeakerDevice",
default_value: "",
ui_template_id: "select",
logics_template_id: "get_set",
add_endpoint_run_array: ["from_backend"],
base_endpoint_name: "selected_speaker_device",
},
{
Category: "Device",
Base_Name: "EnableAutomaticSpeakerThreshold",
default_value: true,
ui_template_id: "toggle",
logics_template_id: "toggle_enable_disable",
base_endpoint_name: "speaker_automatic_threshold",
},
{
Category: "Device",
Base_Name: "SpeakerThreshold",
default_value: 0,
ui_template_id: "slider",
logics_template_id: "get_set",
base_endpoint_name: "speaker_threshold",
},
// Appearance
{
Category: "Appearance",
Base_Name: "UiLanguage",
default_value: "en",
ui_template_id: "select",
logics_template_id: "get_set",
base_endpoint_name: "ui_language",
},
{
Category: "Appearance",
Base_Name: "UiScaling",
default_value: 100,
ui_template_id: "slider",
logics_template_id: "get_set",
base_endpoint_name: "ui_scaling",
},
{
Category: "Appearance",
Base_Name: "MessageLogUiScaling",
default_value: 100,
ui_template_id: "slider",
logics_template_id: "get_set",
base_endpoint_name: "textbox_ui_scaling",
},
{
Category: "Appearance",
Base_Name: "SendMessageButtonType",
default_value: "primary",
ui_template_id: "select",
logics_template_id: "get_set",
base_endpoint_name: "send_message_button_type",
},
{
Category: "Appearance",
Base_Name: "ShowResendButton",
default_value: true,
ui_template_id: "toggle",
logics_template_id: "toggle_enable_disable",
base_endpoint_name: "show_resend_button",
},
{
Category: "Appearance",
Base_Name: "SelectedFontFamily",
default_value: "Yu Gothic UI",
ui_template_id: "select",
logics_template_id: "get_set",
base_endpoint_name: "font_family",
},
{
Category: "Appearance",
Base_Name: "Transparency",
default_value: 100,
ui_template_id: "slider",
logics_template_id: "get_set",
base_endpoint_name: "transparency",
},
// Translation
// CTranslate2/Whisper weights
{
Category: "Translation",
Base_Name: "CTranslate2WeightTypeStatus",
default_value: ctranslate2_weight_type_status,
ui_template_id: "list",
logics_template_id: "weight_download_status",
base_endpoint_name: "ctranslate2_weight",
},
{
Category: "Translation",
Base_Name: "SelectedCTranslate2WeightType",
default_value: "",
ui_template_id: "select",
logics_template_id: "get_set",
base_endpoint_name: "ctranslate2_weight_type",
},
{
Category: "Translation",
Base_Name: "SelectedTranslationComputeType",
default_value: "",
ui_template_id: "select",
logics_template_id: "get_set",
base_endpoint_name: "selected_translation_compute_type",
},
{
Category: "Translation",
Base_Name: "SelectableTranslationComputeDeviceList",
default_value: [],
ui_template_id: "list",
logics_template_id: "get_set",
base_endpoint_name: "translation_compute_device_list",
response_transform: "transformToIndexedArray",
},
{
Category: "Translation",
Base_Name: "SelectedTranslationComputeDevice",
default_value: "",
ui_template_id: "select",
logics_template_id: "get_set",
base_endpoint_name: "selected_translation_compute_device",
},
{
Category: "Translation",
Base_Name: "DeepLAuthKey",
default_value: "",
ui_template_id: "input",
logics_template_id: "get_set",
base_endpoint_name: "deepl_auth_key",
},
// Transcription
// Mic
{
Category: "Transcription",
Base_Name: "MicRecordTimeout",
default_value: 0,
ui_template_id: "slider",
logics_template_id: "get_set",
base_endpoint_name: "mic_record_timeout",
},
{
Category: "Transcription",
Base_Name: "MicPhraseTimeout",
default_value: 0,
ui_template_id: "slider",
logics_template_id: "get_set",
base_endpoint_name: "mic_phrase_timeout",
},
{
Category: "Transcription",
Base_Name: "MicMaxWords",
default_value: 0,
ui_template_id: "slider",
logics_template_id: "get_set",
base_endpoint_name: "mic_max_phrases",
},
{
Category: "Transcription",
Base_Name: "MicWordFilterList",
default_value: [],
ui_template_id: "list",
logics_template_id: "get_set",
base_endpoint_name: "mic_word_filter",
},
// Speaker
{
Category: "Transcription",
Base_Name: "SpeakerRecordTimeout",
default_value: 0,
ui_template_id: "slider",
logics_template_id: "get_set",
base_endpoint_name: "speaker_record_timeout",
},
{
Category: "Transcription",
Base_Name: "SpeakerPhraseTimeout",
default_value: 0,
ui_template_id: "slider",
logics_template_id: "get_set",
base_endpoint_name: "speaker_phrase_timeout",
},
{
Category: "Transcription",
Base_Name: "SpeakerMaxWords",
default_value: 0,
ui_template_id: "slider",
logics_template_id: "get_set",
base_endpoint_name: "speaker_max_phrases",
},
// Engines
{
Category: "Transcription",
Base_Name: "SelectedTranscriptionEngine",
default_value: "",
ui_template_id: "select",
logics_template_id: "get_set",
base_endpoint_name: "selected_transcription_engine",
},
{
Category: "Transcription",
Base_Name: "WhisperWeightTypeStatus",
default_value: whisper_weight_type_status,
ui_template_id: "list",
logics_template_id: "weight_download_status",
base_endpoint_name: "whisper_weight",
},
{
Category: "Transcription",
Base_Name: "SelectedWhisperWeightType",
default_value: "",
ui_template_id: "select",
logics_template_id: "get_set",
base_endpoint_name: "whisper_weight_type",
},
{
Category: "Transcription",
Base_Name: "SelectedTranscriptionComputeType",
default_value: "",
ui_template_id: "select",
logics_template_id: "get_set",
base_endpoint_name: "selected_transcription_compute_type",
},
{
Category: "Transcription",
Base_Name: "SelectableTranscriptionComputeDeviceList",
default_value: [],
ui_template_id: "list",
logics_template_id: "get_set",
base_endpoint_name: "transcription_compute_device_list",
response_transform: "transformToIndexedArray",
},
{
Category: "Transcription",
Base_Name: "SelectedTranscriptionComputeDevice",
default_value: "",
ui_template_id: "select",
logics_template_id: "get_set",
base_endpoint_name: "selected_transcription_compute_device",
},
// Advanced
{
Category: "Transcription",
Base_Name: "MicAvgLogprob",
default_value: 0,
ui_template_id: "slider",
logics_template_id: "get_set",
base_endpoint_name: "mic_avg_logprob",
},
{
Category: "Transcription",
Base_Name: "MicNoSpeechProb",
default_value: 0,
ui_template_id: "slider",
logics_template_id: "get_set",
base_endpoint_name: "mic_no_speech_prob",
},
{
Category: "Transcription",
Base_Name: "SpeakerAvgLogprob",
default_value: 0,
ui_template_id: "slider",
logics_template_id: "get_set",
base_endpoint_name: "speaker_avg_logprob",
},
{
Category: "Transcription",
Base_Name: "SpeakerNoSpeechProb",
default_value: 0,
ui_template_id: "slider",
logics_template_id: "get_set",
base_endpoint_name: "speaker_no_speech_prob",
},
// Vr
{
Category: "Vr",
Base_Name: "IsEnabledOverlaySmallLog",
default_value: false,
ui_template_id: "toggle",
logics_template_id: "toggle_enable_disable",
base_endpoint_name: "overlay_small_log",
},
{
Category: "Vr",
Base_Name: "IsEnabledOverlayLargeLog",
default_value: false,
ui_template_id: "toggle",
logics_template_id: "toggle_enable_disable",
base_endpoint_name: "overlay_large_log",
},
{
Category: "Vr",
Base_Name: "OverlaySmallLogSettings",
default_value: {},
ui_template_id: "object",
logics_template_id: "get_set",
base_endpoint_name: "overlay_small_log_settings",
},
{
Category: "Vr",
Base_Name: "OverlayLargeLogSettings",
default_value: {},
ui_template_id: "object",
logics_template_id: "get_set",
base_endpoint_name: "overlay_large_log_settings",
},
{
Category: "Vr",
Base_Name: "OverlayShowOnlyTranslatedMessages",
default_value: false,
ui_template_id: "toggle",
logics_template_id: "toggle_enable_disable",
base_endpoint_name: "overlay_show_only_translated_messages",
},
// Others
{
Category: "Others",
Base_Name: "EnableAutoClearMessageInputBox",
default_value: false,
ui_template_id: "toggle",
logics_template_id: "toggle_enable_disable",
base_endpoint_name: "auto_clear_message_box",
},
{
Category: "Others",
Base_Name: "EnableSendOnlyTranslatedMessages",
default_value: false,
ui_template_id: "toggle",
logics_template_id: "toggle_enable_disable",
base_endpoint_name: "send_only_translated_messages",
},
{
Category: "Others",
Base_Name: "EnableAutoExportMessageLogs",
default_value: false,
ui_template_id: "toggle",
logics_template_id: "toggle_enable_disable",
base_endpoint_name: "logger_feature",
},
{
Category: "Others",
Base_Name: "EnableVrcMicMuteSync",
default_value: false,
ui_template_id: "toggle",
logics_template_id: "toggle_enable_disable",
base_endpoint_name: "vrc_mic_mute_sync",
},
{
Category: "Others",
Base_Name: "EnableSendMessageToVrc",
default_value: false,
ui_template_id: "toggle",
logics_template_id: "toggle_enable_disable",
base_endpoint_name: "send_message_to_vrc",
},
{
Category: "Others",
Base_Name: "EnableNotificationVrcSfx",
default_value: false,
ui_template_id: "toggle",
logics_template_id: "toggle_enable_disable",
base_endpoint_name: "notification_vrc_sfx",
},
{
Category: "Others",
Base_Name: "EnableSendReceivedMessageToVrc",
default_value: false,
ui_template_id: "toggle",
logics_template_id: "toggle_enable_disable",
base_endpoint_name: "send_received_message_to_vrc",
},
{
Category: "Others",
Base_Name: "MessageFormat_ExampleViewFilter",
default_value: {},
ui_template_id: "object",
logics_template_id: "get_set",
base_endpoint_name: "message_format_example_view_filter",
},
{
Category: "Others",
Base_Name: "SendMessageFormatParts",
default_value: [],
ui_template_id: "list",
logics_template_id: "get_set",
base_endpoint_name: "send_message_format_parts",
},
{
Category: "Others",
Base_Name: "ReceivedMessageFormatParts",
default_value: [],
ui_template_id: "list",
logics_template_id: "get_set",
base_endpoint_name: "received_message_format_parts",
},
{
Category: "Others",
Base_Name: "ConvertMessageToRomaji",
default_value: false,
ui_template_id: "toggle",
logics_template_id: "toggle_enable_disable",
base_endpoint_name: "convert_message_to_romaji",
},
{
Category: "Others",
Base_Name: "ConvertMessageToHiragana",
default_value: false,
ui_template_id: "toggle",
logics_template_id: "toggle_enable_disable",
base_endpoint_name: "convert_message_to_hiragana",
},
// Hotkeys
// {
// Category: "Hotkeys",
// Base_Name: "SendMessageHotkey",
// default_value: "",
// ui_template_id: "input",
// logics_template_id: "get_set",
// base_endpoint_name: "send_message_hotkey",
// },
// AdvancedSettings
{
Category: "AdvancedSettings",
Base_Name: "OscIpAddress",
default_value: "127.0.0.1",
ui_template_id: "input",
logics_template_id: "get_set",
base_endpoint_name: "osc_ip_address",
},
{
Category: "AdvancedSettings",
Base_Name: "OscPort",
default_value: 9000,
ui_template_id: "input",
logics_template_id: "get_set",
base_endpoint_name: "osc_port",
},
{
Category: "AdvancedSettings",
Base_Name: "EnableWebsocket",
default_value: false,
ui_template_id: "toggle",
logics_template_id: "toggle_enable_disable",
base_endpoint_name: "websocket_server",
},
{
Category: "AdvancedSettings",
Base_Name: "WebsocketHost",
default_value: "127.0.0.1",
ui_template_id: "input",
logics_template_id: "get_set",
base_endpoint_name: "websocket_host",
},
{
Category: "AdvancedSettings",
Base_Name: "WebsocketPort",
default_value: 9001,
ui_template_id: "input",
logics_template_id: "get_set",
base_endpoint_name: "websocket_port",
},
];
for (const setting_data of SETTINGS_ARRAY) {
createAtomWithHook(setting_data.default_value, setting_data.Base_Name);
}
const buildCategoryApiFromSettings = (settings, settingsArray, Category) => {
const api = {};
const filtered = settingsArray.filter((s) => s.Category === Category);
for (const s of filtered) {
const base = s.Base_Name;
const currentKey = `current${base}`;
const updateKey = `update${base}`;
const getKey = `get${base}`;
const setKey = `set${base}`;
const toggleKey = `toggle${base}`;
const setSuccessKey = `setSuccess${base}`;
const updateFromBackendKey = `updateFromBackend${base}`;
if (settings[currentKey] !== undefined) api[currentKey] = settings[currentKey];
if (settings[updateKey] !== undefined) api[updateKey] = settings[updateKey];
if (typeof settings[getKey] === "function") api[getKey] = settings[getKey];
if (typeof settings[setKey] === "function") api[setKey] = settings[setKey];
if (typeof settings[toggleKey] === "function") api[toggleKey] = settings[toggleKey];
if (typeof settings[setSuccessKey] === "function") api[setSuccessKey] = settings[setSuccessKey];
if (typeof settings[updateFromBackendKey] === "function") api[updateFromBackendKey] = settings[updateFromBackendKey];
if (s.logics_template_id === "weight_download_status") {
const updateDownloadProgressKey = `updateDownloadProgress${base}`;
const updateDownloadedKey = `updateDownloaded${base}`;
const pendingKey = `pending${base}`;
const downloadedKey = `downloaded${base}`;
const downloadKey = `download${base}`;
if (typeof settings[updateDownloadProgressKey] === "function") api[updateDownloadProgressKey] = settings[updateDownloadProgressKey];
if (typeof settings[updateDownloadedKey] === "function") api[updateDownloadedKey] = settings[updateDownloadedKey];
if (typeof settings[pendingKey] === "function") api[pendingKey] = settings[pendingKey];
if (typeof settings[downloadedKey] === "function") api[downloadedKey] = settings[downloadedKey];
if (typeof settings[downloadKey] === "function") api[downloadKey] = settings[downloadKey];
if (typeof settings[updateFromBackendKey] === "function") api[updateFromBackendKey] = settings[updateFromBackendKey];
}
}
return api;
};
const createCategoryHook = (Category) => {
return () => {
const { settings } = useSettingsLogics(SETTINGS_ARRAY, Category);
const autoApi = buildCategoryApiFromSettings(settings, SETTINGS_ARRAY, Category);
return { ...autoApi };
};
};
// --- 自動エクスポート: SETTINGS_ARRAY に含まれるユニークな Category ごとに use<Category> を作って export ---
// 例: Category === "Appearance" -> export const useAppearance = createCategoryHook("Appearance");
// const uniqueCategories = Array.from(new Set(SETTINGS_ARRAY.map((s) => s.Category)));
// 動的に named export を作る(静的解析を壊さないために明示的に定義)
/* eslint-disable import/prefer-default-export */
export const useAppearance = createCategoryHook("Appearance");
export const useDevice = createCategoryHook("Device");
export const useTranslation = createCategoryHook("Translation");
export const useTranscription = createCategoryHook("Transcription");
export const useVr = createCategoryHook("Vr");
export const useOthers = createCategoryHook("Others");
// export const useHotkeys = createCategoryHook("Hotkeys");
export const useAdvancedSettings = createCategoryHook("AdvancedSettings");
// If you later add other categories, you can either manually add:
// export const useDevice = createCategoryHook("Device");
// or uncomment the code below to auto-attach to module.exports (less ideal for tree-shaking).
//
// Auto-attach (not recommended for tree-shaking in bundlers):
// uniqueCategories.forEach((Category) => {
// const hookName = `use${Category}`;
// module.exports[hookName] = createCategoryHook(Category);
// });
/* eslint-enable import/prefer-default-export */

187
src-ui/useSettingsLogics.js Normal file
View File

@@ -0,0 +1,187 @@
import * as stores from "@store";
import { useStdoutToPython } from "@useStdoutToPython";
import { useNotificationStatus } from "@logics_common";
import { arrayToObject } from "@utils";
const transformResponse = (transformName, payload) => {
if (!transformName) return payload;
switch (transformName) {
case "arrayToObject":
return arrayToObject(payload);
default:
return payload;
}
};
export const useSettingsLogics = (settingsArray, Category) => {
const { asyncStdoutToPython } = useStdoutToPython();
const { showNotification_SaveSuccess } = useNotificationStatus();
const filtered = settingsArray.filter((s) => s.Category === Category);
const result = {};
for (const s of filtered) {
const base = s.Base_Name;
let storeHook = undefined;
if (typeof stores.getStoreHook === "function") {
storeHook = stores.getStoreHook(base);
}
if (!storeHook) {
const hookName = `useStore_${base}`;
storeHook = stores[hookName];
}
if (!storeHook) {
console.warn(`[useSettingsLogics] store hook not found for ${base}`);
continue;
}
const store = storeHook();
const currentKey = `current${base}`;
const updateKey = `update${base}`;
const pendingKey = `pending${base}`;
const current = store[currentKey];
const update = store[updateKey];
const pending = store[pendingKey];
const currentExportName = `current${base}`;
const updateExportName = `update${base}`;
const updateFromBackendExportName = `updateFromBackend${base}`;
const getExportName = `get${base}`;
const setExportName = `set${base}`;
const toggleExportName = `toggle${base}`;
const setSuccessExportName = `setSuccess${base}`;
const runExportName = `runSuccess${base}`;
// To use by UI------------------------------------
const buildGet = () => {
return () => {
if (pending) pending();
asyncStdoutToPython(`/get/data/${s.base_endpoint_name}`);
};
};
const buildSet = () => {
return (value) => {
if (pending) pending();
asyncStdoutToPython(`/set/data/${s.base_endpoint_name}`, value);
};
};
const buildRun = () => {
return () => {
asyncStdoutToPython(`/run/${s.base_endpoint_name}`);
};
};
// To use a response from backend------------------------------------
const buildSetSuccess = (transformName) => {
return (payload) => {
const transformed = transformResponse(transformName, payload);
if (update) update(transformed);
showNotification_SaveSuccess();
};
};
const buildUpdateFromBackend = (transformName) => {
return (payload) => {
const transformed = transformResponse(transformName, payload);
if (update) update(transformed);
};
};
result[currentExportName] = current;
result[updateExportName] = update;
result[updateFromBackendExportName] = buildUpdateFromBackend(s.response_transform ?? null);
if (s.add_endpoint_run_array?.includes("to_backend")) {
result[runExportName] = buildRun();
}
if (s.logics_template_id === "get_list") {
result[getExportName] = buildGet();
continue;
}
if (s.logics_template_id === "get_set") {
result[getExportName] = buildGet();
result[setExportName] = buildSet();
result[setSuccessExportName] = buildSetSuccess(s.response_transform ?? null);
continue;
}
if (s.logics_template_id === "toggle_enable_disable") {
result[getExportName] = buildGet();
result[toggleExportName] = () => {
if (pending) pending();
const isOn = current && current.data;
if (isOn) {
asyncStdoutToPython(`/set/disable/${s.base_endpoint_name}`);
} else {
asyncStdoutToPython(`/set/enable/${s.base_endpoint_name}`);
}
};
result[setSuccessExportName] = buildSetSuccess(s.response_transform ?? null);
continue;
}
if (s.logics_template_id === "weight_download_status") {
result[setSuccessExportName] = buildSetSuccess(s.response_transform ?? null);
result[`updateDownloadProgress${base}`] = (payload) => {
update((old_status) => {
return old_status.data.map((item) =>
payload.weight_type === item.id
? { ...item, progress: payload.progress * 100 }
: item
);
});
};
result[`updateDownloaded${base}`] = (downloaded_weight_type_status) => {
update((old_status) => {
return old_status.data.map((item) => ({
...item,
is_downloaded: downloaded_weight_type_status[item.id] ?? item.is_downloaded,
}));
});
};
result[`pending${base}`] = (id) => {
update((old_status) => {
return old_status.data.map((item) =>
id === item.id
? { ...item, is_pending: true }
: item
);
});
};
result[`downloaded${base}`] = (id) => {
update((old_status) => {
return old_status.data.map((item) =>
id === item.id
? { ...item, is_downloaded: true, is_pending: false, progress: null }
: item
);
});
};
result[`download${base}`] = (weight_type) => {
asyncStdoutToPython(`/run/download_${s.base_endpoint_name}`, weight_type);
};
continue;
}
}
return { settings: result };
};