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

This commit is contained in:
hlohaus
2026-04-05 19:52:04 +02:00
parent 80477446ff
commit e4fcd38d3c
3 changed files with 13 additions and 0 deletions
+1
View File
@@ -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
+10
View File
@@ -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:
+2
View File
@@ -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():