fix(frontend): 移除运行时演示数据并接入真实后端状态
This commit is contained in:
@@ -993,6 +993,8 @@ class TranscriptionJob(Contract):
|
||||
|
||||
|
||||
class IndexStatus(Contract):
|
||||
total_notes: int = 0
|
||||
total_blocks: int = 0
|
||||
status: Literal["idle", "queued", "running", "failed"] = "idle"
|
||||
pending_jobs: int = 0
|
||||
active_job_id: str | None = None
|
||||
|
||||
@@ -120,6 +120,13 @@ from app.services.attachment_service import attachment_path
|
||||
router = APIRouter(prefix="/api")
|
||||
|
||||
|
||||
@router.get("/permissions/policy", tags=["Permissions"])
|
||||
async def get_permission_policy() -> dict[str, str]:
|
||||
from app.agent.permissions import KNOWN_PERMISSIONS
|
||||
return {permission: container.permissions.policy.mode_for(permission).value
|
||||
for permission in sorted(KNOWN_PERMISSIONS)}
|
||||
|
||||
|
||||
async def mcp_call_async(operation):
|
||||
"""Even registry reads can wait on lifecycle locks; keep all MCP work off the event loop."""
|
||||
try:
|
||||
|
||||
@@ -126,9 +126,12 @@ async def rebuild(request: IndexRebuildRequest) -> IndexJob:
|
||||
|
||||
|
||||
def get_status() -> IndexStatus:
|
||||
counts = repository.stats()
|
||||
if _active_job_id is not None:
|
||||
return IndexStatus(status="running", pending_jobs=0, active_job_id=_active_job_id)
|
||||
return IndexStatus(status="running", pending_jobs=0, active_job_id=_active_job_id,
|
||||
total_notes=counts["notes"], total_blocks=counts["blocks"])
|
||||
return IndexStatus(
|
||||
total_notes=counts["notes"], total_blocks=counts["blocks"],
|
||||
status="failed" if _last_error else "idle",
|
||||
pending_jobs=0,
|
||||
last_completed_at=_last_completed_at,
|
||||
|
||||
Reference in New Issue
Block a user