Paginate biz-state batch workbook and expose raw CLI logs.

Load batch summaries without metric payloads, fetch sheet rows on demand, and show collect commands with a raw-log viewer.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-20 10:13:45 +08:00
parent a769e603b7
commit 18a0c41196
8 changed files with 835 additions and 178 deletions

View file

@ -4,7 +4,7 @@ from __future__ import annotations
from typing import Any
from fastapi import APIRouter, BackgroundTasks, Depends
from fastapi import APIRouter, BackgroundTasks, Depends, Query
from fastapi.responses import StreamingResponse
from pydantic import BaseModel, Field
from sqlalchemy.orm import Session
@ -237,6 +237,27 @@ def api_get_batch(batch_id: str, db: Session = Depends(get_db)) -> dict[str, Any
return svc.get_batch(db, batch_id)
@router.get("/batches/{batch_id}/metrics/{metric_id}")
def api_list_batch_metric_rows(
batch_id: str,
metric_id: str,
page: int = Query(1, ge=1),
page_size: int = Query(50, ge=1, le=200),
kw: str = Query(""),
column: str = Query(""),
db: Session = Depends(get_db),
) -> dict[str, Any]:
return svc.list_batch_metric_rows(
db,
batch_id,
metric_id,
page=page,
page_size=page_size,
kw=kw,
column=column,
)
@router.get("/batches/{batch_id}/commands/{command_id}")
def api_get_batch_command(
batch_id: str, command_id: str, db: Session = Depends(get_db)