feat: 任务中心只展示生图任务(模特上身图/平台套图/图片创作)
- AITaskViewSet 支持 ?task_type=a,b,c 过滤 - 前端任务中心请求 task_type=person_image,product_image,过滤掉 entity_extraction/script_*/storyboard 等流水线内部任务,只留生图工作室产出 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -78,6 +78,17 @@ class AITaskViewSet(TeamScopedViewSetMixin, ReadOnlyModelViewSet):
|
||||
search_fields = ["idempotency_key", "provider_task_id", "project__name"]
|
||||
ordering_fields = ["created_at", "updated_at", "completed_at"]
|
||||
|
||||
def get_queryset(self):
|
||||
# 可选 ?task_type=a,b,c 过滤:生图工作室的任务中心只想看生图任务(模特上身图/平台套图/
|
||||
# 图片创作 = person_image / product_image),不掺脚本/实体抽取/故事板等流水线内部任务。
|
||||
queryset = super().get_queryset()
|
||||
raw = self.request.query_params.get("task_type", "").strip()
|
||||
if raw:
|
||||
types = [t.strip() for t in raw.split(",") if t.strip()]
|
||||
if types:
|
||||
queryset = queryset.filter(task_type__in=types)
|
||||
return queryset
|
||||
|
||||
|
||||
class ModelConfigViewSet(ReadOnlyModelViewSet):
|
||||
# 按创建序固定排序:最早创建的 active 模型排第一 = 前端选择器默认项,与 get_default_model 口径一致
|
||||
|
||||
@@ -580,9 +580,10 @@ export const api = {
|
||||
return request<Paginated<ModelConfig>>("/api/ai/models/");
|
||||
},
|
||||
aiTasks() {
|
||||
// 取一大页(后端上限 200):任务中心要按真实总量算 全部/已完成/失败 三个 tab 数,
|
||||
// 只取默认首页(20 条)会把统计算偏,甚至误显示「全部失败」。
|
||||
return request<Paginated<AITask>>("/api/ai/tasks/?page_size=200");
|
||||
// 生图工作室的任务中心:只看生图任务(模特上身图/平台套图/图片创作 = person_image /
|
||||
// product_image),不掺脚本/实体抽取/故事板等流水线内部任务。取一大页(后端上限 200)
|
||||
// 以便 全部/已完成/失败 三个 tab 数按真实总量算。
|
||||
return request<Paginated<AITask>>("/api/ai/tasks/?page_size=200&task_type=person_image,product_image");
|
||||
},
|
||||
// 异步生图:提交后秒级返回任务列表(慢出图在 worker 跑),再用 generateImageStatus 轮询取结果
|
||||
submitGenerateImage(payload: { prompt: string; mode?: "image" | "model" | "cover"; count?: number; product_id?: string; reference_product?: boolean; model_id?: string; model_entity_id?: string; ratio?: string; image_model?: string }) {
|
||||
|
||||
Reference in New Issue
Block a user