Major changes: - New frontend (platform/web/): Vite + React 18 + TypeScript + Tailwind - 4-module navigation: 数据送标 / 模型管理 / 车队管理 / 系统管理 - Data catalog with charts (DMS/ADAS/Lane 3-tab view) - Quality review workflow (标注质检): Good/Fine/Bad scoring with auto-advance - Audit enhancements: batch operations, rejection categories, Feishu notifications - Operation audit log (操作日志) - World model simulation studio (仿真工坊) - Dataset version management with snapshots and diff - ADAS 7-class dataset integration (138K images organized + compressed) - User management with Feishu integration and pagination - CRUD/search/filter on all pages, card layout redesign - PIL-optimized image overlay rendering - Auto-snapshot on build, in_review workflow stage - Removed embedded algorithm code (now in workspace)
76 lines
2.7 KiB
Python
76 lines
2.7 KiB
Python
"""飞书集成 API。"""
|
|
from __future__ import annotations
|
|
|
|
from typing import Annotated, Any
|
|
|
|
from fastapi import APIRouter, Depends
|
|
|
|
from as_platform.auth.deps import require_any_permission
|
|
from as_platform.db.models import User
|
|
from as_platform.config import FEISHU_BITABLE_AUTO_INGEST, FEISHU_BITABLE_WEBHOOK_ENABLED
|
|
from as_platform.integrations.feishu_bitable import connectivity_check, is_bitable_configured, list_tables
|
|
from as_platform.integrations.feishu_bitable_ingest import process_pending_ingest
|
|
from as_platform.integrations.feishu_bitable_sync import backfill_hints
|
|
from as_platform.integrations.feishu_notify import is_notify_configured
|
|
from as_platform.jobs.feishu_bitable_sync import run_sync_cycle
|
|
|
|
router = APIRouter(prefix="/api/v1/integrations/feishu", tags=["feishu"])
|
|
|
|
|
|
@router.get("/bitable/status")
|
|
def api_bitable_status(
|
|
_user: Annotated[User, Depends(require_any_permission("write:labeling_assign", "*"))],
|
|
) -> dict[str, Any]:
|
|
return connectivity_check()
|
|
|
|
|
|
@router.get("/bitable/tables")
|
|
def api_bitable_tables(
|
|
_user: Annotated[User, Depends(require_any_permission("write:labeling_assign", "*"))],
|
|
) -> dict[str, Any]:
|
|
if not is_bitable_configured():
|
|
return {"items": [], "message": "未配置 BITABLE_APP_TOKEN / TABLE_ID"}
|
|
return {"items": list_tables()}
|
|
|
|
|
|
@router.post("/bitable/sync")
|
|
def api_bitable_sync(
|
|
_user: Annotated[User, Depends(require_any_permission("write:labeling_assign", "*"))],
|
|
) -> dict[str, Any]:
|
|
return run_sync_cycle()
|
|
|
|
|
|
@router.post("/bitable/ingest")
|
|
def api_bitable_ingest(
|
|
_user: Annotated[User, Depends(require_any_permission("write:labeling_assign", "*"))],
|
|
) -> dict[str, Any]:
|
|
"""手动触发「待落盘」入湖(须 FEISHU_BITABLE_AUTO_INGEST=1 或本接口始终可用)。"""
|
|
return process_pending_ingest()
|
|
|
|
|
|
@router.get("/bitable/config")
|
|
def api_bitable_config(
|
|
_user: Annotated[User, Depends(require_any_permission("write:labeling_assign", "*"))],
|
|
) -> dict[str, Any]:
|
|
return {
|
|
"bitable_configured": is_bitable_configured(),
|
|
"notify_configured": is_notify_configured(),
|
|
"auto_ingest": FEISHU_BITABLE_AUTO_INGEST,
|
|
"webhook_enabled": FEISHU_BITABLE_WEBHOOK_ENABLED,
|
|
}
|
|
|
|
|
|
@router.post("/bitable/webhook")
|
|
def api_bitable_webhook_disabled() -> dict[str, Any]:
|
|
"""内网默认关闭;有公网穿透后再实现验签入站。"""
|
|
if not FEISHU_BITABLE_WEBHOOK_ENABLED:
|
|
return {"ok": False, "message": "FEISHU_BITABLE_WEBHOOK_ENABLED 未开启"}
|
|
return {"ok": False, "message": "Webhook 处理器尚未实现"}
|
|
|
|
|
|
@router.get("/bitable/backfill-hints")
|
|
def api_bitable_backfill_hints(
|
|
_user: Annotated[User, Depends(require_any_permission("write:labeling_assign", "*"))],
|
|
) -> dict[str, Any]:
|
|
return backfill_hints()
|