Разделы, фильтры и просмотр текстов в UI; опция «не хранить видео»
- таблица sections (дерево через parent_id), у видео section_id
- API: CRUD /sections, фильтры /videos (поиск, раздел с потомками, метод),
GET /videos/{id}/text, PATCH раздела, DELETE вместе с файлами
- pipeline: keep_video=false удаляет mp4 после расшифровки, section_id
- UI: панель разделов с вложенностью и счётчиками, поиск, фильтр по методу,
диалоги полного текста/выжимки, привязка к разделу, удаление,
переключатель «Сохранять видео на диске»
- compose: bind-mount ./web для правок без пересборки
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -44,14 +44,46 @@ class ApiClient:
|
||||
def pipeline_process(self, payload: dict) -> dict:
|
||||
return self._post("/pipeline/process", payload)
|
||||
|
||||
def list_videos(self) -> list[dict]:
|
||||
return self._get("/videos/")
|
||||
def list_videos(
|
||||
self,
|
||||
q: str | None = None,
|
||||
section_id: int | None = None,
|
||||
method: str | None = None,
|
||||
) -> list[dict]:
|
||||
params: dict = {}
|
||||
if q:
|
||||
params["q"] = q
|
||||
if section_id is not None:
|
||||
params["section_id"] = section_id
|
||||
if method:
|
||||
params["method"] = method
|
||||
return self._get("/videos/", params=params)
|
||||
|
||||
def video_text(self, uuid: str, kind: str) -> dict:
|
||||
return self._get(f"/videos/{uuid}/text", params={"kind": kind})
|
||||
|
||||
def set_video_section(self, uuid: str, section_id: int | None) -> dict:
|
||||
return self._request("PATCH", f"/videos/{uuid}", {"section_id": section_id})
|
||||
|
||||
def delete_video(self, uuid: str) -> dict:
|
||||
return self._request("DELETE", f"/videos/{uuid}")
|
||||
|
||||
# --- Sections ---
|
||||
|
||||
def list_sections(self) -> list[dict]:
|
||||
return self._get("/sections/")
|
||||
|
||||
def create_section(self, name: str, parent_id: int | None) -> dict:
|
||||
return self._post("/sections/", {"name": name, "parent_id": parent_id})
|
||||
|
||||
def delete_section(self, section_id: int) -> dict:
|
||||
return self._request("DELETE", f"/sections/{section_id}")
|
||||
|
||||
# --- internals ---
|
||||
|
||||
def _get(self, path: str) -> dict | list:
|
||||
def _get(self, path: str, params: dict | None = None) -> dict | list:
|
||||
try:
|
||||
r = self._client.get(path)
|
||||
r = self._client.get(path, params=params)
|
||||
except httpx.HTTPError as e:
|
||||
raise ApiError(f"Сеть: {e}")
|
||||
return self._unwrap(r)
|
||||
@@ -63,6 +95,13 @@ class ApiClient:
|
||||
raise ApiError(f"Сеть: {e}")
|
||||
return self._unwrap(r)
|
||||
|
||||
def _request(self, method: str, path: str, json: dict | None = None) -> dict:
|
||||
try:
|
||||
r = self._client.request(method, path, json=json)
|
||||
except httpx.HTTPError as e:
|
||||
raise ApiError(f"Сеть: {e}")
|
||||
return self._unwrap(r)
|
||||
|
||||
@staticmethod
|
||||
def _unwrap(r: httpx.Response):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user