```
feat(learning): 修复任务运行记录排序逻辑处理空attempt_index的情况 当RunRecord的attempt_index为None时,之前的排序逻辑会出现问题。 现在通过在排序键中显式处理None值来解决这个问题, 将None值排在前面,并将其转换为0进行比较。 同时添加了单元测试验证团队运行记录(没有attempt_index)的处理情况。 ```
This commit is contained in:
@ -462,7 +462,15 @@ class SkillLearningService:
|
||||
|
||||
@staticmethod
|
||||
def _representative_task_text(runs: list[RunRecord], *, fallback: str = "") -> str:
|
||||
ordered = sorted(runs, key=lambda item: (item.attempt_index, item.started_at, item.run_id))
|
||||
ordered = sorted(
|
||||
runs,
|
||||
key=lambda item: (
|
||||
item.attempt_index is None,
|
||||
item.attempt_index if item.attempt_index is not None else 0,
|
||||
item.started_at,
|
||||
item.run_id,
|
||||
),
|
||||
)
|
||||
for record in ordered:
|
||||
text = record.task_text.strip()
|
||||
if text:
|
||||
|
||||
Reference in New Issue
Block a user