👍️[Update] Mainl: endpointの命名規則を修正

This commit is contained in:
misyaguziya
2024-09-24 11:51:57 +09:00
parent 80b57612bc
commit e129fd308b
24 changed files with 462 additions and 460 deletions

View File

@@ -25,11 +25,11 @@ export const useVolume = () => {
return {
volumeCheckStart_Mic: () => {
pendingMicThresholdCheckStatus();
asyncStdoutToPython("/set/enable_check_mic_threshold");
asyncStdoutToPython("/set/enable/check_mic_threshold");
},
volumeCheckStop_Mic: () => {
pendingMicThresholdCheckStatus();
asyncStdoutToPython("/set/disable_check_mic_threshold");
asyncStdoutToPython("/set/disable/check_mic_threshold");
},
updateVolumeVariable_Mic: (payload) => {
updateMicVolume(payload);
@@ -43,11 +43,11 @@ export const useVolume = () => {
volumeCheckStart_Speaker: () => {
updateSpeakerVolume("0");
pendingSpeakerThresholdCheckStatus();
asyncStdoutToPython("/set/enable_check_speaker_threshold");
asyncStdoutToPython("/set/enable/check_speaker_threshold");
},
volumeCheckStop_Speaker: () => {
pendingSpeakerThresholdCheckStatus();
asyncStdoutToPython("/set/disable_check_speaker_threshold");
asyncStdoutToPython("/set/disable/check_speaker_threshold");
},
updateVolumeVariable_Speaker: (payload) => {
updateSpeakerVolume(payload);

View File

@@ -7,15 +7,15 @@ export const useEnableAutoClearMessageBox = () => {
const getEnableAutoClearMessageBox = () => {
pendingEnableAutoClearMessageBox();
asyncStdoutToPython("/get/auto_clear_message_box");
asyncStdoutToPython("/get/data/auto_clear_message_box");
};
const toggleEnableAutoClearMessageBox = () => {
pendingEnableAutoClearMessageBox();
if (currentEnableAutoClearMessageBox.data) {
asyncStdoutToPython("/set/disable_auto_clear_message_box");
asyncStdoutToPython("/set/disable/auto_clear_message_box");
} else {
asyncStdoutToPython("/set/enable_auto_clear_message_box");
asyncStdoutToPython("/set/enable/auto_clear_message_box");
}
};

View File

@@ -7,15 +7,15 @@ export const useEnableAutoMicSelect = () => {
const getEnableAutoMicSelect = () => {
pendingEnableAutoMicSelect();
asyncStdoutToPython("/get/auto_mic_select");
asyncStdoutToPython("/get/data/auto_mic_select");
};
const toggleEnableAutoMicSelect = () => {
pendingEnableAutoMicSelect();
if (currentEnableAutoMicSelect.data) {
asyncStdoutToPython("/set/disable_auto_mic_select");
asyncStdoutToPython("/set/disable/auto_mic_select");
} else {
asyncStdoutToPython("/set/enable_auto_mic_select");
asyncStdoutToPython("/set/enable/auto_mic_select");
}
};

View File

@@ -7,15 +7,15 @@ export const useEnableAutoSpeakerSelect = () => {
const getEnableAutoSpeakerSelect = () => {
pendingEnableAutoSpeakerSelect();
asyncStdoutToPython("/get/auto_speaker_select");
asyncStdoutToPython("/get/data/auto_speaker_select");
};
const toggleEnableAutoSpeakerSelect = () => {
pendingEnableAutoSpeakerSelect();
if (currentEnableAutoSpeakerSelect.data) {
asyncStdoutToPython("/set/disable_auto_speaker_select");
asyncStdoutToPython("/set/disable/auto_speaker_select");
} else {
asyncStdoutToPython("/set/enable_auto_speaker_select");
asyncStdoutToPython("/set/enable/auto_speaker_select");
}
};

View File

@@ -7,7 +7,7 @@ export const useMicDeviceList = () => {
const getMicDeviceList = () => {
pendingMicDeviceList();
asyncStdoutToPython("/get/list_mic_device");
asyncStdoutToPython("/get/data/mic_device_list");
};
return {

View File

@@ -7,7 +7,7 @@ export const useMicHostList = () => {
const getMicHostList = () => {
pendingMicHostList();
asyncStdoutToPython("/get/list_mic_host");
asyncStdoutToPython("/get/data/mic_host_list");
};
return {

View File

@@ -7,24 +7,24 @@ export const useMicThreshold = () => {
const { updateEnableAutomaticMicThreshold, currentEnableAutomaticMicThreshold, pendingEnableAutomaticMicThreshold } = useStore_EnableAutomaticMicThreshold();
const getMicThreshold = () => {
asyncStdoutToPython("/get/mic_energy_threshold");
asyncStdoutToPython("/get/data/mic_threshold");
};
const setMicThreshold = (mic_threshold) => {
asyncStdoutToPython("/set/mic_energy_threshold", mic_threshold);
asyncStdoutToPython("/set/data/mic_threshold", mic_threshold);
};
const getEnableAutomaticMicThreshold = () => {
pendingEnableAutomaticMicThreshold();
asyncStdoutToPython("/get/mic_dynamic_energy_threshold");
asyncStdoutToPython("/get/data/mic_automatic_threshold");
};
const toggleEnableAutomaticMicThreshold = () => {
pendingEnableAutomaticMicThreshold();
if (currentEnableAutomaticMicThreshold.data) {
asyncStdoutToPython("/set/disable_mic_dynamic_energy_threshold");
asyncStdoutToPython("/set/disable/mic_automatic_threshold");
} else {
asyncStdoutToPython("/set/enable_mic_dynamic_energy_threshold");
asyncStdoutToPython("/set/enable/mic_automatic_threshold");
}
};

View File

@@ -12,7 +12,7 @@ export const useSelectedMicDevice = () => {
const setSelectedMicDevice = (selected_mic_device) => {
pendingSelectedMicDevice();
asyncStdoutToPython("/set/selected_mic_device", selected_mic_device);
asyncStdoutToPython("/set/data/selected_mic_device", selected_mic_device);
};
return {

View File

@@ -7,12 +7,12 @@ export const useSelectedMicHost = () => {
const getSelectedMicHost = () => {
pendingSelectedMicHost();
asyncStdoutToPython("/get/selected_mic_host");
asyncStdoutToPython("/get/data/selected_mic_host");
};
const setSelectedMicHost = (selected_mic_host) => {
pendingSelectedMicHost();
asyncStdoutToPython("/set/selected_mic_host", selected_mic_host);
asyncStdoutToPython("/set/data/selected_mic_host", selected_mic_host);
};
return {

View File

@@ -7,12 +7,12 @@ export const useSelectedSpeakerDevice = () => {
const getSelectedSpeakerDevice = () => {
pendingSelectedSpeakerDevice();
asyncStdoutToPython("/get/selected_speaker_device");
asyncStdoutToPython("/get/data/selected_speaker_device");
};
const setSelectedSpeakerDevice = (selected_speaker_device) => {
pendingSelectedSpeakerDevice();
asyncStdoutToPython("/set/selected_speaker_device", selected_speaker_device);
asyncStdoutToPython("/set/data/selected_speaker_device", selected_speaker_device);
};
return {

View File

@@ -7,12 +7,12 @@ export const useSendMessageButtonType = () => {
const getSendMessageButtonType = () => {
pendingSendMessageButtonType();
asyncStdoutToPython("/get/send_message_button_type");
asyncStdoutToPython("/get/data/send_message_button_type");
};
const setSendMessageButtonType = (selected_type) => {
pendingSendMessageButtonType();
asyncStdoutToPython("/set/send_message_button_type", selected_type);
asyncStdoutToPython("/set/data/send_message_button_type", selected_type);
};
return {

View File

@@ -7,7 +7,7 @@ export const useSoftwareVersion = () => {
const getSoftwareVersion = () => {
pendingSoftwareVersion();
asyncStdoutToPython("/get/version");
asyncStdoutToPython("/get/data/version");
};
return {

View File

@@ -7,7 +7,7 @@ export const useSpeakerDeviceList = () => {
const getSpeakerDeviceList = () => {
pendingSpeakerDeviceList();
asyncStdoutToPython("/get/list_speaker_device");
asyncStdoutToPython("/get/data/speaker_device_list");
};
return {

View File

@@ -7,24 +7,24 @@ export const useSpeakerThreshold = () => {
const { updateEnableAutomaticSpeakerThreshold, currentEnableAutomaticSpeakerThreshold, pendingEnableAutomaticSpeakerThreshold } = useStore_EnableAutomaticSpeakerThreshold();
const getSpeakerThreshold = () => {
asyncStdoutToPython("/get/speaker_energy_threshold");
asyncStdoutToPython("/get/data/speaker_energy_threshold");
};
const setSpeakerThreshold = (speaker_threshold) => {
asyncStdoutToPython("/set/speaker_energy_threshold", speaker_threshold);
asyncStdoutToPython("/set/data/speaker_energy_threshold", speaker_threshold);
};
const getEnableAutomaticSpeakerThreshold = () => {
pendingEnableAutomaticSpeakerThreshold();
asyncStdoutToPython("/get/speaker_dynamic_energy_threshold");
asyncStdoutToPython("/get/data/speaker_automatic_threshold");
};
const toggleEnableAutomaticSpeakerThreshold = () => {
pendingEnableAutomaticSpeakerThreshold();
if (currentEnableAutomaticSpeakerThreshold.data) {
asyncStdoutToPython("/set/disable_speaker_dynamic_energy_threshold");
asyncStdoutToPython("/set/disable/speaker_automatic_threshold");
} else {
asyncStdoutToPython("/set/enable_speaker_dynamic_energy_threshold");
asyncStdoutToPython("/set/enable/speaker_automatic_threshold");
}
};

View File

@@ -7,12 +7,12 @@ export const useUiLanguage = () => {
const getUiLanguage = () => {
pendingUiLanguage();
asyncStdoutToPython("/get/ui_language");
asyncStdoutToPython("/get/data/ui_language");
};
const setUiLanguage = (selected_ui_language) => {
pendingUiLanguage();
asyncStdoutToPython("/set/ui_language", selected_ui_language);
asyncStdoutToPython("/set/data/ui_language", selected_ui_language);
};
return {

View File

@@ -36,24 +36,24 @@ export const useLanguageSettings = () => {
const getEnableMultiTranslation = () => {
pendingEnableMultiTranslation();
asyncStdoutToPython("/get/multi_language_translation");
asyncStdoutToPython("/get/data/multi_language_translation");
};
const getSelectedPresetTabNumber = () => {
pendingSelectedPresetTabNumber();
asyncStdoutToPython("/get/selected_tab_no");
asyncStdoutToPython("/get/data/selected_tab_no");
};
const setSelectedPresetTabNumber = (preset_number) => {
pendingSelectedPresetTabNumber();
asyncStdoutToPython("/set/selected_tab_no", preset_number);
asyncStdoutToPython("/set/data/selected_tab_no", preset_number);
};
const getSelectedYourLanguages = () => {
pendingSelectedPresetTabNumber();
asyncStdoutToPython("/get/selected_your_languages");
asyncStdoutToPython("/get/data/selected_your_languages");
};
const setSelectedYourLanguages = (selected_language_data) => {
@@ -67,13 +67,13 @@ export const useLanguageSettings = () => {
}
}
};
asyncStdoutToPython("/set/selected_your_languages", send_obj);
asyncStdoutToPython("/set/data/selected_your_languages", send_obj);
};
const getSelectedTargetLanguages = () => {
pendingSelectedTargetLanguages();
asyncStdoutToPython("/get/selected_target_languages");
asyncStdoutToPython("/get/data/selected_target_languages");
};
const setSelectedTargetLanguages = (selected_language_data) => {
@@ -83,25 +83,25 @@ export const useLanguageSettings = () => {
send_obj[currentSelectedPresetTabNumber.data].primary.language = selected_language_data.language,
send_obj[currentSelectedPresetTabNumber.data].primary.country = selected_language_data.country,
asyncStdoutToPython("/set/selected_target_languages", send_obj);
asyncStdoutToPython("/set/data/selected_target_languages", send_obj);
};
const getTranslationEngines = () => {
pendingTranslationEngines();
asyncStdoutToPython("/get/list_translation_engines");
asyncStdoutToPython("/get/data/translation_engines");
};
const getSelectedTranslationEngines = () => {
pendingSelectedTranslationEngines();
asyncStdoutToPython("/get/selected_translator_engines");
asyncStdoutToPython("/get/data/selected_translation_engines");
};
const setSelectedTranslationEngines = (selected_translator) => {
pendingSelectedTranslationEngines();
let send_obj = currentSelectedTranslationEngines.data;
send_obj[currentSelectedPresetTabNumber.data] = selected_translator;
asyncStdoutToPython("/set/selected_translator_engines", send_obj);
asyncStdoutToPython("/set/data/selected_translator_engines", send_obj);
};

View File

@@ -35,27 +35,27 @@ export const useMainFunction = () => {
const toggleTranslation = () => {
pendingTranslationStatus();
if (currentTranslationStatus.data) {
asyncStdoutToPython("/set/disable_translation");
asyncStdoutToPython("/set/disable/translation");
} else {
asyncStdoutToPython("/set/enable_translation");
asyncStdoutToPython("/set/enable/translation");
}
};
const toggleTranscriptionSend = () => {
pendingTranscriptionSendStatus();
if (currentTranscriptionSendStatus.data) {
asyncStdoutToPython("/set/disable_transcription_send");
asyncStdoutToPython("/set/disable/transcription_send");
} else {
asyncStdoutToPython("/set/enable_transcription_send");
asyncStdoutToPython("/set/enable/transcription_send");
}
};
const toggleTranscriptionReceive = () => {
pendingTranscriptionReceiveStatus();
if (currentTranscriptionReceiveStatus.data) {
asyncStdoutToPython("/set/disable_transcription_receive");
asyncStdoutToPython("/set/disable/transcription_receive");
} else {
asyncStdoutToPython("/set/enable_transcription_receive");
asyncStdoutToPython("/set/enable/transcription_receive");
}
};

View File

@@ -6,7 +6,7 @@ export const useSelectableLanguageList = () => {
const { currentSelectableLanguageList, updateSelectableLanguageList } = useStore_SelectableLanguageList();
const getSelectableLanguageList = () => {
asyncStdoutToPython("/get/list_languages");
asyncStdoutToPython("/get/data/selectable_language_list");
};
return {

View File

@@ -67,22 +67,22 @@ export const useReceiveRoutes = () => {
const routes = {
// Main Page
// Main Functions
"/set/enable_translation": updateTranslationStatus,
"/set/disable_translation": updateTranslationStatus,
"/set/enable_transcription_send": updateTranscriptionSendStatus,
"/set/disable_transcription_send": updateTranscriptionSendStatus,
"/set/enable_transcription_receive": updateTranscriptionReceiveStatus,
"/set/disable_transcription_receive": updateTranscriptionReceiveStatus,
"/set/enable/translation": updateTranslationStatus,
"/set/disable/translation": updateTranslationStatus,
"/set/enable/transcription_send": updateTranscriptionSendStatus,
"/set/disable/transcription_send": updateTranscriptionSendStatus,
"/set/enable/transcription_receive": updateTranscriptionReceiveStatus,
"/set/disable/transcription_receive": updateTranscriptionReceiveStatus,
// Language Settings
"/get/selected_tab_no": updateSelectedPresetTabNumber,
"/set/selected_tab_no": updateSelectedPresetTabNumber,
"/get/multi_language_translation": updateEnableMultiTranslation,
"/get/selected_your_languages": updateSelectedYourLanguages,
"/set/selected_your_languages": updateSelectedYourLanguages,
"/get/selected_target_languages": updateSelectedTargetLanguages,
"/set/selected_target_languages": updateSelectedTargetLanguages,
"/get/list_translation_engines": (payload) => {
"/get/data/selected_tab_no": updateSelectedPresetTabNumber,
"/set/data/selected_tab_no": updateSelectedPresetTabNumber,
"/get/data/multi_language_translation": updateEnableMultiTranslation,
"/get/data/selected_your_languages": updateSelectedYourLanguages,
"/set/data/selected_your_languages": updateSelectedYourLanguages,
"/get/data/selected_target_languages": updateSelectedTargetLanguages,
"/set/data/selected_target_languages": updateSelectedTargetLanguages,
"/get/data/translation_engines": (payload) => {
const updateTranslatorAvailability = (keys) => {
return translator_status.map(translator => ({
...translator,
@@ -94,76 +94,76 @@ export const useReceiveRoutes = () => {
updateTranslationEngines(updated_list);
},
"/get/selected_translator_engines": updateSelectedTranslationEngines,
"/set/selected_translator_engines": updateSelectedTranslationEngines,
"/get/data/selected_translation_engines": updateSelectedTranslationEngines,
"/set/data/selected_translator_engines": updateSelectedTranslationEngines,
// Language Selector
"/get/list_languages": updateSelectableLanguageList,
"/get/data/selectable_language_list": updateSelectableLanguageList,
// Message
"/run/send_message_box": updateSentMessageLogById,
"/action/transcription_send_mic_message": addSentMessageLog,
"/action/transcription_receive_speaker_message": addReceivedMessageLog,
"/run/transcription_send_mic_message": addSentMessageLog,
"/run/transcription_receive_speaker_message": addReceivedMessageLog,
// Config Page
// Common
"/get/version": updateSoftwareVersion,
"/get/data/version": updateSoftwareVersion,
// Device Tab
"/get/auto_mic_select": updateEnableAutoMicSelect,
"/set/enable_auto_mic_select": updateEnableAutoMicSelect,
"/set/disable_auto_mic_select": updateEnableAutoMicSelect,
"/get/auto_speaker_select": updateEnableAutoSpeakerSelect,
"/set/enable_auto_speaker_select": updateEnableAutoSpeakerSelect,
"/set/disable_auto_speaker_select": updateEnableAutoSpeakerSelect,
"/get/data/auto_mic_select": updateEnableAutoMicSelect,
"/set/enable/auto_mic_select": updateEnableAutoMicSelect,
"/set/disable/auto_mic_select": updateEnableAutoMicSelect,
"/get/data/auto_speaker_select": updateEnableAutoSpeakerSelect,
"/set/enable/auto_speaker_select": updateEnableAutoSpeakerSelect,
"/set/disable/auto_speaker_select": updateEnableAutoSpeakerSelect,
"/get/list_mic_host": (payload) => updateMicHostList(arrayToObject(payload)),
"/get/selected_mic_host": updateSelectedMicHost,
"/set/selected_mic_host": (payload) => {
"/get/data/mic_host_list": (payload) => updateMicHostList(arrayToObject(payload)),
"/get/data/selected_mic_host": updateSelectedMicHost,
"/set/data/selected_mic_host": (payload) => {
updateSelectedMicHost(payload.host);
updateSelectedMicDevice(payload.device);
},
"/get/list_mic_device": (payload) => updateMicDeviceList(arrayToObject(payload)),
"/get/selected_mic_device": updateSelectedMicDevice,
"/set/selected_mic_device": updateSelectedMicDevice,
"/get/data/mic_device_list": (payload) => updateMicDeviceList(arrayToObject(payload)),
"/get/data/selected_mic_device": updateSelectedMicDevice,
"/set/data/selected_mic_device": updateSelectedMicDevice,
"/get/list_speaker_device": (payload) => updateSpeakerDeviceList(arrayToObject(payload)),
"/get/selected_speaker_device": updateSelectedSpeakerDevice,
"/set/selected_speaker_device": updateSelectedSpeakerDevice,
"/get/data/speaker_device_list": (payload) => updateSpeakerDeviceList(arrayToObject(payload)),
"/get/data/selected_speaker_device": updateSelectedSpeakerDevice,
"/set/data/selected_speaker_device": updateSelectedSpeakerDevice,
"/action/check_mic_threshold_energy": updateVolumeVariable_Mic,
"/action/check_speaker_threshold_energy": updateVolumeVariable_Speaker,
"/set/enable_check_mic_threshold": updateMicThresholdCheckStatus,
"/set/disable_check_mic_threshold": updateMicThresholdCheckStatus,
"/set/enable_check_speaker_threshold": updateSpeakerThresholdCheckStatus,
"/set/disable_check_speaker_threshold": updateSpeakerThresholdCheckStatus,
"/run/check_mic_volume": updateVolumeVariable_Mic,
"/run/check_speaker_volume": updateVolumeVariable_Speaker,
"/set/enable/check_mic_threshold": updateMicThresholdCheckStatus,
"/set/disable/check_mic_threshold": updateMicThresholdCheckStatus,
"/set/enable/check_speaker_threshold": updateSpeakerThresholdCheckStatus,
"/set/disable/check_speaker_threshold": updateSpeakerThresholdCheckStatus,
"/get/mic_energy_threshold": updateMicThreshold,
"/set/mic_energy_threshold": updateMicThreshold,
"/get/speaker_energy_threshold": updateSpeakerThreshold,
"/set/speaker_energy_threshold": updateSpeakerThreshold,
"/get/data/mic_threshold": updateMicThreshold,
"/set/data/mic_threshold": updateMicThreshold,
"/get/data/speaker_energy_threshold": updateSpeakerThreshold,
"/set/data/speaker_energy_threshold": updateSpeakerThreshold,
"/get/mic_dynamic_energy_threshold": updateEnableAutomaticMicThreshold,
"/set/enable_mic_dynamic_energy_threshold": updateEnableAutomaticMicThreshold,
"/set/disable_mic_dynamic_energy_threshold": updateEnableAutomaticMicThreshold,
"/get/speaker_dynamic_energy_threshold": updateEnableAutomaticSpeakerThreshold,
"/set/enable_speaker_dynamic_energy_threshold": updateEnableAutomaticSpeakerThreshold,
"/set/disable_speaker_dynamic_energy_threshold": updateEnableAutomaticSpeakerThreshold,
"/get/data/mic_automatic_threshold": updateEnableAutomaticMicThreshold,
"/set/enable/mic_automatic_threshold": updateEnableAutomaticMicThreshold,
"/set/disable/mic_automatic_threshold": updateEnableAutomaticMicThreshold,
"/get/data/speaker_automatic_threshold": updateEnableAutomaticSpeakerThreshold,
"/set/enable/speaker_automatic_threshold": updateEnableAutomaticSpeakerThreshold,
"/set/disable/speaker_automatic_threshold": updateEnableAutomaticSpeakerThreshold,
// Appearance
"/get/ui_language": updateUiLanguage,
"/set/ui_language": updateUiLanguage,
"/get/data/ui_language": updateUiLanguage,
"/set/data/ui_language": updateUiLanguage,
// Others Tab
"/get/auto_clear_message_box": updateEnableAutoClearMessageBox,
"/set/enable_auto_clear_message_box": updateEnableAutoClearMessageBox,
"/set/disable_auto_clear_message_box": updateEnableAutoClearMessageBox,
"/get/data/auto_clear_message_box": updateEnableAutoClearMessageBox,
"/set/enable/auto_clear_message_box": updateEnableAutoClearMessageBox,
"/set/disable/auto_clear_message_box": updateEnableAutoClearMessageBox,
"/get/send_message_button_type": updateSendMessageButtonType,
"/set/send_message_button_type": updateSendMessageButtonType,
"/get/data/send_message_button_type": updateSendMessageButtonType,
"/set/data/send_message_button_type": updateSendMessageButtonType,
};
const receiveRoutes = (parsed_data) => {