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

XFEstudio/gpt4free

fix: enhance error handling for RateLimitError in API response streaming

63a09b74
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

1 个文件 +3 -0
Modified g4f/api/__init__.py +3 -0
@@ -544,6 +544,9 @@ class Api:
544 544 yield f"data: {chunk.model_dump_json() if hasattr(chunk, 'model_dump_json') else chunk.json()}\n\n"
545 545 except GeneratorExit:
546 546 pass
547 except RateLimitError as e:
548 debug.error(e)
549 yield f'data: {format_exception(e, config)}\n\n'
547 550 except Exception as e:
548 551 logger.exception(e)
549 552 yield f'data: {format_exception(e, config)}\n\n'