feat(ai): mark cover reset history in generate table

This commit is contained in:
chengma
2026-07-11 12:06:17 +08:00
parent b71fa60b9e
commit 5c01377173
5 changed files with 280 additions and 4 deletions
+15
View File
@@ -217,9 +217,14 @@ class GenerateTaskTableModel(QAbstractTableModel):
task = self.tasks[index.row()]
if role in (Qt.DisplayRole, Qt.EditRole):
return self._display_value(task, index.column())
if role == Qt.ForegroundRole and index.column() == 1:
if self._cover_reset_count(task) > 0:
return _qcolor(COLOR_WARNING)
if role == Qt.ForegroundRole and index.column() in {4, 5}:
return self._component_status_color(self._display_value(task, index.column()))
if role == Qt.ToolTipRole:
if index.column() == 1 and self._cover_reset_count(task) > 0:
return self._cover_reset_tooltip(task)
if index.column() == 3 and self._can_edit_title(task):
return "双击可微调新标题,只修改本地待更新内容"
if task.last_error:
@@ -300,6 +305,16 @@ class GenerateTaskTableModel(QAbstractTableModel):
except (TypeError, ValueError):
return 0
def _cover_reset_count(self, task):
try:
return int(getattr(task, "cover_reset_count", 0) or 0)
except (TypeError, ValueError):
return 0
def _cover_reset_tooltip(self, task):
count = self._cover_reset_count(task)
return f"该商品封面已重置 {count} 次,可能有多张候选图,双击可查看封面画廊"
def _has_new_title(self, task):
return bool(str(getattr(task, "new_title", "") or "").strip())