[AZ-173] [AZ-174] Stream-based detection API and DB-driven AI config

Made-with: Cursor
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-03-31 06:30:22 +03:00
parent 6547c5903a
commit 6c24d09eab
15 changed files with 562 additions and 105 deletions
+35
View File
@@ -41,3 +41,38 @@ cdef class LoaderHttpClient:
except Exception as e:
logger.error(f"LoaderHttpClient.upload_big_small_resource failed: {e}")
return LoadResult(str(e))
cpdef object fetch_user_ai_settings(self, str user_id, str bearer_token):
try:
headers = {}
if bearer_token:
headers["Authorization"] = f"Bearer {bearer_token}"
response = requests.get(
f"{self.base_url}/api/users/{user_id}/ai-settings",
headers=headers,
timeout=30,
)
if response.status_code != 200:
return None
return response.json()
except Exception as e:
logger.error(f"LoaderHttpClient.fetch_user_ai_settings failed: {e}")
return None
cpdef object fetch_media_path(self, str media_id, str bearer_token):
try:
headers = {}
if bearer_token:
headers["Authorization"] = f"Bearer {bearer_token}"
response = requests.get(
f"{self.base_url}/api/media/{media_id}",
headers=headers,
timeout=30,
)
if response.status_code != 200:
return None
data = response.json()
return data.get("path")
except Exception as e:
logger.error(f"LoaderHttpClient.fetch_media_path failed: {e}")
return None