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

XFEstudio/gpt4free

Add default active state to OperaAria and enhance quota tracking in Ollama

e4fcd38d
hlohaus <hlohaus@users.noreply.github.com>
提交于

代码差异

3 个文件 +13 -0
Modified g4f/Provider/OperaAria.py +1 -0
@@ -71,6 +71,7 @@ class OperaAria(AsyncGeneratorProvider, ProviderModelMixin):
71 71 check_status_endpoint = "https://composer.opera-api.com/api/v1/images/check-status/"
72 72
73 73 working = True
74 active_by_default = True
74 75 needs_auth = False
75 76 supports_stream = True
76 77 supports_system_message = True
Modified g4f/Provider/local/Ollama.py +10 -0
@@ -78,6 +78,16 @@ class Ollama(OpenaiTemplate):
78 78 "used_percent": pct,
79 79 "reset_time": reset_time,
80 80 }
81 match = re.search(r'<span class="text-sm">Premium requests</span>\s*<span class="text-sm">(\d+)/(\d+) used</span>\s*</div>', html)
82 if match:
83 used = int(match.group(1))
84 total = int(match.group(2))
85 pct = (used / total) * 100 if total > 0 else None
86 quota["premium_requests"] = {
87 "used": used,
88 "total": total,
89 "used_percent": pct,
90 }
81 91 except Exception as e:
82 92 raise RuntimeError(f"Failed to get quota information from Ollama: {e}")
83 93 if not quota:
Modified g4f/Provider/needs_auth/Video.py +2 -0
@@ -129,6 +129,8 @@ class Video(AsyncGeneratorProvider, ProviderModelMixin):
129 129 if prompt not in RequestConfig.urls:
130 130 RequestConfig.urls[prompt] = []
131 131 def on_request(event: nodriver.cdp.network.RequestWillBeSent, page=None):
132 if not hasattr(event, "request"):
133 return
132 134 if event.request.url.startswith(cls.drive_url) or ".mp4" in event.request.url:
133 135 RequestConfig.headers = {}
134 136 for key, value in event.request.headers.items():