Enhance CivitaiClient error handling for unauthorized access

- Updated handling of 401 unauthorized responses to differentiate between API key issues and early access restrictions.
- Improved logging for unauthorized access attempts.
- Refactored condition to check for early access restrictions based on response headers.
- Adjusted logic in DownloadManager to check for early access using a more concise method.
This commit is contained in:
Will Miao
2025-03-28 04:11:08 +08:00
parent fd1435537f
commit 1420ab31a2
2 changed files with 9 additions and 3 deletions

View File

@@ -29,7 +29,7 @@ class DownloadManager:
return {'success': False, 'error': 'Failed to fetch model metadata'}
# Check if this is an early access LoRA
if 'earlyAccessEndsAt' in version_info:
if version_info.get('earlyAccessEndsAt'):
early_access_date = version_info.get('earlyAccessEndsAt', '')
# Convert to a readable date if possible
try: