Merge branch 'ui' into for_webui

This commit is contained in:
Sakamoto Shiina
2024-12-02 20:05:59 +09:00
4 changed files with 35 additions and 9 deletions

View File

@@ -14,6 +14,8 @@ export const MessageInputBox = () => {
currentMessageLogs,
currentMessageInputValue,
updateMessageInputValue,
startTyping,
stopTyping,
} = useMessage();
const { currentEnableAutoClearMessageInputBox } = useEnableAutoClearMessageInputBox();
@@ -45,16 +47,12 @@ export const MessageInputBox = () => {
};
const onChangeFunction = (e) => {
updateMessageInputValue(e.currentTarget.value);
const value = e.currentTarget.value;
updateMessageInputValue(value);
value.trim() ? startTyping() : stopTyping();
};
const onKeyDownFunction = (e) => {
if (currentSendMessageButtonType.data === "show_and_disable_enter_key") return;
if (e.keyCode === 13 && !e.shiftKey) {
onSubmitFunction(e);
}
if (e.key === "ArrowUp" && e.shiftKey) {
e.preventDefault();
@@ -78,6 +76,13 @@ export const MessageInputBox = () => {
);
}
}
if (currentSendMessageButtonType.data === "show_and_disable_enter_key") return;
if (e.keyCode === 13 && !e.shiftKey) {
onSubmitFunction(e);
}
};
return (
@@ -86,6 +91,7 @@ export const MessageInputBox = () => {
<textarea
className={styles.message_box_input_area}
onChange={onChangeFunction}
onBlur={stopTyping}
placeholder="Input Textfield"
value={currentMessageInputValue.data}
onKeyDown={onKeyDownFunction}

View File

@@ -5,7 +5,7 @@ import HelpSvg from "@images/help.svg?react";
import { useStore_OpenedQuickSetting } from "@store";
import { useIsSoftwareUpdateAvailable } from "@logics_common";
import { useIsEnabledOverlaySmallLog, useEnableVrcMicMuteSync } from "@logics_configs";
import { useIsEnabledOverlaySmallLog, useIsEnabledOverlayLargeLog, useEnableVrcMicMuteSync } from "@logics_configs";
import { OpenQuickSettingButton } from "./_buttons/OpenQuickSettingButton";
export const RightSideComponents = () => {
@@ -30,15 +30,18 @@ const OpenOverlayQuickSetting = () => {
// const { t } = useTranslation();
const { updateOpenedQuickSetting } = useStore_OpenedQuickSetting();
const { currentIsEnabledOverlaySmallLog } = useIsEnabledOverlaySmallLog();
const { currentIsEnabledOverlayLargeLog } = useIsEnabledOverlayLargeLog();
const onClickFunction = () => {
updateOpenedQuickSetting("overlay");
};
const is_enable = currentIsEnabledOverlaySmallLog.data === true || currentIsEnabledOverlayLargeLog.data === true;
return (
<OpenQuickSettingButton
label="Overlay(VR)"
variable={currentIsEnabledOverlaySmallLog.data}
variable={is_enable}
onClickFunction={onClickFunction}
/>
);

View File

@@ -42,6 +42,13 @@ export const useMessage = () => {
addMessageLogs(message_object);
};
const startTyping = () => {
asyncStdoutToPython("/run/typing_message_box");
};
const stopTyping = () => {
asyncStdoutToPython("/run/stop_typing_message_box");
};
return {
currentMessageLogs,
sendMessage,
@@ -51,6 +58,9 @@ export const useMessage = () => {
currentMessageInputValue,
updateMessageInputValue,
startTyping,
stopTyping,
};
};

View File

@@ -222,6 +222,8 @@ export const useReceiveRoutes = () => {
// Message
"/run/send_message_box": updateSentMessageLogById,
"/run/typing_message_box": ()=>{},
"/run/stop_typing_message_box": ()=>{},
"/run/transcription_send_mic_message": addSentMessageLog,
"/run/transcription_receive_speaker_message": addReceivedMessageLog,
@@ -424,6 +426,11 @@ export const useReceiveRoutes = () => {
"/get/data/osc_port": updateOscPort,
"/set/data/osc_port": updateOscPort,
"/get/data/mic_avg_logprob": ()=>{}, // Not implemented on UI yet
"/get/data/mic_no_speech_prob": ()=>{}, // Not implemented on UI yet
"/get/data/speaker_avg_logprob": ()=>{}, // Not implemented on UI yet
"/get/data/speaker_no_speech_prob": ()=>{}, // Not implemented on UI yet
};
const error_routes = {