Skip to content

Commit

Permalink
fix: stt bug
Browse files Browse the repository at this point in the history
  • Loading branch information
prtkjakhar committed Jun 20, 2023
1 parent 2236837 commit 5e461e8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion apps/agri-mitra/src/components/HomePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ const HomePage: NextPage = () => {
<form onSubmit={(event) => event?.preventDefault()}>
<div className={styles.inputBox}>
<div>
<RenderVoiceRecorder setInputMsg={setInputMsg} />
<RenderVoiceRecorder setInputMsg={setInputMsg} wordToNumber={false}/>
</div>
<input
type="text"
Expand Down
17 changes: 9 additions & 8 deletions apps/agri-mitra/src/components/recorder/RenderVoiceRecorder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { AppContext } from '../../context';
import { useLocalization } from '../../hooks';
import flagsmith from 'flagsmith/isomorphic';

const RenderVoiceRecorder = ({ setInputMsg, wordToNumber }) => {
const RenderVoiceRecorder = ( props ) => {
const model_id_1 = flagsmith.getValue('model_id_1');
const model_id_2 = flagsmith.getValue('model_id_2');
const t = useLocalization();
Expand Down Expand Up @@ -205,8 +205,8 @@ const RenderVoiceRecorder = ({ setInputMsg, wordToNumber }) => {

// if (response.ok) {
// const text = await response.json();
// setInputMsg(text?.output?.[0]?.source);
// // setInputMsg('मेरा पैसा कहाँ है');
// props.setInputMsg(text?.output?.[0]?.source);
// // props.setInputMsg('मेरा पैसा कहाँ है');
// } else {
// console.error('Error:', response.status);
// }
Expand Down Expand Up @@ -275,8 +275,9 @@ const RenderVoiceRecorder = ({ setInputMsg, wordToNumber }) => {
.then(async (resp) => {
let rsp_data = await resp.json();
if (resp.ok && rsp_data !== null) {
// console.log("hi", rsp_data.data.source);
if (wordToNumber) {
console.log("hi", rsp_data.data.source);
console.log("hi", props.wordToNumber);
if (props.wordToNumber) {
// translating other language words to english words
if (localStorage.getItem('locale') !== 'en') {
const obj = new ComputeAPI(
Expand Down Expand Up @@ -305,10 +306,10 @@ const RenderVoiceRecorder = ({ setInputMsg, wordToNumber }) => {
// }));
}
// console.log("hi", rsp_data.output[0].target)
setInputMsg(wordToNumber(rsp_data.output[0].target));
props.setInputMsg(wordToNumber(rsp_data.output[0].target));
});
} else setInputMsg(wordToNumber(rsp_data.data.source));
} else setInputMsg(rsp_data.data.source);
} else props.setInputMsg(wordToNumber(rsp_data.data.source));
} else props.setInputMsg(rsp_data.data.source);
// setSuggestEditValues((prev) => ({
// ...prev,
// asr: rsp_data.data.source,
Expand Down

0 comments on commit 5e461e8

Please sign in to comment.