From 3e2261b1c7b2d8378f776c7657c88ffae2ee5e5d Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 2 Jun 2026 15:21:24 +0800 Subject: [PATCH] fix: restore detail market id lookup input --- .../agents/AgentGenerationWorkspaceDarkV2.tsx | 143 ++++++++---------- 1 file changed, 59 insertions(+), 84 deletions(-) diff --git a/components/agents/AgentGenerationWorkspaceDarkV2.tsx b/components/agents/AgentGenerationWorkspaceDarkV2.tsx index 13086d339..add5b4eb3 100644 --- a/components/agents/AgentGenerationWorkspaceDarkV2.tsx +++ b/components/agents/AgentGenerationWorkspaceDarkV2.tsx @@ -1322,6 +1322,7 @@ export function AgentGenerationWorkspaceDarkV2({ isLoading: false, lastQuery: null, }); + const [detailProductIdQueryInput, setDetailProductIdQueryInput] = useState(""); const [detailReferenceStitchDialogOpen, setDetailReferenceStitchDialogOpen] = useState(false); const [activeDetailReferenceCardId, setActiveDetailReferenceCardId] = useState(null); const [skuReplacementSearchState, setSkuReplacementSearchState] = useState<{ @@ -1570,18 +1571,9 @@ export function AgentGenerationWorkspaceDarkV2({ [hasAgentUploadSlots, modelSlotEnabled, modelSlotIndex, productSlotCount] ); const isDirectReferenceUploadEnabled = isDirectModelGenerationMode && !hasMaterialStep; - const directReferenceUploadSlots = useMemo( - () => - Array.from({ length: DIRECT_MODEL_UPLOAD_SLOT_COUNT }, (_, index) => ({ - slotIndex: index, - label: `参考图${index + 1}`, - })), - [] - ); - const visibleAttachmentUploadSlots = isDirectReferenceUploadEnabled - ? directReferenceUploadSlots - : agentUploadSlots; - const hasVisibleAttachmentUploadSlots = visibleAttachmentUploadSlots.length > 0; + const visibleAttachmentUploadSlots = agentUploadSlots; + const hasVisibleAttachmentUploadSlots = + hasAgentUploadSlots && visibleAttachmentUploadSlots.length > 0; const requiredProductUploadCount = hasAgentUploadSlots ? productSlotCount : 0; const detailReferenceTarget = presetModeConfig.detail.referenceImageSource; const skuReferenceTarget = presetModeConfig.sku.referenceImageSource; @@ -1883,11 +1875,7 @@ export function AgentGenerationWorkspaceDarkV2({ requiredProductUploadCount - filledProductAttachmentCount, 0 ); - const directReferenceAttachmentCount = attachments - .slice(0, DIRECT_MODEL_UPLOAD_SLOT_COUNT) - .filter((item) => Boolean(item?.url)).length; const productAttachmentSummary = `${selectedProductAttachments.length}/${productSlotCount} 张产品图`; - const directReferenceAttachmentSummary = `已上传 ${directReferenceAttachmentCount}/${DIRECT_MODEL_UPLOAD_SLOT_COUNT} 张参考图`; const modelAttachmentSummary = modelSlotEnabled ? selectedModelAttachment ? "模特图已带入" @@ -1918,6 +1906,11 @@ export function AgentGenerationWorkspaceDarkV2({ selectedProductAttachments.length, ]); const detailReplacementQueryInput = detailReplacementState.query; + const detailReplacementQueryDisplay = + detailReplacementSearchState.lastQuery || + (detailReplacementQueryType === "productId" + ? detailProductIdQueryInput.trim() + : detailReplacementQueryInput.trim().toUpperCase()); const detailReplacementCandidates = detailReplacementState.candidates; const detailReplacementSelectedCandidateId = detailReplacementState.selectedCandidateId; const detailGenerationMode = normalizeAgentDetailGenerationMode( @@ -2138,8 +2131,6 @@ export function AgentGenerationWorkspaceDarkV2({ const hasBrandModelStep = Boolean(brandModelPanel) && modelSlotEnabled; const hasBrandStoreStep = Boolean(brandStorePanel); const hasWorkflowStyleStep = Boolean(workflowStylePanel) || hasBrandModelStep; - const shouldShowDirectUploadInStyleStep = - isDirectReferenceUploadEnabled && hasWorkflowStyleStep; const visibleWorkflowSectionKeys = useMemo( () => [ ...(hasBrandStoreStep ? ["brand"] : []), @@ -3336,14 +3327,10 @@ export function AgentGenerationWorkspaceDarkV2({ }, [activeResultModeUrls, selectedResultUrl]); useEffect(() => { - if (isDirectReferenceUploadEnabled) { - setIsAttachmentSlotExpanded(true); - return; - } if (!selectedAgentPresetId || !hasAgentUploadSlots) { setIsAttachmentSlotExpanded(false); } - }, [hasAgentUploadSlots, isDirectReferenceUploadEnabled, selectedAgentPresetId]); + }, [hasAgentUploadSlots, selectedAgentPresetId]); useEffect(() => { if (requiresPresetSelection && !selectedAgentPresetId) { @@ -4855,8 +4842,10 @@ export function AgentGenerationWorkspaceDarkV2({ queryType: Extract ) => { const rawPrimarySpu = getCurrentWorkflowPrimarySpu(); + const rawQuery = + queryType === "productId" ? detailProductIdQueryInput : rawPrimarySpu; const normalized = - queryType === "productId" ? rawPrimarySpu.trim() : rawPrimarySpu.trim().toUpperCase(); + queryType === "productId" ? rawQuery.trim() : rawQuery.trim().toUpperCase(); const currentWorkflowBrandName = getCurrentWorkflowBrandName(); if (!currentWorkflowBrandName && queryType !== "productId") { toast.error("请先在第一步完成品牌选择后再检索可用模版"); @@ -4865,7 +4854,7 @@ export function AgentGenerationWorkspaceDarkV2({ if (!normalized) { toast.error( queryType === "productId" - ? "请先在第一步输入主商品市场ID后再查询详情" + ? "请输入市场ID或商品ID后再查询详情" : "请先在第一步输入主商品SPU后再检索可用模版" ); return; @@ -4925,6 +4914,7 @@ export function AgentGenerationWorkspaceDarkV2({ }, [ detailReferenceSourceLabel, detailReferenceTarget, + detailProductIdQueryInput, detailReplacementProductDetailChannel, getCurrentWorkflowPrimarySpu, getCurrentWorkflowBrandName, @@ -5349,56 +5339,43 @@ export function AgentGenerationWorkspaceDarkV2({
- {isDirectReferenceUploadEnabled ? "上传参考图" : "输入图槽位"} + 输入图槽位
{hasVisibleAttachmentUploadSlots ? ( <> - {isDirectReferenceUploadEnabled ? ( -
- - {directReferenceAttachmentSummary} - - - 可选上传,也可纯文字生成 - -
- ) : ( -
+
+ + {productAttachmentSummary} + + {modelAttachmentSummary ? ( - {productAttachmentSummary} + {modelAttachmentSummary} - {modelAttachmentSummary ? ( - - {modelAttachmentSummary} - - ) : null} - - 共 {agentUploadSlots.length} 个输入槽位 - -
- )} + ) : null} + + 共 {agentUploadSlots.length} 个输入槽位 + +

- {isDirectReferenceUploadEnabled - ? "第一步和第二步关闭时,可在这里直接上传商品图、参考图或场景图;生成时会和补充要求一起发送给模型。" - : missingAttachmentCount > 0 - ? `当前还需补充 ${missingAttachmentCount} 张产品图,展开后可继续检查或替换。` - : "产品图已自动带入并准备完成;模特图槽位可按需补充,不选也可以继续生成。"} + {missingAttachmentCount > 0 + ? `当前还需补充 ${missingAttachmentCount} 张产品图,展开后可继续检查或替换。` + : "产品图已自动带入并准备完成;模特图槽位可按需补充,不选也可以继续生成。"}

) : ( @@ -5415,13 +5392,7 @@ export function AgentGenerationWorkspaceDarkV2({ variant="outline" className="border-white/12 bg-black/25 text-white/82 hover:border-white/22 hover:bg-white/[0.06] hover:text-white" > - {isAttachmentSlotExpanded - ? isDirectReferenceUploadEnabled - ? "收起上传区" - : "收起素材槽位" - : isDirectReferenceUploadEnabled - ? "上传参考图" - : "检查/替换素材"} + {isAttachmentSlotExpanded ? "收起素材槽位" : "检查/替换素材"} {isAttachmentSlotExpanded ? ( ) : ( @@ -5435,9 +5406,7 @@ export function AgentGenerationWorkspaceDarkV2({ {hasVisibleAttachmentUploadSlots ? (
- {isDirectReferenceUploadEnabled - ? "当前模式不会展示前两步素材选择,上传到这里的图片会作为参考图直接参与本次模型生图。" - : "上一步已选的白底图和品牌模特图会自动带入对应槽位,这里只保留最终检查与单张上传替换,不再重复展示已选素材列表。"} + 上一步已选的白底图和品牌模特图会自动带入对应槽位,这里只保留最终检查与单张上传替换,不再重复展示已选素材列表。
@@ -5646,7 +5615,6 @@ export function AgentGenerationWorkspaceDarkV2({
- {shouldShowDirectUploadInStyleStep ? attachmentSlotPanel : null} {workflowStylePanel} {hasBrandModelStep ? brandModelPanel : null}
@@ -5845,10 +5813,7 @@ export function AgentGenerationWorkspaceDarkV2({
) : null} - {(!shouldShowDirectUploadInStyleStep && isDirectReferenceUploadEnabled) || - (hasAgentUploadSlots && isAttachmentSlotExpanded) - ? attachmentSlotPanel - : null} + {hasAgentUploadSlots && isAttachmentSlotExpanded ? attachmentSlotPanel : null}

@@ -6120,7 +6085,7 @@ export function AgentGenerationWorkspaceDarkV2({
参考详情搜索
- 支持按 SPU / SKU 自动识别候选整套,也可以上传参考详情图或按商品ID拉取详情图。 + 支持自动复用主 SPU 检索素材库模版,也可以输入市场ID按渠道拉取详情图。
@@ -6134,7 +6099,7 @@ export function AgentGenerationWorkspaceDarkV2({
- 自动复用第一步主商品信息检索参考详情,不需要重复输入 SPU / SKU。 + 自动复用第一步主商品信息检索参考详情;市场ID查询需要单独输入商品ID。
@@ -6149,6 +6114,19 @@ export function AgentGenerationWorkspaceDarkV2({
+ setDetailProductIdQueryInput(event.target.value)} + onKeyDown={(event) => { + if (event.key === "Enter") { + event.preventDefault(); + handleDetailReplacementSearch("productId"); + } + }} + disabled={detailReplacementSearchState.isLoading} + placeholder="输入市场ID / 商品ID" + className="h-12 rounded-[22px] border-white/10 bg-black/20 text-sm text-white placeholder:text-white/28 focus:border-emerald-400/30 sm:w-[220px]" + />