fix(ai): 图片创作重跑三连修——丢参考图/裂新批次/提示词矛盾
① 重跑丢参考图:「重跑这张/重跑整批」原来不带 refs → 后端收不到 reference_image_ids 落到纯文生图,出图与上传素材无关。现 GenBatch.refs 存 assetId(上传后回写;恢复批次由 tasks 接口新带的 id 还原),重跑原样带回。 ② 重跑裂新聊天记录:enqueue 每次新铸 batch_id,后端没有「补进原批次」 概念,刷新/切对话后重跑图裂成新卡、原卡失败格还挂着。现生成接口收/回 batch_id(UUID 校验,非法兜底新铸),重跑沿用原批次并打 batch_append 标记; 前端批次卡存 backendBatchId(提交回调即落,整批全失败也不丢),重跑带回。 恢复分组时 rerun 任务不计入「应出张数」→ 补图成功后失败格自然收掉; 批次状态改按「有任务在跑」判定,已有好图+补图在途也能接续轮询。 ③ 同批换装一半不换:带参考图模板「严格保留款式/不要换款」与用户要求 (如"生成现代服装的穿着")直接矛盾,模型每张随机听一边。改为只锁主体身份 (人物五官/发型/体型,商品品类/外形/Logo),用户明确要求改变的以用户要求 为最高优先级,未提及的才默认与参考图一致。 测试:apps 全量 214 过(需 --settings=airshelf.settings.test); 新增 test_rerun_with_batch_id_reuses_batch_and_marks_append。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -634,8 +634,9 @@ export const api = {
|
||||
},
|
||||
// 异步生图:提交后秒级返回任务列表(慢出图在 worker 跑),再用 generateImageStatus 轮询取结果。
|
||||
// 带 conversation_id 则归属该对话;不带则后端自动开一条新对话并回传其 id。
|
||||
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; platform_id?: string; conversation_id?: string; reference_image_ids?: string[] }) {
|
||||
return request<{ conversation_id: string; tasks: { id: string; status: string }[] }>("/api/ai/generate-image/", { method: "POST", body: JSON.stringify(payload) });
|
||||
// 带 batch_id(重跑/补图)则任务归回原批次;响应回传本批 batch_id 供前端存进批次卡。
|
||||
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; platform_id?: string; conversation_id?: string; reference_image_ids?: string[]; batch_id?: string }) {
|
||||
return request<{ conversation_id: string; batch_id?: string; tasks: { id: string; status: string }[] }>("/api/ai/generate-image/", { method: "POST", body: JSON.stringify(payload) });
|
||||
},
|
||||
// 图片创作对话 CRUD —— 左栏会话列表 / 新对话 / 切换 / 重命名 / 删除
|
||||
listConversations(mode: "image" | "model" | "cover" = "image") {
|
||||
|
||||
Reference in New Issue
Block a user