Bugfix/speech input on Safari/iOS (#1971)

* debug to identify

* Safari sends audio file as mp4 and nor webp

* Safari on iOS needs special handling

* lint fixes

* updated condition

* Remove unused import

---------

Co-authored-by: Ilango <rajagopalilango@gmail.com>
This commit is contained in:
Vinod Kiran
2024-04-19 05:58:09 +05:30
committed by GitHub
parent d1c8f7eb96
commit 6bd8aaefc8
4 changed files with 17 additions and 5 deletions
+2 -1
View File
@@ -66,6 +66,7 @@ export const utilBuildChatflow = async (req: Request, socketIO?: Server, isInter
fileUploads = incomingInput.uploads
for (let i = 0; i < fileUploads.length; i += 1) {
const upload = fileUploads[i]
if ((upload.type === 'file' || upload.type === 'audio') && upload.data) {
const filename = upload.name
const dir = path.join(getStoragePath(), chatflowid, chatId)
@@ -83,7 +84,7 @@ export const utilBuildChatflow = async (req: Request, socketIO?: Server, isInter
}
// Run Speech to Text conversion
if (upload.mime === 'audio/webm') {
if (upload.mime === 'audio/webm' || upload.mime === 'audio/mp4') {
let speechToTextConfig: ICommonObject = {}
if (chatflow.speechToText) {
const speechToTextProviders = JSON.parse(chatflow.speechToText)