fix: clarify AI generation failure retry states
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user