Page norm matches and finish finder release

This commit is contained in:
anor
2026-12-04 06:02:57 +10:00
parent bb69f4aa0a
commit 0395311056
8 changed files with 111 additions and 29 deletions
+9 -5
View File
@@ -555,7 +555,7 @@ MAX_MESSAGE_LEN = 10_000
# ⚠️ Версия UI — единый источник. БАМПАТЬ ПРИ КАЖДОМ ДЕПЛОЕ (формат: YYYY-MM-DD + буква).
# Фронт берёт её через GET /api/version (chat.html + admin.html, элемент .app-version).
APP_VERSION = "2026-12-04a"
APP_VERSION = "2026-12-04b"
# Audit: path → action name mapping
_AUDIT_MAP = [
@@ -2451,13 +2451,15 @@ async def public_norm_finder_catalog(request: Request):
@app.get("/api/public/norm-finder/search")
async def public_norm_finder_search(request: Request, q: str = "", base: str = "2022", limit: int = 8):
async def public_norm_finder_search(request: Request, q: str = "", base: str = "2022", limit: int = 8,
offset: int = 0):
_check_public_finder_rate(request)
if not 1 <= limit <= 8:
raise HTTPException(400, "Публичный поиск показывает до 8 результатов")
import norm_finder
try:
found = await asyncio.to_thread(norm_finder.search, q, base, limit)
found = await asyncio.to_thread(norm_finder.search, q, base, limit, offset) if offset else \
await asyncio.to_thread(norm_finder.search, q, base, limit)
except ValueError as exc:
raise HTTPException(400, str(exc)) from exc
if found.get("status") == "db_unavailable":
@@ -2477,11 +2479,13 @@ async def public_norm_finder_detail(request: Request, base: str = "", base_type:
@app.get("/api/norm-finder/search")
async def norm_finder_search(request: Request, q: str = "", base: str = "2022", limit: int = 12):
async def norm_finder_search(request: Request, q: str = "", base: str = "2022", limit: int = 12,
offset: int = 0):
_get_user(request)
import norm_finder
try:
found = await asyncio.to_thread(norm_finder.search, q, base, limit)
found = await asyncio.to_thread(norm_finder.search, q, base, limit, offset) if offset else \
await asyncio.to_thread(norm_finder.search, q, base, limit)
except ValueError as exc:
raise HTTPException(400, str(exc)) from exc
if found.get("status") == "db_unavailable":