diff --git a/vocodes/src/v2/view/NewVocodesContainer.tsx b/vocodes/src/v2/view/NewVocodesContainer.tsx index c75a94cf8c..58f8e1f041 100644 --- a/vocodes/src/v2/view/NewVocodesContainer.tsx +++ b/vocodes/src/v2/view/NewVocodesContainer.tsx @@ -153,6 +153,9 @@ class NewVocodesContainer extends React.Component { sessionWrapper={this.props.sessionWrapper} enqueueTtsJob={this.props.enqueueTtsJob} ttsInferenceJobs={this.props.ttsInferenceJobs} + textBuffer={this.props.textBuffer} + setTextBuffer={this.props.setTextBuffer} + clearTextBuffer={this.props.clearTextBuffer} /> diff --git a/vocodes/src/v2/view/tts/tts_model_view/TtsModelViewFc.tsx b/vocodes/src/v2/view/tts/tts_model_view/TtsModelViewFc.tsx index f5ba8031a1..d1c1cfdcf3 100644 --- a/vocodes/src/v2/view/tts/tts_model_view/TtsModelViewFc.tsx +++ b/vocodes/src/v2/view/tts/tts_model_view/TtsModelViewFc.tsx @@ -17,6 +17,9 @@ interface Props { sessionWrapper: SessionWrapper, enqueueTtsJob: (jobToken: string) => void, ttsInferenceJobs: Array, + textBuffer: string, + setTextBuffer: (textBuffer: string) => void, + clearTextBuffer: () => void, } function TtsModelViewFc(props: Props) { @@ -24,7 +27,6 @@ function TtsModelViewFc(props: Props) { const [ttsModel, setTtsModel] = useState(undefined); const [ttsModelUseCount, setTtsModelUseCount] = useState(undefined); - const [text, setText] = useState(""); const getModel = useCallback(async (token) => { const model = await GetTtsModel(token); @@ -44,11 +46,13 @@ function TtsModelViewFc(props: Props) { }, [token, getModel, getModelUseCount]); const handleChangeText = (ev: React.FormEvent) => { - ev.preventDefault(); const textValue = (ev.target as HTMLTextAreaElement).value; + props.setTextBuffer(textValue); + }; - setText(textValue); - + const handleClearClick = (ev: React.FormEvent) => { + ev.preventDefault(); + props.clearTextBuffer(); return false; }; @@ -59,7 +63,7 @@ function TtsModelViewFc(props: Props) { return false; } - if (text === undefined) { + if (props.textBuffer === undefined) { return false; } @@ -71,7 +75,7 @@ function TtsModelViewFc(props: Props) { const request = { uuid_idempotency_token: uuidv4(), tts_model_token: modelToken, - inference_text: text, + inference_text: props.textBuffer, } fetch(endpointUrl, { @@ -236,10 +240,20 @@ function TtsModelViewFc(props: Props) {
- +
+
+
+ +
+
+ +
+
+