refactor(backend): extract shared helper modules per architecture rules
- Add backend/ai/utils.py — parse_classification, parse_suggestions, strip_code_fences shared by all AI providers; removes duplicated private functions from anthropic_provider.py and openai_provider.py - Add backend/deps/utils.py — get_client_ip, parse_uuid request-parsing helpers; removes local _ip() variants from admin.py, auth.py, shares.py, folders.py - Add backend/storage/exceptions.py — canonical CloudConnectionError definition; all routers and backends import from here instead of redefining - Move validate_password_strength to backend/services/auth.py; removes duplicated _validate_password_strength from admin.py and auth.py Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -76,12 +76,7 @@ async def _run(document_id: str) -> dict:
|
||||
if user is None:
|
||||
return {"document_id": document_id, "status": "missing_user"}
|
||||
|
||||
try:
|
||||
from storage.google_drive_backend import CloudConnectionError
|
||||
except ImportError:
|
||||
class CloudConnectionError(Exception): # type: ignore[no-redef]
|
||||
pass
|
||||
|
||||
from storage.exceptions import CloudConnectionError
|
||||
try:
|
||||
backend = await get_storage_backend_for_document(doc, user, session)
|
||||
file_bytes = await backend.get_object(doc.object_key)
|
||||
|
||||
Reference in New Issue
Block a user