mirror of
https://github.com/xtekky/gpt4free.git
synced 2026-04-22 15:47:11 +08:00
Add default active state to OperaAria and enhance quota tracking in Ollama
This commit is contained in:
@@ -71,6 +71,7 @@ class OperaAria(AsyncGeneratorProvider, ProviderModelMixin):
|
||||
check_status_endpoint = "https://composer.opera-api.com/api/v1/images/check-status/"
|
||||
|
||||
working = True
|
||||
active_by_default = True
|
||||
needs_auth = False
|
||||
supports_stream = True
|
||||
supports_system_message = True
|
||||
|
||||
@@ -78,6 +78,16 @@ class Ollama(OpenaiTemplate):
|
||||
"used_percent": pct,
|
||||
"reset_time": reset_time,
|
||||
}
|
||||
match = re.search(r'<span class="text-sm">Premium requests</span>\s*<span class="text-sm">(\d+)/(\d+) used</span>\s*</div>', html)
|
||||
if match:
|
||||
used = int(match.group(1))
|
||||
total = int(match.group(2))
|
||||
pct = (used / total) * 100 if total > 0 else None
|
||||
quota["premium_requests"] = {
|
||||
"used": used,
|
||||
"total": total,
|
||||
"used_percent": pct,
|
||||
}
|
||||
except Exception as e:
|
||||
raise RuntimeError(f"Failed to get quota information from Ollama: {e}")
|
||||
if not quota:
|
||||
|
||||
@@ -129,6 +129,8 @@ class Video(AsyncGeneratorProvider, ProviderModelMixin):
|
||||
if prompt not in RequestConfig.urls:
|
||||
RequestConfig.urls[prompt] = []
|
||||
def on_request(event: nodriver.cdp.network.RequestWillBeSent, page=None):
|
||||
if not hasattr(event, "request"):
|
||||
return
|
||||
if event.request.url.startswith(cls.drive_url) or ".mp4" in event.request.url:
|
||||
RequestConfig.headers = {}
|
||||
for key, value in event.request.headers.items():
|
||||
|
||||
Reference in New Issue
Block a user