diff --git a/api/files.py b/api/files.py index 2ec0b2c..2357be0 100644 --- a/api/files.py +++ b/api/files.py @@ -15,7 +15,8 @@ async def get_file_content(url): client = Client() try: r = await client.get(url) - r.raise_for_status() + if r.status_code != 200: + return None, None file_content = r.content mime_type = r.headers.get('Content-Type', '').split(';')[0].strip() return file_content, mime_type diff --git a/chatgpt/ChatService.py b/chatgpt/ChatService.py index 3e27f20..70063d2 100644 --- a/chatgpt/ChatService.py +++ b/chatgpt/ChatService.py @@ -410,6 +410,9 @@ class ChatService: return False async def upload_file(self, file_content, mime_type): + if not file_content or not mime_type: + return None + width, height = None, None if mime_type.startswith("image/"): try: