More bugfixes

This commit is contained in:
2026-01-07 09:58:58 +01:00
parent d4f1a1c6a4
commit 2c9f33868e

9
oai.py
View File

@@ -5034,6 +5034,15 @@ All queries are read-only. INSERT/UPDATE/DELETE are not allowed."""
try: try:
if hasattr(response, 'close'): if hasattr(response, 'close'):
response.close() response.close()
elif hasattr(response, '__exit__'):
response.__exit__(None, None, None)
except:
pass
# Recreate client to be safe
try:
client = OpenRouter(api_key=API_KEY)
app_logger.info("Client recreated after stream interruption")
except: except:
pass pass