fix: clarify AI generation failure retry states

This commit is contained in:
chengma
2026-07-06 11:58:51 +08:00
parent 19eaa794cf
commit 7ac0dcd00e
9 changed files with 195 additions and 9 deletions
+20
View File
@@ -275,10 +275,30 @@ class GenerateTaskTableModel(QAbstractTableModel):
return task.account_name or task.alias or ""
def _status_text(self, task):
if task.status == "failed":
return self._failed_status_text(task)
if task.status in self.STATUS_TEXT and task.status != "pending":
return self.STATUS_TEXT[task.status]
return self.STAGE_TEXT.get(task.stage, task.stage)
def _failed_status_text(self, task):
collect_attempts = self._attempt_count(task, "collect_attempts")
generate_attempts = self._attempt_count(task, "generate_attempts")
apply_attempts = self._attempt_count(task, "apply_attempts")
if apply_attempts > 0:
return "更新失败"
if generate_attempts > 0:
return "生成失败"
if collect_attempts > 0 or getattr(task, "stage", None) == "imported":
return "采集失败"
return "失败"
def _attempt_count(self, task, field):
try:
return int(getattr(task, field, 0) or 0)
except (TypeError, ValueError):
return 0
def _status_color(self, task):
base_color = _status_base_color(getattr(task, "status", None))
if base_color is not None: