Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,9 @@ const uploadRecording = async (audioBlob: Blob) => {
recorderStatus.value = 'TRANSCRIBING'
const formData = new FormData()
formData.append('file', audioBlob, 'recording.mp3')
bus.emit('on:transcribing', true)
if (props.applicationDetails.stt_autosend) {
bus.emit('on:transcribing', true)
}
applicationApi
.postSpeechToText(props.applicationDetails.id as string, formData, localLoading)
.then((response) => {
Expand Down Expand Up @@ -767,7 +769,7 @@ function autoSendMessage() {
document_list: uploadDocumentList.value,
audio_list: uploadAudioList.value,
video_list: uploadVideoList.value,
other_list: uploadOtherList.value,
other_list: uploadOtherList.value
})
inputValue.value = ''
uploadImageList.value = []
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code has several improvements. First, redundant checks can be removed for recorderStatus.value in the uploadRecording function. Additionally, you should use an await keyword when calling .emit() inside .then() to ensure correct flow handling of asynchronous operations.

Updated Code:

@@ -688,13 +688,7 @@ const uploadRecording = async (audioBlob: Blob) => {
   recorderStatus.value = 'TRANSCRIBING'

   const formData = new FormData();
   formData.append('file', audioBlob, 'recording.mp3');

-  if (props.applicationDetails.stt_autosend) {
-    bus.emit('on:transcribing', true);
-  } else {
-    // Optional message or status update here
-  }

+  bus.emit('on:transcribing', true);

   try {
     const response = await applicationApi.postSpeechToText(
       props.applicationDetails.id as string,
       formData
     );

In addition, there's a small typo which can be fixed by using single quotes throughout:

Original line with double quotes:

'other_list': uploadOtherList.value,

Corrected version:

'other_list': uploadOtherList.value

Expand Down