fix(dataset): 展示训练任务名称

This commit is contained in:
caoxiaozhu
2026-07-27 12:44:40 +08:00
parent b82897ca3a
commit ecafb7eb13
6 changed files with 93 additions and 10 deletions

View File

@@ -1151,12 +1151,25 @@ class PlatformStore:
def datasets(self) -> list[dict[str, Any]]:
with self.connect() as conn:
rows = conn.execute("SELECT * FROM datasets ORDER BY create_time DESC").fetchall()
rows = conn.execute(
"""SELECT dataset.*, task.name AS task_name
FROM datasets dataset
LEFT JOIN data_process_tasks task
ON task.id=COALESCE(dataset.source_task_id, dataset.task_id)
ORDER BY dataset.create_time DESC"""
).fetchall()
return [self._dataset(conn, row) for row in rows]
def dataset(self, dataset_id: str) -> dict[str, Any]:
with self.connect() as conn:
row = conn.execute("SELECT * FROM datasets WHERE id=?", (dataset_id,)).fetchone()
row = conn.execute(
"""SELECT dataset.*, task.name AS task_name
FROM datasets dataset
LEFT JOIN data_process_tasks task
ON task.id=COALESCE(dataset.source_task_id, dataset.task_id)
WHERE dataset.id=?""",
(dataset_id,),
).fetchone()
if not row:
raise KeyError(dataset_id)
return self._dataset(conn, row)