From 188311187a13429a4c92d5059edd957854d02587 Mon Sep 17 00:00:00 2001 From: vinodkiran Date: Thu, 18 Jan 2024 13:04:25 +0530 Subject: [PATCH] GPT Vision: Fix for error when only speech input is sent. --- packages/server/src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts index 61aff470..7f1b9414 100644 --- a/packages/server/src/index.ts +++ b/packages/server/src/index.ts @@ -1606,7 +1606,7 @@ export class App { if (incomingInput.uploads) { // @ts-ignore ;(incomingInput.uploads as any[]).forEach((upload: any) => { - if (upload.type === 'file') { + if (upload.type === 'file' || upload.type === 'audio') { const filename = upload.name const dir = path.join(getUserHome(), '.flowise', 'gptvision', chatId) if (!fs.existsSync(dir)) { @@ -1615,7 +1615,7 @@ export class App { const filePath = path.join(dir, filename) const splitDataURI = upload.data.split(',') const bf = Buffer.from(splitDataURI.pop() || '', 'base64') - //TODO: check if file exists, what should we do if it exists? + //writes data to a file, replacing the file if it already exists. fs.writeFileSync(filePath, bf) // don't need to store the file contents in chatmessage, just the filename and chatId upload.data = chatId