fix gpt 4v upload image issue (#1799)

Co-authored-by: jyong <jyong@dify.ai>
This commit is contained in:
Jyong 2023-12-20 13:03:08 +08:00 committed by GitHub
parent 7c5661152e
commit 022450768f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,9 +30,11 @@ class FileService:
etl_type = current_app.config['ETL_TYPE'] etl_type = current_app.config['ETL_TYPE']
if etl_type == 'Unstructured': if etl_type == 'Unstructured':
allowed_extensions = ['txt', 'markdown', 'md', 'pdf', 'html', 'htm', 'xlsx', allowed_extensions = ['txt', 'markdown', 'md', 'pdf', 'html', 'htm', 'xlsx',
'docx', 'csv', 'eml', 'msg', 'pptx', 'ppt', 'xml'] 'docx', 'csv', 'eml', 'msg', 'pptx', 'ppt', 'xml',
'jpg', 'jpeg', 'png', 'webp', 'gif', 'svg']
else: else:
allowed_extensions = ['txt', 'markdown', 'md', 'pdf', 'html', 'htm', 'xlsx', 'docx', 'csv'] allowed_extensions = ['txt', 'markdown', 'md', 'pdf', 'html', 'htm', 'xlsx', 'docx', 'csv',
'jpg', 'jpeg', 'png', 'webp', 'gif', 'svg']
if extension.lower() not in allowed_extensions: if extension.lower() not in allowed_extensions:
raise UnsupportedFileTypeError() raise UnsupportedFileTypeError()
elif only_image and extension.lower() not in IMAGE_EXTENSIONS: elif only_image and extension.lower() not in IMAGE_EXTENSIONS: