fix: list_tasks用sqlExe替代sort参数

This commit is contained in:
yumoqing 2026-06-12 00:20:01 +08:00
parent 113eb7e040
commit 54c98acc25

View File

@ -206,10 +206,12 @@ async def list_tasks(tenant_id: str, pipeline_id: str = None, limit: int = 100)
"""List tasks for a tenant."""
db, dbname = _get_db()
async with db.sqlorContext(dbname) as sor:
filters = {'tenant_id': tenant_id}
if pipeline_id:
filters['pipeline_id'] = pipeline_id
recs = await sor.R('pipeline_tasks', filters, sort='created_at desc')
sql = "SELECT * FROM pipeline_tasks WHERE tenant_id=${tenant_id}$ AND pipeline_id=${pipeline_id}$ ORDER BY created_at DESC"
recs = await sor.sqlExe(sql, {'tenant_id': tenant_id, 'pipeline_id': pipeline_id})
else:
sql = "SELECT * FROM pipeline_tasks WHERE tenant_id=${tenant_id}$ ORDER BY created_at DESC"
recs = await sor.sqlExe(sql, {'tenant_id': tenant_id})
result = []
for rec in (recs or [])[:limit]:
if hasattr(rec, '__dict__'):