mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-25 18:42:37 +00:00
用户看得到的列表补决胜键(复核 R-a9):按名称、时间等可能并列的排序后面补上同一个模型的 id,并列时两种库排出来一样
- 实测 /api/evals/calibers、/api/schedules/trigger-options 按 Workflow.name 排序遇同名并列时 SQLite、PostgreSQL 顺序不同。用 AST 逐个过了一遍 order_by:最后一个排序键是 created_at / updated_at / last_active_at / at / name / 各种 *_at 之类、不唯一的列,又不带 DISTINCT、GROUP BY 的,补「, 模型.id」(降序补 id.desc()),共 104 处,分布在 api、apps、auth、blueprints、chat、data、engine、eval、ledger、look、memory、process、providers、scheduler(runs.py 里的三处在上一个提交里) - 按唯一列(seq、version、唯一的 name)排的不动;按聚合、coalesce 之类表达式排的说明见 db/postgres
This commit is contained in:
@@ -79,7 +79,7 @@ async def upkeep(session: AsyncSession = Depends(get_session)) -> dict[str, Any]
|
||||
counts = await sc.counts_by_source(session, ids)
|
||||
schedules: dict[str, list[dict[str, Any]]] = {}
|
||||
for r in (await session.execute(select(Schedule).where(Schedule.target_kind == "source_maintenance")
|
||||
.order_by(Schedule.created_at))).scalars():
|
||||
.order_by(Schedule.created_at, Schedule.id))).scalars():
|
||||
schedules.setdefault(r.target_id or "", []).append({
|
||||
"id": r.id, "enabled": r.enabled, "cron": r.cron, "timezone": r.timezone,
|
||||
"description_text": _describe(r.cron, r.timezone),
|
||||
@@ -249,7 +249,7 @@ async def get_maintenance(source_id: str, session: AsyncSession = Depends(get_se
|
||||
row = await _source(session, source_id)
|
||||
rows = list((await session.execute(select(Schedule).where(
|
||||
Schedule.target_kind == "source_maintenance", Schedule.target_id == row.id)
|
||||
.order_by(Schedule.created_at))).scalars())
|
||||
.order_by(Schedule.created_at, Schedule.id))).scalars())
|
||||
outs = await _schedule_outs(session, rows)
|
||||
fire_ids = [o["last_fire"]["id"] for o in outs if o.get("last_fire")]
|
||||
inputs = dict((await session.execute(select(ScheduleFire.id, ScheduleFire.inputs).where(
|
||||
|
||||
Reference in New Issue
Block a user