engine: remove dead archive handlers (front serves archive now)

The archive endpoints (list/get/delete/file/settings) are served by the front
(codai/frontproxy/admin_data.py, from disk via archive_manager), so the engine's
copies in admin/routes.py were dead. Removed.

Note: the cache/download/HF handlers in routes.py are NOT removed — the
coderai-system worker serves them through the same admin_router, so they're only
unrouted on the engine, not dead code. Fully removing them from the engine would
require splitting routes.py into engine vs system routers (future cleanup).
Co-Authored-By: 's avatarClaude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DDv7BchtZQWsnPG6Jm49m
parent 18e07076
...@@ -3447,77 +3447,6 @@ async def api_save_settings(request: Request, username: str = Depends(require_ad ...@@ -3447,77 +3447,6 @@ async def api_save_settings(request: Request, username: str = Depends(require_ad
# Archive management # Archive management
# ============================================================================= # =============================================================================
@router.get("/admin/api/archive", summary="List archived generations")
async def api_archive_list(
limit: int = 50,
offset: int = 0,
username: str = Depends(require_admin),
):
from codai.api.archive import archive_manager
entries = archive_manager.list_entries(limit=limit, offset=offset)
total = archive_manager.count_entries()
return {"entries": entries, "total": total}
@router.get("/admin/api/archive/{gen_id}", summary="Get an archived generation")
async def api_archive_get(gen_id: str, username: str = Depends(require_admin)):
from codai.api.archive import archive_manager
entry = archive_manager.get_entry(gen_id)
if entry is None:
raise HTTPException(status_code=404, detail="Entry not found")
return entry
@router.delete("/admin/api/archive/{gen_id}", summary="Delete an archived generation")
async def api_archive_delete(gen_id: str, username: str = Depends(require_admin)):
from codai.api.archive import archive_manager
if not archive_manager.delete_entry(gen_id):
raise HTTPException(status_code=404, detail="Entry not found")
return {"success": True}
@router.get("/admin/api/archive/{gen_id}/files/{filename}", summary="Download an archived file")
async def api_archive_file(
gen_id: str,
filename: str,
username: str = Depends(require_auth),
):
from fastapi.responses import FileResponse
from codai.api.archive import archive_manager
path = archive_manager.get_file_path(gen_id, filename)
if path is None:
raise HTTPException(status_code=404, detail="File not found")
import mimetypes
media_type = mimetypes.guess_type(filename)[0] or "application/octet-stream"
return FileResponse(path, media_type=media_type)
@router.get("/admin/api/archive-settings", summary="Get archive settings")
async def api_archive_settings_get(username: str = Depends(require_admin)):
if config_manager is None or config_manager.config is None:
raise HTTPException(status_code=503, detail="Config not ready")
import os as _os
c = config_manager.config.archive
from codai.api.archive import RETENTION_OPTIONS
default_dir = _os.path.join(str(config_manager.config_dir), "archive")
return {
"enabled": c.enabled,
"directory": c.directory,
"default_directory": default_dir,
"retention": c.retention,
"retention_options": RETENTION_OPTIONS,
}
# --- HuggingFace model search proxy ---
import re as _re
_QUANT_RE = _re.compile(
r'\b(IQ[1-4]_XX[SML]?|Q[2-8]_K_[MSLX]|Q[2-8]_K|Q[2-8]_[0-9]|F16|F32|BF16)\b',
_re.IGNORECASE,
)
def _hf_file_size(sibling: dict) -> int: def _hf_file_size(sibling: dict) -> int:
"""Return actual byte size from an HF siblings entry (prefers LFS size).""" """Return actual byte size from an HF siblings entry (prefers LFS size)."""
lfs = sibling.get("lfs") or {} lfs = sibling.get("lfs") or {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment