mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-29 11:01:18 +03:00
GPT Vision: Fix for error when only speech input is sent.
This commit is contained in:
@@ -1606,7 +1606,7 @@ export class App {
|
|||||||
if (incomingInput.uploads) {
|
if (incomingInput.uploads) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
;(incomingInput.uploads as any[]).forEach((upload: any) => {
|
;(incomingInput.uploads as any[]).forEach((upload: any) => {
|
||||||
if (upload.type === 'file') {
|
if (upload.type === 'file' || upload.type === 'audio') {
|
||||||
const filename = upload.name
|
const filename = upload.name
|
||||||
const dir = path.join(getUserHome(), '.flowise', 'gptvision', chatId)
|
const dir = path.join(getUserHome(), '.flowise', 'gptvision', chatId)
|
||||||
if (!fs.existsSync(dir)) {
|
if (!fs.existsSync(dir)) {
|
||||||
@@ -1615,7 +1615,7 @@ export class App {
|
|||||||
const filePath = path.join(dir, filename)
|
const filePath = path.join(dir, filename)
|
||||||
const splitDataURI = upload.data.split(',')
|
const splitDataURI = upload.data.split(',')
|
||||||
const bf = Buffer.from(splitDataURI.pop() || '', 'base64')
|
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)
|
fs.writeFileSync(filePath, bf)
|
||||||
// don't need to store the file contents in chatmessage, just the filename and chatId
|
// don't need to store the file contents in chatmessage, just the filename and chatId
|
||||||
upload.data = chatId
|
upload.data = chatId
|
||||||
|
|||||||
Reference in New Issue
Block a user