Skip to content

Commit

Permalink
update: queue handling user input as well
Browse files Browse the repository at this point in the history
  • Loading branch information
PrinceBaghel258025 committed Sep 23, 2024
1 parent c316649 commit 7975477
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/components/inputBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,9 @@ const InputBar = (props: InputBarProps) => {
};

useEffect(() => {
props?.setInput?.(Object.values(transcriptHashTable).join(" "));
if (Object.keys(transcriptHashTable).length > 0) {
props?.setInput?.(Object.values(transcriptHashTable).join(" "));
}
}, [transcriptHashTable]);
useEffect(() => {
if (
Expand Down Expand Up @@ -600,9 +602,16 @@ const InputBar = (props: InputBarProps) => {
onStartListening={() => {
setIsBlinking(true);
setIsAudioWaveVisible(true);
const newAudioId = audioId + 1;
setAudioId(newAudioId);
setTranscriptHashTable((prev) => ({
...prev,
[newAudioId]: props.value,
}));
}}
onStopListening={() => {
setIsBlinking(false);
setTranscriptHashTable({});
setIsAudioWaveVisible(false);
}}
// disabled={isRecording || isTranscribing || disableInputs}
Expand Down
12 changes: 11 additions & 1 deletion src/components/inputBar2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,9 @@ const InputBar = (props: InputBarProps) => {
};

useEffect(() => {
props?.setInput?.(Object.values(transcriptHashTable).join(" "));
if (Object.keys(transcriptHashTable).length > 0) {
props?.setInput?.(Object.values(transcriptHashTable).join(" "));
}
}, [transcriptHashTable]);

//TODO:
Expand Down Expand Up @@ -457,9 +459,17 @@ const InputBar = (props: InputBarProps) => {
onStartListening={() => {
setIsBlinking(true);
setIsAudioWaveVisible(true);
const newAudioId = audioId + 1;
setAudioId(newAudioId);
setTranscriptHashTable((prev) => ({
...prev,
[newAudioId]: props?.value || "",
}));
setIsAudioWaveVisible(true);
}}
onStopListening={() => {
setIsBlinking(false);
setTranscriptHashTable({});
setIsAudioWaveVisible(false);
}}
// disabled={isRecording || isTranscribing || disableInputs}
Expand Down

0 comments on commit 7975477

Please sign in to comment.