👍️[Update] UI: backendのendpointに合わせて修正

This commit is contained in:
misyaguziya
2024-09-20 05:14:51 +09:00
parent d3b66b7000
commit ca6514b090
24 changed files with 700 additions and 705 deletions

View File

@@ -7,15 +7,15 @@ export const useEnableAutoClearMessageBox = () => {
const getEnableAutoClearMessageBox = () => {
updateEnableAutoClearMessageBox(() => new Promise(() => {}));
asyncStdoutToPython("/config/enable_auto_clear_message_box");
asyncStdoutToPython("/get/auto_clear_message_box");
};
const toggleEnableAutoClearMessageBox = () => {
updateEnableAutoClearMessageBox(() => new Promise(() => {}));
if (currentEnableAutoClearMessageBox.data) {
asyncStdoutToPython("/controller/callback_disable_auto_clear_chatbox");
asyncStdoutToPython("/set/disable_auto_clear_message_box");
} else {
asyncStdoutToPython("/controller/callback_enable_auto_clear_chatbox");
asyncStdoutToPython("/set/enable_auto_clear_message_box");
}
};

View File

@@ -7,15 +7,15 @@ export const useEnableAutoMicSelect = () => {
const getEnableAutoMicSelect = () => {
updateEnableAutoMicSelect(() => new Promise(() => {}));
asyncStdoutToPython("/config/enable_mic_automatic_selection");
asyncStdoutToPython("/get/auto_mic_select");
};
const toggleEnableAutoMicSelect = () => {
updateEnableAutoMicSelect(() => new Promise(() => {}));
if (currentEnableAutoMicSelect.data) {
asyncStdoutToPython("/controller/callback_disable_mic_automatic_selection");
asyncStdoutToPython("/set/disable_auto_mic_select");
} else {
asyncStdoutToPython("/controller/callback_enable_mic_automatic_selection");
asyncStdoutToPython("/set/enable_auto_mic_select");
}
};

View File

@@ -7,15 +7,15 @@ export const useEnableAutoSpeakerSelect = () => {
const getEnableAutoSpeakerSelect = () => {
updateEnableAutoSpeakerSelect(() => new Promise(() => {}));
asyncStdoutToPython("/config/enable_speaker_automatic_selection");
asyncStdoutToPython("/get/auto_speaker_select");
};
const toggleEnableAutoSpeakerSelect = () => {
updateEnableAutoSpeakerSelect(() => new Promise(() => {}));
if (currentEnableAutoSpeakerSelect.data) {
asyncStdoutToPython("/controller/callback_disable_speaker_automatic_selection");
asyncStdoutToPython("/set/disable_auto_speaker_select");
} else {
asyncStdoutToPython("/controller/callback_enable_speaker_automatic_selection");
asyncStdoutToPython("/set/enable_auto_speaker_select");
}
};

View File

@@ -7,7 +7,7 @@ export const useMicDeviceList = () => {
const getMicDeviceList = () => {
updateMicDeviceList(() => new Promise(() => {}));
asyncStdoutToPython("/controller/list_mic_device");
asyncStdoutToPython("/get/list_mic_device");
};
return {

View File

@@ -7,7 +7,7 @@ export const useMicHostList = () => {
const getMicHostList = () => {
updateMicHostList(() => new Promise(() => {}));
asyncStdoutToPython("/controller/list_mic_host");
asyncStdoutToPython("/get/list_mic_host");
};
return {

View File

@@ -7,24 +7,24 @@ export const useMicThreshold = () => {
const { updateEnableAutomaticMicThreshold, currentEnableAutomaticMicThreshold } = useStore_EnableAutomaticMicThreshold();
const getMicThreshold = () => {
asyncStdoutToPython("/config/input_mic_energy_threshold");
asyncStdoutToPython("/get/mic_energy_threshold");
};
const setMicThreshold = (mic_threshold) => {
asyncStdoutToPython("/controller/callback_set_mic_energy_threshold", mic_threshold);
asyncStdoutToPython("/set/mic_energy_threshold", mic_threshold);
};
const getEnableAutomaticMicThreshold = () => {
updateEnableAutomaticMicThreshold(() => new Promise(() => {}));
asyncStdoutToPython("/config/input_mic_dynamic_energy_threshold");
asyncStdoutToPython("/get/mic_dynamic_energy_threshold");
};
const toggleEnableAutomaticMicThreshold = () => {
updateEnableAutomaticMicThreshold(() => new Promise(() => {}));
if (currentEnableAutomaticMicThreshold.data) {
asyncStdoutToPython("/controller/callback_disable_mic_dynamic_energy_threshold");
asyncStdoutToPython("/set/disable_mic_dynamic_energy_threshold");
} else {
asyncStdoutToPython("/controller/callback_enable_mic_dynamic_energy_threshold");
asyncStdoutToPython("/set/enable_mic_dynamic_energy_threshold");
}
};

View File

@@ -7,12 +7,12 @@ export const useSelectedMicDevice = () => {
const getSelectedMicDevice = () => {
updateSelectedMicDevice(() => new Promise(() => {}));
asyncStdoutToPython("/config/choice_mic_device");
asyncStdoutToPython("/get/selected_mic_device");
};
const setSelectedMicDevice = (selected_mic_device) => {
updateSelectedMicDevice(() => new Promise(() => {}));
asyncStdoutToPython("/controller/callback_set_mic_device", selected_mic_device);
asyncStdoutToPython("/set/selected_mic_device", selected_mic_device);
};
return {

View File

@@ -7,12 +7,12 @@ export const useSelectedMicHost = () => {
const getSelectedMicHost = () => {
updateSelectedMicHost(() => new Promise(() => {}));
asyncStdoutToPython("/config/choice_mic_host");
asyncStdoutToPython("/get/selected_mic_host");
};
const setSelectedMicHost = (selected_mic_host) => {
updateSelectedMicHost(() => new Promise(() => {}));
asyncStdoutToPython("/controller/callback_set_mic_host", selected_mic_host);
asyncStdoutToPython("/set/selected_mic_host", selected_mic_host);
};
return {

View File

@@ -7,12 +7,12 @@ export const useSelectedSpeakerDevice = () => {
const getSelectedSpeakerDevice = () => {
updateSelectedSpeakerDevice(() => new Promise(() => {}));
asyncStdoutToPython("/config/choice_speaker_device");
asyncStdoutToPython("/get/selected_speaker_device");
};
const setSelectedSpeakerDevice = (selected_speaker_device) => {
updateSelectedSpeakerDevice(() => new Promise(() => {}));
asyncStdoutToPython("/controller/callback_set_speaker_device", selected_speaker_device);
asyncStdoutToPython("/set/selected_speaker_device", selected_speaker_device);
};
return {

View File

@@ -7,12 +7,12 @@ export const useSendMessageButtonType = () => {
const getSendMessageButtonType = () => {
updateSendMessageButtonType(() => new Promise(() => {}));
asyncStdoutToPython("/config/send_message_button_type");
asyncStdoutToPython("/get/send_message_button_type");
};
const setSendMessageButtonType = (selected_type) => {
updateSendMessageButtonType(() => new Promise(() => {}));
asyncStdoutToPython("/controller/callback_set_send_message_button_type", selected_type);
asyncStdoutToPython("/set/send_message_button_type", selected_type);
};
return {

View File

@@ -7,7 +7,7 @@ export const useSoftwareVersion = () => {
const getSoftwareVersion = () => {
updateSoftwareVersion(() => new Promise(() => {}));
asyncStdoutToPython("/config/version");
asyncStdoutToPython("/get/version");
};
return {

View File

@@ -7,7 +7,7 @@ export const useSpeakerDeviceList = () => {
const getSpeakerDeviceList = () => {
updateSpeakerDeviceList(() => new Promise(() => {}));
asyncStdoutToPython("/controller/list_speaker_device");
asyncStdoutToPython("/get/list_speaker_device");
};
return {

View File

@@ -7,24 +7,24 @@ export const useSpeakerThreshold = () => {
const { updateEnableAutomaticSpeakerThreshold, currentEnableAutomaticSpeakerThreshold } = useStore_EnableAutomaticSpeakerThreshold();
const getSpeakerThreshold = () => {
asyncStdoutToPython("/config/input_speaker_energy_threshold");
asyncStdoutToPython("/get/speaker_energy_threshold");
};
const setSpeakerThreshold = (speaker_threshold) => {
asyncStdoutToPython("/controller/callback_set_speaker_energy_threshold", speaker_threshold);
asyncStdoutToPython("/set/speaker_energy_threshold", speaker_threshold);
};
const getEnableAutomaticSpeakerThreshold = () => {
updateEnableAutomaticSpeakerThreshold(() => new Promise(() => {}));
asyncStdoutToPython("/config/input_speaker_dynamic_energy_threshold");
asyncStdoutToPython("/get/speaker_dynamic_energy_threshold");
};
const toggleEnableAutomaticSpeakerThreshold = () => {
updateEnableAutomaticSpeakerThreshold(() => new Promise(() => {}));
if (currentEnableAutomaticSpeakerThreshold.data) {
asyncStdoutToPython("/controller/callback_disable_speaker_dynamic_energy_threshold");
asyncStdoutToPython("/set/disable_speaker_dynamic_energy_threshold");
} else {
asyncStdoutToPython("/controller/callback_enable_speaker_dynamic_energy_threshold");
asyncStdoutToPython("/set/enable_speaker_dynamic_energy_threshold");
}
};

View File

@@ -7,12 +7,12 @@ export const useUiLanguage = () => {
const getUiLanguage = () => {
updateUiLanguage(() => new Promise(() => {}));
asyncStdoutToPython("/config/ui_language");
asyncStdoutToPython("/get/ui_language");
};
const setUiLanguage = (selected_ui_language) => {
updateUiLanguage(() => new Promise(() => {}));
asyncStdoutToPython("/controller/callback_set_ui_language", selected_ui_language);
asyncStdoutToPython("/set/ui_language", selected_ui_language);
};
return {

View File

@@ -10,24 +10,24 @@ export const useLanguageSettings = () => {
const getEnableMultiTranslation = () => {
updateEnableMultiTranslation(() => new Promise(() => {}));
asyncStdoutToPython("/config/enable_multi_translation");
asyncStdoutToPython("/get/multi_language_translation");
};
const getSelectedPresetTabNumber = () => {
updateSelectedPresetTabNumber(() => new Promise(() => {}));
asyncStdoutToPython("/config/selected_tab_no");
asyncStdoutToPython("/get/selected_tab_no");
};
const setSelectedPresetTabNumber = (preset_number) => {
updateSelectedPresetTabNumber(() => new Promise(() => {}));
asyncStdoutToPython("/controller/callback_selected_language_preset_tab", preset_number);
asyncStdoutToPython("/set/selected_tab_no", preset_number);
};
const getSelectedYourLanguages = () => {
updateSelectedYourLanguages(() => new Promise(() => {}));
asyncStdoutToPython("/config/selected_tab_your_languages");
asyncStdoutToPython("/get/selected_your_languages");
};
const setSelectedYourLanguages = (selected_language_data) => {
@@ -41,13 +41,13 @@ export const useLanguageSettings = () => {
}
}
};
asyncStdoutToPython("/controller/set_your_language_and_country", send_obj);
asyncStdoutToPython("/set/selected_your_languages", send_obj);
};
const getSelectedTargetLanguages = () => {
updateSelectedTargetLanguages(() => new Promise(() => {}));
asyncStdoutToPython("/config/selected_tab_target_languages");
asyncStdoutToPython("/get/selected_target_languages");
};
const setSelectedTargetLanguages = (selected_language_data) => {
@@ -57,7 +57,7 @@ export const useLanguageSettings = () => {
send_obj[currentSelectedPresetTabNumber.data].primary.language = selected_language_data.language,
send_obj[currentSelectedPresetTabNumber.data].primary.country = selected_language_data.country,
asyncStdoutToPython("/controller/set_target_language_and_country", send_obj);
asyncStdoutToPython("/set/selected_target_languages", send_obj);
};
return {

View File

@@ -36,27 +36,27 @@ export const useMainFunction = () => {
const toggleTranslation = () => {
asyncUpdateTranslationStatus(asyncPending);
if (currentTranslationStatus.data) {
asyncStdoutToPython("/controller/callback_disable_translation");
asyncStdoutToPython("/set/disable_translation");
} else {
asyncStdoutToPython("/controller/callback_enable_translation");
asyncStdoutToPython("/set/enable_translation");
}
};
const toggleTranscriptionSend = () => {
asyncUpdateTranscriptionSendStatus(asyncPending);
if (currentTranscriptionSendStatus.data) {
asyncStdoutToPython("/controller/callback_disable_transcription_send");
asyncStdoutToPython("/set/disable_transcription_send");
} else {
asyncStdoutToPython("/controller/callback_enable_transcription_send");
asyncStdoutToPython("/set/enable_transcription_send");
}
};
const toggleTranscriptionReceive = () => {
asyncUpdateTranscriptionReceiveStatus(asyncPending);
if (currentTranscriptionReceiveStatus.data) {
asyncStdoutToPython("/controller/callback_disable_transcription_receive");
asyncStdoutToPython("/set/disable_transcription_receive");
} else {
asyncStdoutToPython("/controller/callback_enable_transcription_receive");
asyncStdoutToPython("/set/enable_transcription_receive");
}
};

View File

@@ -14,7 +14,7 @@ export const useMessage = () => {
id: uuid,
message: message,
};
asyncStdoutToPython("/controller/callback_messagebox_send", send_message_object);
asyncStdoutToPython("/run/send_message_box", send_message_object);
addMessageLogs({
id: uuid,

View File

@@ -72,77 +72,77 @@ export const useReceiveRoutes = () => {
} = useVolume();
const routes = {
"/controller/callback_enable_translation": updateTranslationStatus,
"/controller/callback_disable_translation": updateTranslationStatus,
"/controller/callback_enable_transcription_send": updateTranscriptionSendStatus,
"/controller/callback_disable_transcription_send": updateTranscriptionSendStatus,
"/controller/callback_enable_transcription_receive": updateTranscriptionReceiveStatus,
"/controller/callback_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,
"/config/selected_tab_no": updateSelectedPresetTabNumber,
"/controller/callback_selected_language_preset_tab": updateSelectedPresetTabNumber,
"/config/enable_multi_translation": updateEnableMultiTranslation,
"/config/selected_tab_your_languages": updateSelectedYourLanguages,
"/controller/set_your_language_and_country": updateSelectedYourLanguages,
"/config/selected_tab_target_languages": updateSelectedTargetLanguages,
"/controller/set_your_language_and_country": updateSelectedTargetLanguages,
"/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,
"/controller/list_language_and_country": updateSelectableLanguageList,
"/get/list_languages": updateSelectableLanguageList,
"/config/version": updateSoftwareVersion,
"/get/version": updateSoftwareVersion,
"/config/enable_mic_automatic_selection": updateEnableAutoMicSelect,
"/controller/callback_enable_mic_automatic_selection": updateEnableAutoMicSelect,
"/controller/callback_disable_mic_automatic_selection": updateEnableAutoMicSelect,
"/config/enable_speaker_automatic_selection": updateEnableAutoSpeakerSelect,
"/controller/callback_enable_speaker_automatic_selection": updateEnableAutoSpeakerSelect,
"/controller/callback_disable_speaker_automatic_selection": updateEnableAutoSpeakerSelect,
"/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,
"/controller/list_mic_host": (payload) => updateMicHostList(arrayToObject(payload)),
"/config/choice_mic_host": updateSelectedMicHost,
"/controller/callback_set_mic_host": (payload) => {
"/get/list_mic_host": (payload) => updateMicHostList(arrayToObject(payload)),
"/get/selected_mic_host": updateSelectedMicHost,
"/set/selected_mic_host": (payload) => {
updateSelectedMicHost(payload.host);
updateSelectedMicDevice(payload.device);
},
"/controller/list_mic_device": (payload) => updateMicDeviceList(arrayToObject(payload)),
"/config/choice_mic_device": updateSelectedMicDevice,
"/controller/callback_set_mic_device": updateSelectedMicDevice,
"/get/list_mic_device": (payload) => updateMicDeviceList(arrayToObject(payload)),
"/get/selected_mic_device": updateSelectedMicDevice,
"/set/selected_mic_device": updateSelectedMicDevice,
"/controller/list_speaker_device": (payload) => updateSpeakerDeviceList(arrayToObject(payload)),
"/config/choice_speaker_device": updateSelectedSpeakerDevice,
"/controller/callback_set_speaker_device": updateSelectedSpeakerDevice,
"/get/list_speaker_device": (payload) => updateSpeakerDeviceList(arrayToObject(payload)),
"/get/selected_speaker_device": updateSelectedSpeakerDevice,
"/set/selected_speaker_device": updateSelectedSpeakerDevice,
"/action/check_mic_threshold_energy": updateVolumeVariable_Mic,
"/action/check_speaker_threshold_energy": updateVolumeVariable_Speaker,
"/controller/callback_enable_check_mic_threshold": updateMicThresholdCheckStatus,
"/controller/callback_disable_check_mic_threshold": updateMicThresholdCheckStatus,
"/controller/callback_enable_check_speaker_threshold": updateSpeakerThresholdCheckStatus,
"/controller/callback_disable_check_speaker_threshold": updateSpeakerThresholdCheckStatus,
"/set/enable_check_mic_threshold": updateMicThresholdCheckStatus,
"/set/disable_check_mic_threshold": updateMicThresholdCheckStatus,
"/set/enable_check_speaker_threshold": updateSpeakerThresholdCheckStatus,
"/set/disable_check_speaker_threshold": updateSpeakerThresholdCheckStatus,
"/config/enable_auto_clear_message_box": updateEnableAutoClearMessageBox,
"/controller/callback_enable_auto_clear_chatbox": updateEnableAutoClearMessageBox,
"/controller/callback_disable_auto_clear_chatbox": updateEnableAutoClearMessageBox,
"/get/auto_clear_message_box": updateEnableAutoClearMessageBox,
"/set/enable_auto_clear_message_box": updateEnableAutoClearMessageBox,
"/set/disable_auto_clear_message_box": updateEnableAutoClearMessageBox,
"/config/send_message_button_type": updateSendMessageButtonType,
"/controller/callback_set_send_message_button_type": updateSendMessageButtonType,
"/get/send_message_button_type": updateSendMessageButtonType,
"/set/send_message_button_type": updateSendMessageButtonType,
"/config/input_mic_energy_threshold": updateMicThreshold,
"/controller/callback_set_mic_energy_threshold": updateMicThreshold,
"/config/input_speaker_energy_threshold": updateSpeakerThreshold,
"/controller/callback_set_speaker_energy_threshold": updateSpeakerThreshold,
"/get/mic_energy_threshold": updateMicThreshold,
"/set/mic_energy_threshold": updateMicThreshold,
"/get/speaker_energy_threshold": updateSpeakerThreshold,
"/set/speaker_energy_threshold": updateSpeakerThreshold,
"/config/input_mic_dynamic_energy_threshold": updateEnableAutomaticMicThreshold,
"/controller/callback_enable_mic_dynamic_energy_threshold": updateEnableAutomaticMicThreshold,
"/controller/callback_disable_mic_dynamic_energy_threshold": updateEnableAutomaticMicThreshold,
"/config/input_speaker_dynamic_energy_threshold": updateEnableAutomaticSpeakerThreshold,
"/controller/callback_enable_speaker_dynamic_energy_threshold": updateEnableAutomaticSpeakerThreshold,
"/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,
"/config/ui_language": updateUiLanguage,
"/controller/callback_set_ui_language": updateUiLanguage,
"/get/ui_language": updateUiLanguage,
"/set/ui_language": updateUiLanguage,
"/controller/callback_messagebox_send": updateSentMessageLogById,
"/run/send_message_box": updateSentMessageLogById,
"/action/transcription_send_mic_message": addSentMessageLog,
"/action/transcription_receive_speaker_message": addReceivedMessageLog
};

View File

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

View File

@@ -18,11 +18,11 @@ export const useVolume = () => {
return {
volumeCheckStart_Mic: () => {
updateMicThresholdCheckStatus(asyncPending);
asyncStdoutToPython("/controller/callback_enable_check_mic_threshold");
asyncStdoutToPython("/set/enable_check_mic_threshold");
},
volumeCheckStop_Mic: () => {
updateMicThresholdCheckStatus(asyncPending);
asyncStdoutToPython("/controller/callback_disable_check_mic_threshold");
asyncStdoutToPython("/set/disable_check_mic_threshold");
},
updateVolumeVariable_Mic: (payload) => {
updateMicVolume(payload);
@@ -36,11 +36,11 @@ export const useVolume = () => {
volumeCheckStart_Speaker: () => {
updateSpeakerVolume("0");
updateSpeakerThresholdCheckStatus(asyncPending);
asyncStdoutToPython("/controller/callback_enable_check_speaker_threshold");
asyncStdoutToPython("/set/enable_check_speaker_threshold");
},
volumeCheckStop_Speaker: () => {
updateSpeakerThresholdCheckStatus(asyncPending);
asyncStdoutToPython("/controller/callback_disable_check_speaker_threshold");
asyncStdoutToPython("/set/disable_check_speaker_threshold");
},
updateVolumeVariable_Speaker: (payload) => {
updateSpeakerVolume(payload);