XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/gpt4free

Fix show thumbnail

0cb3057c
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

1 个文件 +5 -4
Modified g4f/api/__init__.py +5 -4
@@ -684,12 +684,11 @@ class Api:
684 684 other_name = os.path.join(get_media_dir(), os.path.basename(quote_plus(filename)))
685 685 if os.path.isfile(other_name):
686 686 target = other_name
687 result = target
688 687 ext = os.path.splitext(filename)[1][1:]
689 688 mime_type = EXTENSIONS_MAP.get(ext)
690 689 if thumbnail and has_pillow and os.path.isfile(thumbnail):
691 690 stat_result = os.stat(thumbnail)
692 elif os.path.isfile(target):
691 elif not thumbnail and os.path.isfile(target):
693 692 stat_result = os.stat(target)
694 693 else:
695 694 stat_result = SimpleNamespace()
@@ -745,8 +744,10 @@ class Api:
745 744 debug.log(f"Thumbnail created: {thumbnail}")
746 745 except Exception as e:
747 746 logger.exception(e)
748 if os.path.isfile(thumbnail):
749 result = thumbnail
747 if thumbnail and os.path.isfile(thumbnail):
748 result = thumbnail
749 else:
750 result = target
750 751 if not os.path.isfile(result):
751 752 return ErrorResponse.from_message("File not found", HTTP_404_NOT_FOUND)
752 753 async def stream():