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

XFEstudio/gpt4free

fix: Update cache logic and authorization header condition in PollinationsAI provider

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

代码差异

1 个文件 +2 -2
Modified g4f/Provider/PollinationsAI.py +2 -2
@@ -251,7 +251,7 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
251 251 **kwargs
252 252 ) -> AsyncResult:
253 253 if cache is None:
254 cache = kwargs.get("action") != "variant"
254 cache = kwargs.get("action") is None or kwargs.get("action") != "variant"
255 255 if extra_body is None:
256 256 extra_body = {}
257 257 if not model:
@@ -483,7 +483,7 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
483 483 headers = None
484 484 if api_key and not api_key.startswith("g4f_") and not api_key.startswith("gfs_"):
485 485 headers = {"authorization": f"Bearer {api_key}"}
486 elif cls.balance > 0:
486 elif cls.balance and cls.balance > 0:
487 487 headers = {"authorization": f"Bearer {''.join(cls.api_key)}"}
488 488 yield JsonRequest.from_dict(data)
489 489 if headers: