fix: restore detail market id lookup input
This commit is contained in:
parent
fa4b4183cf
commit
3e2261b1c7
@ -1322,6 +1322,7 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
isLoading: false,
|
isLoading: false,
|
||||||
lastQuery: null,
|
lastQuery: null,
|
||||||
});
|
});
|
||||||
|
const [detailProductIdQueryInput, setDetailProductIdQueryInput] = useState("");
|
||||||
const [detailReferenceStitchDialogOpen, setDetailReferenceStitchDialogOpen] = useState(false);
|
const [detailReferenceStitchDialogOpen, setDetailReferenceStitchDialogOpen] = useState(false);
|
||||||
const [activeDetailReferenceCardId, setActiveDetailReferenceCardId] = useState<string | null>(null);
|
const [activeDetailReferenceCardId, setActiveDetailReferenceCardId] = useState<string | null>(null);
|
||||||
const [skuReplacementSearchState, setSkuReplacementSearchState] = useState<{
|
const [skuReplacementSearchState, setSkuReplacementSearchState] = useState<{
|
||||||
@ -1570,18 +1571,9 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
[hasAgentUploadSlots, modelSlotEnabled, modelSlotIndex, productSlotCount]
|
[hasAgentUploadSlots, modelSlotEnabled, modelSlotIndex, productSlotCount]
|
||||||
);
|
);
|
||||||
const isDirectReferenceUploadEnabled = isDirectModelGenerationMode && !hasMaterialStep;
|
const isDirectReferenceUploadEnabled = isDirectModelGenerationMode && !hasMaterialStep;
|
||||||
const directReferenceUploadSlots = useMemo(
|
const visibleAttachmentUploadSlots = agentUploadSlots;
|
||||||
() =>
|
const hasVisibleAttachmentUploadSlots =
|
||||||
Array.from({ length: DIRECT_MODEL_UPLOAD_SLOT_COUNT }, (_, index) => ({
|
hasAgentUploadSlots && visibleAttachmentUploadSlots.length > 0;
|
||||||
slotIndex: index,
|
|
||||||
label: `参考图${index + 1}`,
|
|
||||||
})),
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
const visibleAttachmentUploadSlots = isDirectReferenceUploadEnabled
|
|
||||||
? directReferenceUploadSlots
|
|
||||||
: agentUploadSlots;
|
|
||||||
const hasVisibleAttachmentUploadSlots = visibleAttachmentUploadSlots.length > 0;
|
|
||||||
const requiredProductUploadCount = hasAgentUploadSlots ? productSlotCount : 0;
|
const requiredProductUploadCount = hasAgentUploadSlots ? productSlotCount : 0;
|
||||||
const detailReferenceTarget = presetModeConfig.detail.referenceImageSource;
|
const detailReferenceTarget = presetModeConfig.detail.referenceImageSource;
|
||||||
const skuReferenceTarget = presetModeConfig.sku.referenceImageSource;
|
const skuReferenceTarget = presetModeConfig.sku.referenceImageSource;
|
||||||
@ -1883,11 +1875,7 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
requiredProductUploadCount - filledProductAttachmentCount,
|
requiredProductUploadCount - filledProductAttachmentCount,
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
const directReferenceAttachmentCount = attachments
|
|
||||||
.slice(0, DIRECT_MODEL_UPLOAD_SLOT_COUNT)
|
|
||||||
.filter((item) => Boolean(item?.url)).length;
|
|
||||||
const productAttachmentSummary = `${selectedProductAttachments.length}/${productSlotCount} 张产品图`;
|
const productAttachmentSummary = `${selectedProductAttachments.length}/${productSlotCount} 张产品图`;
|
||||||
const directReferenceAttachmentSummary = `已上传 ${directReferenceAttachmentCount}/${DIRECT_MODEL_UPLOAD_SLOT_COUNT} 张参考图`;
|
|
||||||
const modelAttachmentSummary = modelSlotEnabled
|
const modelAttachmentSummary = modelSlotEnabled
|
||||||
? selectedModelAttachment
|
? selectedModelAttachment
|
||||||
? "模特图已带入"
|
? "模特图已带入"
|
||||||
@ -1918,6 +1906,11 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
selectedProductAttachments.length,
|
selectedProductAttachments.length,
|
||||||
]);
|
]);
|
||||||
const detailReplacementQueryInput = detailReplacementState.query;
|
const detailReplacementQueryInput = detailReplacementState.query;
|
||||||
|
const detailReplacementQueryDisplay =
|
||||||
|
detailReplacementSearchState.lastQuery ||
|
||||||
|
(detailReplacementQueryType === "productId"
|
||||||
|
? detailProductIdQueryInput.trim()
|
||||||
|
: detailReplacementQueryInput.trim().toUpperCase());
|
||||||
const detailReplacementCandidates = detailReplacementState.candidates;
|
const detailReplacementCandidates = detailReplacementState.candidates;
|
||||||
const detailReplacementSelectedCandidateId = detailReplacementState.selectedCandidateId;
|
const detailReplacementSelectedCandidateId = detailReplacementState.selectedCandidateId;
|
||||||
const detailGenerationMode = normalizeAgentDetailGenerationMode(
|
const detailGenerationMode = normalizeAgentDetailGenerationMode(
|
||||||
@ -2138,8 +2131,6 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
const hasBrandModelStep = Boolean(brandModelPanel) && modelSlotEnabled;
|
const hasBrandModelStep = Boolean(brandModelPanel) && modelSlotEnabled;
|
||||||
const hasBrandStoreStep = Boolean(brandStorePanel);
|
const hasBrandStoreStep = Boolean(brandStorePanel);
|
||||||
const hasWorkflowStyleStep = Boolean(workflowStylePanel) || hasBrandModelStep;
|
const hasWorkflowStyleStep = Boolean(workflowStylePanel) || hasBrandModelStep;
|
||||||
const shouldShowDirectUploadInStyleStep =
|
|
||||||
isDirectReferenceUploadEnabled && hasWorkflowStyleStep;
|
|
||||||
const visibleWorkflowSectionKeys = useMemo(
|
const visibleWorkflowSectionKeys = useMemo(
|
||||||
() => [
|
() => [
|
||||||
...(hasBrandStoreStep ? ["brand"] : []),
|
...(hasBrandStoreStep ? ["brand"] : []),
|
||||||
@ -3336,14 +3327,10 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
}, [activeResultModeUrls, selectedResultUrl]);
|
}, [activeResultModeUrls, selectedResultUrl]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isDirectReferenceUploadEnabled) {
|
|
||||||
setIsAttachmentSlotExpanded(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!selectedAgentPresetId || !hasAgentUploadSlots) {
|
if (!selectedAgentPresetId || !hasAgentUploadSlots) {
|
||||||
setIsAttachmentSlotExpanded(false);
|
setIsAttachmentSlotExpanded(false);
|
||||||
}
|
}
|
||||||
}, [hasAgentUploadSlots, isDirectReferenceUploadEnabled, selectedAgentPresetId]);
|
}, [hasAgentUploadSlots, selectedAgentPresetId]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (requiresPresetSelection && !selectedAgentPresetId) {
|
if (requiresPresetSelection && !selectedAgentPresetId) {
|
||||||
@ -4855,8 +4842,10 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
queryType: Extract<AgentWorkflowReferenceQueryType, "spu" | "productId">
|
queryType: Extract<AgentWorkflowReferenceQueryType, "spu" | "productId">
|
||||||
) => {
|
) => {
|
||||||
const rawPrimarySpu = getCurrentWorkflowPrimarySpu();
|
const rawPrimarySpu = getCurrentWorkflowPrimarySpu();
|
||||||
|
const rawQuery =
|
||||||
|
queryType === "productId" ? detailProductIdQueryInput : rawPrimarySpu;
|
||||||
const normalized =
|
const normalized =
|
||||||
queryType === "productId" ? rawPrimarySpu.trim() : rawPrimarySpu.trim().toUpperCase();
|
queryType === "productId" ? rawQuery.trim() : rawQuery.trim().toUpperCase();
|
||||||
const currentWorkflowBrandName = getCurrentWorkflowBrandName();
|
const currentWorkflowBrandName = getCurrentWorkflowBrandName();
|
||||||
if (!currentWorkflowBrandName && queryType !== "productId") {
|
if (!currentWorkflowBrandName && queryType !== "productId") {
|
||||||
toast.error("请先在第一步完成品牌选择后再检索可用模版");
|
toast.error("请先在第一步完成品牌选择后再检索可用模版");
|
||||||
@ -4865,7 +4854,7 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
if (!normalized) {
|
if (!normalized) {
|
||||||
toast.error(
|
toast.error(
|
||||||
queryType === "productId"
|
queryType === "productId"
|
||||||
? "请先在第一步输入主商品市场ID后再查询详情"
|
? "请输入市场ID或商品ID后再查询详情"
|
||||||
: "请先在第一步输入主商品SPU后再检索可用模版"
|
: "请先在第一步输入主商品SPU后再检索可用模版"
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
@ -4925,6 +4914,7 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
}, [
|
}, [
|
||||||
detailReferenceSourceLabel,
|
detailReferenceSourceLabel,
|
||||||
detailReferenceTarget,
|
detailReferenceTarget,
|
||||||
|
detailProductIdQueryInput,
|
||||||
detailReplacementProductDetailChannel,
|
detailReplacementProductDetailChannel,
|
||||||
getCurrentWorkflowPrimarySpu,
|
getCurrentWorkflowPrimarySpu,
|
||||||
getCurrentWorkflowBrandName,
|
getCurrentWorkflowBrandName,
|
||||||
@ -5349,56 +5339,43 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
<div className="flex items-center gap-2 text-sm font-semibold text-white">
|
<div className="flex items-center gap-2 text-sm font-semibold text-white">
|
||||||
<ImagePlus className="h-4 w-4 text-emerald-300" />
|
<ImagePlus className="h-4 w-4 text-emerald-300" />
|
||||||
{isDirectReferenceUploadEnabled ? "上传参考图" : "输入图槽位"}
|
输入图槽位
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{hasVisibleAttachmentUploadSlots ? (
|
{hasVisibleAttachmentUploadSlots ? (
|
||||||
<>
|
<>
|
||||||
{isDirectReferenceUploadEnabled ? (
|
<div className="flex flex-wrap gap-2">
|
||||||
<div className="flex flex-wrap gap-2">
|
<span
|
||||||
<span className="rounded-full border border-emerald-400/25 bg-emerald-500/[0.10] px-3 py-1 text-xs text-emerald-100">
|
className={cn(
|
||||||
{directReferenceAttachmentSummary}
|
"rounded-full border px-3 py-1 text-xs",
|
||||||
</span>
|
attachmentSummaryReady
|
||||||
<span className="rounded-full border border-white/10 bg-black/20 px-3 py-1 text-xs text-white/60">
|
? "border-emerald-400/25 bg-emerald-500/[0.10] text-emerald-100"
|
||||||
可选上传,也可纯文字生成
|
: "border-amber-400/25 bg-amber-500/[0.10] text-amber-100"
|
||||||
</span>
|
)}
|
||||||
</div>
|
>
|
||||||
) : (
|
{productAttachmentSummary}
|
||||||
<div className="flex flex-wrap gap-2">
|
</span>
|
||||||
|
{modelAttachmentSummary ? (
|
||||||
<span
|
<span
|
||||||
className={cn(
|
className={cn(
|
||||||
"rounded-full border px-3 py-1 text-xs",
|
"rounded-full border px-3 py-1 text-xs",
|
||||||
attachmentSummaryReady
|
selectedModelAttachment
|
||||||
? "border-emerald-400/25 bg-emerald-500/[0.10] text-emerald-100"
|
? "border-emerald-400/25 bg-emerald-500/[0.10] text-emerald-100"
|
||||||
: "border-amber-400/25 bg-amber-500/[0.10] text-amber-100"
|
: "border-white/10 bg-black/20 text-white/60"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{productAttachmentSummary}
|
{modelAttachmentSummary}
|
||||||
</span>
|
</span>
|
||||||
{modelAttachmentSummary ? (
|
) : null}
|
||||||
<span
|
<span className="rounded-full border border-white/10 bg-black/20 px-3 py-1 text-xs text-white/60">
|
||||||
className={cn(
|
共 {agentUploadSlots.length} 个输入槽位
|
||||||
"rounded-full border px-3 py-1 text-xs",
|
</span>
|
||||||
selectedModelAttachment
|
</div>
|
||||||
? "border-emerald-400/25 bg-emerald-500/[0.10] text-emerald-100"
|
|
||||||
: "border-white/10 bg-black/20 text-white/60"
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{modelAttachmentSummary}
|
|
||||||
</span>
|
|
||||||
) : null}
|
|
||||||
<span className="rounded-full border border-white/10 bg-black/20 px-3 py-1 text-xs text-white/60">
|
|
||||||
共 {agentUploadSlots.length} 个输入槽位
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<p className="text-xs leading-6 text-white/55">
|
<p className="text-xs leading-6 text-white/55">
|
||||||
{isDirectReferenceUploadEnabled
|
{missingAttachmentCount > 0
|
||||||
? "第一步和第二步关闭时,可在这里直接上传商品图、参考图或场景图;生成时会和补充要求一起发送给模型。"
|
? `当前还需补充 ${missingAttachmentCount} 张产品图,展开后可继续检查或替换。`
|
||||||
: missingAttachmentCount > 0
|
: "产品图已自动带入并准备完成;模特图槽位可按需补充,不选也可以继续生成。"}
|
||||||
? `当前还需补充 ${missingAttachmentCount} 张产品图,展开后可继续检查或替换。`
|
|
||||||
: "产品图已自动带入并准备完成;模特图槽位可按需补充,不选也可以继续生成。"}
|
|
||||||
</p>
|
</p>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
@ -5415,13 +5392,7 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
variant="outline"
|
variant="outline"
|
||||||
className="border-white/12 bg-black/25 text-white/82 hover:border-white/22 hover:bg-white/[0.06] hover:text-white"
|
className="border-white/12 bg-black/25 text-white/82 hover:border-white/22 hover:bg-white/[0.06] hover:text-white"
|
||||||
>
|
>
|
||||||
{isAttachmentSlotExpanded
|
{isAttachmentSlotExpanded ? "收起素材槽位" : "检查/替换素材"}
|
||||||
? isDirectReferenceUploadEnabled
|
|
||||||
? "收起上传区"
|
|
||||||
: "收起素材槽位"
|
|
||||||
: isDirectReferenceUploadEnabled
|
|
||||||
? "上传参考图"
|
|
||||||
: "检查/替换素材"}
|
|
||||||
{isAttachmentSlotExpanded ? (
|
{isAttachmentSlotExpanded ? (
|
||||||
<ChevronUp className="ml-2 h-4 w-4" />
|
<ChevronUp className="ml-2 h-4 w-4" />
|
||||||
) : (
|
) : (
|
||||||
@ -5435,9 +5406,7 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
{hasVisibleAttachmentUploadSlots ? (
|
{hasVisibleAttachmentUploadSlots ? (
|
||||||
<CollapsibleContent className="mt-4 space-y-4">
|
<CollapsibleContent className="mt-4 space-y-4">
|
||||||
<div className="rounded-[20px] border border-emerald-400/15 bg-emerald-500/[0.06] px-4 py-3 text-xs leading-6 text-emerald-100/80">
|
<div className="rounded-[20px] border border-emerald-400/15 bg-emerald-500/[0.06] px-4 py-3 text-xs leading-6 text-emerald-100/80">
|
||||||
{isDirectReferenceUploadEnabled
|
上一步已选的白底图和品牌模特图会自动带入对应槽位,这里只保留最终检查与单张上传替换,不再重复展示已选素材列表。
|
||||||
? "当前模式不会展示前两步素材选择,上传到这里的图片会作为参考图直接参与本次模型生图。"
|
|
||||||
: "上一步已选的白底图和品牌模特图会自动带入对应槽位,这里只保留最终检查与单张上传替换,不再重复展示已选素材列表。"}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-2 gap-3 lg:grid-cols-4">
|
<div className="grid grid-cols-2 gap-3 lg:grid-cols-4">
|
||||||
@ -5646,7 +5615,6 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-7">
|
<div className="space-y-7">
|
||||||
{shouldShowDirectUploadInStyleStep ? attachmentSlotPanel : null}
|
|
||||||
{workflowStylePanel}
|
{workflowStylePanel}
|
||||||
{hasBrandModelStep ? brandModelPanel : null}
|
{hasBrandModelStep ? brandModelPanel : null}
|
||||||
</div>
|
</div>
|
||||||
@ -5845,10 +5813,7 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{(!shouldShowDirectUploadInStyleStep && isDirectReferenceUploadEnabled) ||
|
{hasAgentUploadSlots && isAttachmentSlotExpanded ? attachmentSlotPanel : null}
|
||||||
(hasAgentUploadSlots && isAttachmentSlotExpanded)
|
|
||||||
? attachmentSlotPanel
|
|
||||||
: null}
|
|
||||||
|
|
||||||
<div className="rounded-[28px] border border-white/12 bg-white/[0.02] p-4">
|
<div className="rounded-[28px] border border-white/12 bg-white/[0.02] p-4">
|
||||||
<h3 className="mb-3 flex items-center gap-2 text-sm font-semibold text-white">
|
<h3 className="mb-3 flex items-center gap-2 text-sm font-semibold text-white">
|
||||||
@ -6120,7 +6085,7 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
<div>
|
<div>
|
||||||
<div className="text-sm font-semibold text-white">参考详情搜索</div>
|
<div className="text-sm font-semibold text-white">参考详情搜索</div>
|
||||||
<div className="text-xs text-white/40">
|
<div className="text-xs text-white/40">
|
||||||
支持按 SPU / SKU 自动识别候选整套,也可以上传参考详情图或按商品ID拉取详情图。
|
支持自动复用主 SPU 检索素材库模版,也可以输入市场ID按渠道拉取详情图。
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="rounded-full border border-white/10 bg-white/[0.03] px-3 py-1 text-xs text-white/55">
|
<div className="rounded-full border border-white/10 bg-white/[0.03] px-3 py-1 text-xs text-white/55">
|
||||||
@ -6134,7 +6099,7 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
<div className="flex flex-col gap-4 xl:flex-row xl:items-center xl:justify-between">
|
<div className="flex flex-col gap-4 xl:flex-row xl:items-center xl:justify-between">
|
||||||
<div className="min-w-0">
|
<div className="min-w-0">
|
||||||
<div className="text-xs text-white/42">
|
<div className="text-xs text-white/42">
|
||||||
自动复用第一步主商品信息检索参考详情,不需要重复输入 SPU / SKU。
|
自动复用第一步主商品信息检索参考详情;市场ID查询需要单独输入商品ID。
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-2 flex flex-wrap gap-2">
|
<div className="mt-2 flex flex-wrap gap-2">
|
||||||
<span className="rounded-full border border-emerald-400/20 bg-emerald-500/[0.08] px-3 py-1 text-xs text-emerald-100">
|
<span className="rounded-full border border-emerald-400/20 bg-emerald-500/[0.08] px-3 py-1 text-xs text-emerald-100">
|
||||||
@ -6149,6 +6114,19 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col gap-2 sm:flex-row">
|
<div className="flex flex-col gap-2 sm:flex-row">
|
||||||
|
<Input
|
||||||
|
value={detailProductIdQueryInput}
|
||||||
|
onChange={(event) => 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]"
|
||||||
|
/>
|
||||||
<Select
|
<Select
|
||||||
value={detailReplacementProductDetailChannel}
|
value={detailReplacementProductDetailChannel}
|
||||||
onValueChange={(value) =>
|
onValueChange={(value) =>
|
||||||
@ -6215,7 +6193,7 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{(detailReplacementSearchState.lastQuery || detailReplacementQueryInput.trim()) ? (
|
{detailReplacementQueryDisplay ? (
|
||||||
<div className="rounded-[18px] border border-white/10 bg-white/[0.03] px-3 py-2 text-xs text-white/48">
|
<div className="rounded-[18px] border border-white/10 bg-white/[0.03] px-3 py-2 text-xs text-white/48">
|
||||||
当前参考图查询:
|
当前参考图查询:
|
||||||
{detailReplacementQueryType === "productId"
|
{detailReplacementQueryType === "productId"
|
||||||
@ -6223,10 +6201,7 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
: detailReplacementQueryType === "sku"
|
: detailReplacementQueryType === "sku"
|
||||||
? "SKU"
|
? "SKU"
|
||||||
: "SPU"} /
|
: "SPU"} /
|
||||||
{detailReplacementSearchState.lastQuery ||
|
{detailReplacementQueryDisplay}
|
||||||
(detailReplacementQueryType === "productId"
|
|
||||||
? detailReplacementQueryInput.trim()
|
|
||||||
: detailReplacementQueryInput.trim().toUpperCase())}
|
|
||||||
{workflowBrandName ? (
|
{workflowBrandName ? (
|
||||||
<span className="ml-2 text-white/40">{`品牌 / ${workflowBrandName}`}</span>
|
<span className="ml-2 text-white/40">{`品牌 / ${workflowBrandName}`}</span>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user