Codex/ecommerce history sync #29
@@ -57,7 +57,44 @@ import EcommerceClonePanel from "./panels/EcommerceClonePanel";
|
|||||||
import EcommerceCopywritingPanel from "./panels/EcommerceCopywritingPanel";
|
import EcommerceCopywritingPanel from "./panels/EcommerceCopywritingPanel";
|
||||||
import { ecommerceOssScopes, saveUnifiedEcommerceGenerationRecord, deleteEcommerceGenerationRecord } from "./ecommerceGenerationPersistence";
|
import { ecommerceOssScopes, saveUnifiedEcommerceGenerationRecord, deleteEcommerceGenerationRecord } from "./ecommerceGenerationPersistence";
|
||||||
import { downloadResultAsset } from "../workbench/workbenchDownload";
|
import { downloadResultAsset } from "../workbench/workbenchDownload";
|
||||||
import type { CloneOutputKey, ProductSetOutputKey } from "./utils/platformRules";
|
import {
|
||||||
|
appendEnglish,
|
||||||
|
defaultCloneOutput,
|
||||||
|
defaultEcommercePlatform,
|
||||||
|
defaultMarketLanguageOption,
|
||||||
|
defaultPlatformSpec,
|
||||||
|
defaultProductSetOutput,
|
||||||
|
domesticPlatformLabels,
|
||||||
|
domesticPlatformLanguages,
|
||||||
|
formatUploadedImageRatio,
|
||||||
|
getMarketLanguageOptions,
|
||||||
|
getPlatformDefaultLanguage,
|
||||||
|
getPlatformDefaultRatio,
|
||||||
|
getPlatformLanguageOptions,
|
||||||
|
getPlatformRatioGroup,
|
||||||
|
getPlatformRatioOptions,
|
||||||
|
getPlatformSpec,
|
||||||
|
getUniqueRatioOptions,
|
||||||
|
isDomesticPlatform,
|
||||||
|
languageAliases,
|
||||||
|
legacyPlatformAliases,
|
||||||
|
marketLanguageOptions,
|
||||||
|
marketOptions,
|
||||||
|
normalizeLanguage,
|
||||||
|
normalizeLanguageForPlatform,
|
||||||
|
normalizeMarket,
|
||||||
|
normalizePlatform,
|
||||||
|
normalizeRatioForPlatform,
|
||||||
|
platformOptions,
|
||||||
|
platformSpecOptions,
|
||||||
|
uniqueLanguages,
|
||||||
|
} from "./utils/platformRules";
|
||||||
|
import type {
|
||||||
|
CloneOutputKey,
|
||||||
|
PlatformRatioModeKey,
|
||||||
|
ProductSetOutputKey,
|
||||||
|
} from "./utils/platformRules";
|
||||||
|
import type { EcommercePlatformSpec, PlatformRatioGroup } from "./utils/platformRules";
|
||||||
import {
|
import {
|
||||||
buildHistoryTurnFromRecord,
|
buildHistoryTurnFromRecord,
|
||||||
cloneLatestSettingStorageKey,
|
cloneLatestSettingStorageKey,
|
||||||
@@ -319,13 +356,6 @@ interface EcommerceImagePromptOptions {
|
|||||||
detailModules?: string[];
|
detailModules?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
type PlatformRatioModeKey = ProductSetOutputKey | "hot";
|
|
||||||
|
|
||||||
interface PlatformRatioGroup {
|
|
||||||
ratios: string[];
|
|
||||||
defaultRatio: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const sideTools: Array<{ key: ProductKitToolKey; label: string; icon: ReactNode }> = [
|
const sideTools: Array<{ key: ProductKitToolKey; label: string; icon: ReactNode }> = [
|
||||||
{ key: "set", label: "商品套图", icon: <AppstoreOutlined /> },
|
{ key: "set", label: "商品套图", icon: <AppstoreOutlined /> },
|
||||||
{ key: "detail", label: "A+详情", icon: <FileImageOutlined /> },
|
{ key: "detail", label: "A+详情", icon: <FileImageOutlined /> },
|
||||||
@@ -333,324 +363,6 @@ const sideTools: Array<{ key: ProductKitToolKey; label: string; icon: ReactNode
|
|||||||
{ key: "clone", label: "电商AI作图", icon: <AppstoreOutlined /> },
|
{ key: "clone", label: "电商AI作图", icon: <AppstoreOutlined /> },
|
||||||
];
|
];
|
||||||
|
|
||||||
const platformSpecOptions: Array<{
|
|
||||||
label: string;
|
|
||||||
ratios: string[];
|
|
||||||
defaultRatio: string;
|
|
||||||
ratioGroups?: Partial<Record<PlatformRatioModeKey, PlatformRatioGroup>>;
|
|
||||||
specs: string[];
|
|
||||||
tip?: string;
|
|
||||||
aliases?: string[];
|
|
||||||
}> = [
|
|
||||||
{
|
|
||||||
label: "淘宝/天猫",
|
|
||||||
ratios: ["淘宝主图 / SKU 图 800×800px", "详情页宽 750px", "详情页宽 790px"],
|
|
||||||
defaultRatio: "淘宝主图 / SKU 图 800×800px",
|
|
||||||
ratioGroups: {
|
|
||||||
set: {
|
|
||||||
ratios: ["1000×1000px\u00a0\u00a0\u00a01:1", "800×800px\u00a0\u00a0\u00a01:1"],
|
|
||||||
defaultRatio: "1000×1000px\u00a0\u00a0\u00a01:1",
|
|
||||||
},
|
|
||||||
detail: {
|
|
||||||
ratios: [
|
|
||||||
"750×1000px\u00a0\u00a0\u00a03:4",
|
|
||||||
"790×1053px\u00a0\u00a0\u00a03:4",
|
|
||||||
"750×1125px\u00a0\u00a0\u00a02:3",
|
|
||||||
"790×1185px\u00a0\u00a0\u00a02:3",
|
|
||||||
],
|
|
||||||
defaultRatio: "750×1000px\u00a0\u00a0\u00a03:4",
|
|
||||||
},
|
|
||||||
model: {
|
|
||||||
ratios: ["750×1000px\u00a0\u00a0\u00a03:4"],
|
|
||||||
defaultRatio: "750×1000px\u00a0\u00a0\u00a03:4",
|
|
||||||
},
|
|
||||||
video: {
|
|
||||||
ratios: ["1080×1920px\u00a0\u00a0\u00a09:16", "1080×1440px\u00a0\u00a0\u00a03:4", "1080×1080px\u00a0\u00a0\u00a01:1"],
|
|
||||||
defaultRatio: "1080×1920px\u00a0\u00a0\u00a09:16",
|
|
||||||
},
|
|
||||||
hot: {
|
|
||||||
ratios: ["800×800px\u00a0\u00a0\u00a01:1"],
|
|
||||||
defaultRatio: "800×800px\u00a0\u00a0\u00a01:1",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
specs: ["主图 / SKU 图 800×800px,≤3MB", "详情页宽 750px 或 790px,单张高度≤1546px"],
|
|
||||||
tip: "建议主图 200-400KB JPG,超过 500KB 会影响加载速度。",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "京东",
|
|
||||||
ratios: ["京东主图 / SKU 图 800×800px", "详情页宽 750px", "首图主体占比 ≥80%"],
|
|
||||||
defaultRatio: "京东主图 / SKU 图 800×800px",
|
|
||||||
ratioGroups: {
|
|
||||||
set: {
|
|
||||||
ratios: ["1000×1000px\u00a0\u00a0\u00a01:1"],
|
|
||||||
defaultRatio: "1000×1000px\u00a0\u00a0\u00a01:1",
|
|
||||||
},
|
|
||||||
detail: {
|
|
||||||
ratios: [
|
|
||||||
"750×1000px\u00a0\u00a0\u00a03:4",
|
|
||||||
"990×1320px\u00a0\u00a0\u00a03:4",
|
|
||||||
"750×1125px\u00a0\u00a0\u00a02:3",
|
|
||||||
"990×1485px\u00a0\u00a0\u00a02:3",
|
|
||||||
],
|
|
||||||
defaultRatio: "750×1000px\u00a0\u00a0\u00a03:4",
|
|
||||||
},
|
|
||||||
model: {
|
|
||||||
ratios: ["750×1125px\u00a0\u00a0\u00a02:3", "990×1485px\u00a0\u00a0\u00a02:3"],
|
|
||||||
defaultRatio: "750×1125px\u00a0\u00a0\u00a02:3",
|
|
||||||
},
|
|
||||||
video: {
|
|
||||||
ratios: ["1080×1920px\u00a0\u00a0\u00a09:16", "1920×1080px\u00a0\u00a0\u00a016:9"],
|
|
||||||
defaultRatio: "1080×1920px\u00a0\u00a0\u00a09:16",
|
|
||||||
},
|
|
||||||
hot: {
|
|
||||||
ratios: ["800×800px\u00a0\u00a0\u00a01:1"],
|
|
||||||
defaultRatio: "800×800px\u00a0\u00a0\u00a01:1",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
specs: ["主图 / SKU 图 800×800px,白底,≤3MB", "详情页宽 750px,首图主体占比 ≥80%"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "拼多多",
|
|
||||||
ratios: ["主图 750×352px", "主图 800×800px", "详情页宽 750px"],
|
|
||||||
defaultRatio: "主图 750×352px",
|
|
||||||
ratioGroups: {
|
|
||||||
set: {
|
|
||||||
ratios: ["800×800px\u00a0\u00a0\u00a01:1", "750×1000px\u00a0\u00a0\u00a03:4"],
|
|
||||||
defaultRatio: "800×800px\u00a0\u00a0\u00a01:1",
|
|
||||||
},
|
|
||||||
detail: {
|
|
||||||
ratios: ["750×1000px\u00a0\u00a0\u00a03:4", "750×1125px\u00a0\u00a0\u00a02:3"],
|
|
||||||
defaultRatio: "750×1000px\u00a0\u00a0\u00a03:4",
|
|
||||||
},
|
|
||||||
model: {
|
|
||||||
ratios: ["750×1000px\u00a0\u00a0\u00a03:4"],
|
|
||||||
defaultRatio: "750×1000px\u00a0\u00a0\u00a03:4",
|
|
||||||
},
|
|
||||||
video: {
|
|
||||||
ratios: ["1080×1920px\u00a0\u00a0\u00a09:16"],
|
|
||||||
defaultRatio: "1080×1920px\u00a0\u00a0\u00a09:16",
|
|
||||||
},
|
|
||||||
hot: {
|
|
||||||
ratios: ["800×800px\u00a0\u00a0\u00a01:1"],
|
|
||||||
defaultRatio: "800×800px\u00a0\u00a0\u00a01:1",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
specs: ["主图 750×352px 或 800×800px,≤1MB", "详情页宽 750px,要求纯白底、无水印、无拼接"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "抖音电商",
|
|
||||||
ratios: ["短视频1080×1920px"],
|
|
||||||
defaultRatio: "短视频1080×1920px",
|
|
||||||
ratioGroups: {
|
|
||||||
video: {
|
|
||||||
ratios: ["1080×1920px\u00a0\u00a0\u00a09:16"],
|
|
||||||
defaultRatio: "1080×1920px\u00a0\u00a0\u00a09:16",
|
|
||||||
},
|
|
||||||
hot: {
|
|
||||||
ratios: ["800×800px\u00a0\u00a0\u00a01:1"],
|
|
||||||
defaultRatio: "800×800px\u00a0\u00a0\u00a01:1",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
specs: ["短视频 1080×1920px,9:16", "30s 内最佳"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "亚马逊 Amazon",
|
|
||||||
ratios: ["主图 ≥1600×1600px", "建议 2000×2000px+", "最小 500×500px"],
|
|
||||||
defaultRatio: "主图 ≥1600×1600px",
|
|
||||||
ratioGroups: {
|
|
||||||
set: {
|
|
||||||
ratios: ["1600×1600px\u00a0\u00a0\u00a01:1"],
|
|
||||||
defaultRatio: "1600×1600px\u00a0\u00a0\u00a01:1",
|
|
||||||
},
|
|
||||||
detail: {
|
|
||||||
ratios: ["1600×1600px\u00a0\u00a0\u00a01:1", "1200×1800px\u00a0\u00a0\u00a02:3", "1200×1600px\u00a0\u00a0\u00a03:4"],
|
|
||||||
defaultRatio: "1200×1800px\u00a0\u00a0\u00a02:3",
|
|
||||||
},
|
|
||||||
model: {
|
|
||||||
ratios: ["1200×1800px\u00a0\u00a0\u00a02:3"],
|
|
||||||
defaultRatio: "1200×1800px\u00a0\u00a0\u00a02:3",
|
|
||||||
},
|
|
||||||
video: {
|
|
||||||
ratios: ["1920×1080px\u00a0\u00a0\u00a016:9"],
|
|
||||||
defaultRatio: "1920×1080px\u00a0\u00a0\u00a016:9",
|
|
||||||
},
|
|
||||||
hot: {
|
|
||||||
ratios: ["1600×1600px\u00a0\u00a0\u00a01:1"],
|
|
||||||
defaultRatio: "1600×1600px\u00a0\u00a0\u00a01:1",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
specs: ["主图 1600×1600px+,纯白底,≤10MB", "最小 500×500px,建议 2000px+ 以支持缩放"],
|
|
||||||
aliases: ["亚马逊"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Shopee",
|
|
||||||
ratios: ["商品主图 1024×1024px", "基础主图 800×800px"],
|
|
||||||
defaultRatio: "商品主图 1024×1024px",
|
|
||||||
ratioGroups: {
|
|
||||||
set: {
|
|
||||||
ratios: ["800×800px\u00a0\u00a0\u00a01:1"],
|
|
||||||
defaultRatio: "800×800px\u00a0\u00a0\u00a01:1",
|
|
||||||
},
|
|
||||||
detail: {
|
|
||||||
ratios: ["750×1000px\u00a0\u00a0\u00a03:4", "750×1125px\u00a0\u00a0\u00a02:3"],
|
|
||||||
defaultRatio: "750×1000px\u00a0\u00a0\u00a03:4",
|
|
||||||
},
|
|
||||||
model: {
|
|
||||||
ratios: ["750×1000px\u00a0\u00a0\u00a03:4"],
|
|
||||||
defaultRatio: "750×1000px\u00a0\u00a0\u00a03:4",
|
|
||||||
},
|
|
||||||
video: {
|
|
||||||
ratios: ["1080×1920px\u00a0\u00a0\u00a09:16"],
|
|
||||||
defaultRatio: "1080×1920px\u00a0\u00a0\u00a09:16",
|
|
||||||
},
|
|
||||||
hot: {
|
|
||||||
ratios: ["800×800px\u00a0\u00a0\u00a01:1"],
|
|
||||||
defaultRatio: "800×800px\u00a0\u00a0\u00a01:1",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
specs: ["商品主图推荐 1024×1024px,基础 800×800px", "≤2MB,白底或浅色底"],
|
|
||||||
aliases: ["虾皮 Shopee/Lazada", "虾皮"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Lazada",
|
|
||||||
ratios: ["商品主图 800×800px"],
|
|
||||||
defaultRatio: "商品主图 800×800px",
|
|
||||||
ratioGroups: {
|
|
||||||
set: {
|
|
||||||
ratios: ["800×800px\u00a0\u00a0\u00a01:1"],
|
|
||||||
defaultRatio: "800×800px\u00a0\u00a0\u00a01:1",
|
|
||||||
},
|
|
||||||
detail: {
|
|
||||||
ratios: ["750×1000px\u00a0\u00a0\u00a03:4", "750×1125px\u00a0\u00a0\u00a02:3"],
|
|
||||||
defaultRatio: "750×1000px\u00a0\u00a0\u00a03:4",
|
|
||||||
},
|
|
||||||
model: {
|
|
||||||
ratios: ["750×1000px\u00a0\u00a0\u00a03:4"],
|
|
||||||
defaultRatio: "750×1000px\u00a0\u00a0\u00a03:4",
|
|
||||||
},
|
|
||||||
video: {
|
|
||||||
ratios: ["1080×1920px\u00a0\u00a0\u00a09:16"],
|
|
||||||
defaultRatio: "1080×1920px\u00a0\u00a0\u00a09:16",
|
|
||||||
},
|
|
||||||
hot: {
|
|
||||||
ratios: ["800×800px\u00a0\u00a0\u00a01:1"],
|
|
||||||
defaultRatio: "800×800px\u00a0\u00a0\u00a01:1",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
specs: ["商品主图 800×800px,1:1"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Instagram",
|
|
||||||
ratios: ["帖子 1080×1350px", "帖子 1080×1080px", "Stories / Reels 1080×1920px", "头像 320×320px"],
|
|
||||||
defaultRatio: "帖子 1080×1350px",
|
|
||||||
ratioGroups: {
|
|
||||||
set: {
|
|
||||||
ratios: ["1080×1080px\u00a0\u00a0\u00a01:1", "1080×1350px\u00a0\u00a0\u00a04:5"],
|
|
||||||
defaultRatio: "1080×1080px\u00a0\u00a0\u00a01:1",
|
|
||||||
},
|
|
||||||
detail: {
|
|
||||||
ratios: ["1080×1350px\u00a0\u00a0\u00a04:5"],
|
|
||||||
defaultRatio: "1080×1350px\u00a0\u00a0\u00a04:5",
|
|
||||||
},
|
|
||||||
model: {
|
|
||||||
ratios: ["1080×1350px\u00a0\u00a0\u00a04:5"],
|
|
||||||
defaultRatio: "1080×1350px\u00a0\u00a0\u00a04:5",
|
|
||||||
},
|
|
||||||
video: {
|
|
||||||
ratios: ["1080×1920px\u00a0\u00a0\u00a09:16", "1080×1350px\u00a0\u00a0\u00a04:5"],
|
|
||||||
defaultRatio: "1080×1920px\u00a0\u00a0\u00a09:16",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
specs: ["帖子 1080×1350px 或 1080×1080px", "Stories / Reels 封面 1080×1920px,头像 320×320px"],
|
|
||||||
tip: "建议 ≤8MB JPG。",
|
|
||||||
aliases: ["Instagram Reels"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "速卖通",
|
|
||||||
ratios: ["主图 800×800px", "主图 1000×1000px+"],
|
|
||||||
defaultRatio: "主图 800×800px",
|
|
||||||
ratioGroups: {
|
|
||||||
set: {
|
|
||||||
ratios: ["1000×1000px\u00a0\u00a0\u00a01:1"],
|
|
||||||
defaultRatio: "1000×1000px\u00a0\u00a0\u00a01:1",
|
|
||||||
},
|
|
||||||
detail: {
|
|
||||||
ratios: ["750×1125px\u00a0\u00a0\u00a02:3", "750×1000px\u00a0\u00a0\u00a03:4"],
|
|
||||||
defaultRatio: "750×1125px\u00a0\u00a0\u00a02:3",
|
|
||||||
},
|
|
||||||
model: {
|
|
||||||
ratios: ["750×1125px\u00a0\u00a0\u00a02:3"],
|
|
||||||
defaultRatio: "750×1125px\u00a0\u00a0\u00a02:3",
|
|
||||||
},
|
|
||||||
video: {
|
|
||||||
ratios: ["1080×1920px\u00a0\u00a0\u00a09:16", "1920×1080px\u00a0\u00a0\u00a016:9"],
|
|
||||||
defaultRatio: "1080×1920px\u00a0\u00a0\u00a09:16",
|
|
||||||
},
|
|
||||||
hot: {
|
|
||||||
ratios: ["800×800px\u00a0\u00a0\u00a01:1"],
|
|
||||||
defaultRatio: "800×800px\u00a0\u00a0\u00a01:1",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
specs: ["主图建议 800×800px 或更高,1:1", "适合跨境电商主图、SKU 图和场景图"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "eBay",
|
|
||||||
ratios: ["商品图1:1", "白底多角度展示图 1:1"],
|
|
||||||
defaultRatio: "商品图1:1",
|
|
||||||
ratioGroups: {
|
|
||||||
set: {
|
|
||||||
ratios: ["1600×1600px\u00a0\u00a0\u00a01:1"],
|
|
||||||
defaultRatio: "1600×1600px\u00a0\u00a0\u00a01:1",
|
|
||||||
},
|
|
||||||
detail: {
|
|
||||||
ratios: ["1000×1500px\u00a0\u00a0\u00a02:3", "1200×1600px\u00a0\u00a0\u00a03:4"],
|
|
||||||
defaultRatio: "1000×1500px\u00a0\u00a0\u00a02:3",
|
|
||||||
},
|
|
||||||
model: {
|
|
||||||
ratios: ["1000×1500px\u00a0\u00a0\u00a02:3"],
|
|
||||||
defaultRatio: "1000×1500px\u00a0\u00a0\u00a02:3",
|
|
||||||
},
|
|
||||||
video: {
|
|
||||||
ratios: ["1920×1080px\u00a0\u00a0\u00a016:9", "1080×1920px\u00a0\u00a0\u00a09:16"],
|
|
||||||
defaultRatio: "1920×1080px\u00a0\u00a0\u00a016:9",
|
|
||||||
},
|
|
||||||
hot: {
|
|
||||||
ratios: ["1600×1600px\u00a0\u00a0\u00a01:1"],
|
|
||||||
defaultRatio: "1600×1600px\u00a0\u00a0\u00a01:1",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
specs: ["商品图建议 1:1,主体清晰居中", "适合白底主图和多角度展示图"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "TikTok Shop",
|
|
||||||
ratios: ["商品主图 1:1", "短视频/ 竖版封面 9:16"],
|
|
||||||
defaultRatio: "商品主图 1:1",
|
|
||||||
ratioGroups: {
|
|
||||||
set: {
|
|
||||||
ratios: ["1280×1280px\u00a0\u00a0\u00a01:1"],
|
|
||||||
defaultRatio: "1280×1280px\u00a0\u00a0\u00a01:1",
|
|
||||||
},
|
|
||||||
detail: {
|
|
||||||
ratios: ["1080×1350px\u00a0\u00a0\u00a04:5"],
|
|
||||||
defaultRatio: "1080×1350px\u00a0\u00a0\u00a04:5",
|
|
||||||
},
|
|
||||||
model: {
|
|
||||||
ratios: ["1080×1350px\u00a0\u00a0\u00a04:5"],
|
|
||||||
defaultRatio: "1080×1350px\u00a0\u00a0\u00a04:5",
|
|
||||||
},
|
|
||||||
video: {
|
|
||||||
ratios: ["1080×1920px\u00a0\u00a0\u00a09:16"],
|
|
||||||
defaultRatio: "1080×1920px\u00a0\u00a0\u00a09:16",
|
|
||||||
},
|
|
||||||
hot: {
|
|
||||||
ratios: ["800×800px\u00a0\u00a0\u00a01:1"],
|
|
||||||
defaultRatio: "800×800px\u00a0\u00a0\u00a01:1",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
specs: ["商品主图建议 1:1", "短视频竖版封面建议 9:16"],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
const platformOptions = platformSpecOptions.map((option) => option.label);
|
|
||||||
const getPlatformLogoText = (value: string) => {
|
const getPlatformLogoText = (value: string) => {
|
||||||
const normalized = value.toLowerCase();
|
const normalized = value.toLowerCase();
|
||||||
if (value.includes("淘宝") || value.includes("天猫")) return "淘";
|
if (value.includes("淘宝") || value.includes("天猫")) return "淘";
|
||||||
@@ -701,115 +413,6 @@ const renderPlatformLogo = (value: string) => {
|
|||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const marketLanguageOptions: Array<{ country: string; languages: string[] }> = [
|
|
||||||
{ country: "中国", languages: ["中文"] },
|
|
||||||
{ country: "美国", languages: ["英文"] },
|
|
||||||
{ country: "加拿大", languages: ["英文", "法文"] },
|
|
||||||
{ country: "英国", languages: ["英文"] },
|
|
||||||
{ country: "德国", languages: ["德文"] },
|
|
||||||
{ country: "法国", languages: ["法文"] },
|
|
||||||
{ country: "意大利", languages: ["意大利语"] },
|
|
||||||
{ country: "西班牙", languages: ["西班牙语"] },
|
|
||||||
{ country: "日本", languages: ["日文"] },
|
|
||||||
{ country: "韩国", languages: ["韩文"] },
|
|
||||||
{ country: "澳大利亚", languages: ["英文"] },
|
|
||||||
{ country: "新加坡", languages: ["英文", "中文"] },
|
|
||||||
{ country: "马来西亚", languages: ["马来语", "英文", "中文"] },
|
|
||||||
{ country: "印尼", languages: ["印度尼西亚语", "英文"] },
|
|
||||||
{ country: "越南", languages: ["越南语", "英文"] },
|
|
||||||
{ country: "泰国", languages: ["泰语", "英文"] },
|
|
||||||
{ country: "菲律宾", languages: ["菲律宾语(他加禄语)", "英文"] },
|
|
||||||
{ country: "巴西", languages: ["葡萄牙语"] },
|
|
||||||
{ country: "墨西哥", languages: ["西班牙语"] },
|
|
||||||
{ country: "智利", languages: ["西班牙语"] },
|
|
||||||
{ country: "哥伦比亚", languages: ["西班牙语"] },
|
|
||||||
{ country: "阿联酋", languages: ["阿拉伯语", "英文"] },
|
|
||||||
{ country: "沙特阿拉伯", languages: ["阿拉伯语", "英文"] },
|
|
||||||
{ country: "俄罗斯", languages: ["俄语"] },
|
|
||||||
{ country: "波兰", languages: ["波兰语"] },
|
|
||||||
];
|
|
||||||
const marketOptions = marketLanguageOptions.map((option) => option.country);
|
|
||||||
const languageOptions = Array.from(new Set(marketLanguageOptions.flatMap((option) => option.languages)));
|
|
||||||
const languageAliases: Record<string, string> = {
|
|
||||||
"英文": "英文",
|
|
||||||
"中文": "中文",
|
|
||||||
"英语": "英文",
|
|
||||||
"日语": "日文",
|
|
||||||
"日文": "日文",
|
|
||||||
"德语": "德文",
|
|
||||||
"德文": "德文",
|
|
||||||
"法语": "法文",
|
|
||||||
"法文": "法文",
|
|
||||||
"韩语": "韩文",
|
|
||||||
"韩文": "韩文",
|
|
||||||
"西文": "西班牙语",
|
|
||||||
"西班牙语": "西班牙语",
|
|
||||||
"葡文": "葡萄牙语",
|
|
||||||
"葡萄牙语": "葡萄牙语",
|
|
||||||
"印尼语": "印度尼西亚语",
|
|
||||||
"印度尼西亚语": "印度尼西亚语",
|
|
||||||
"菲律宾语": "菲律宾语(他加禄语)",
|
|
||||||
"菲律宾语(他加禄语)": "菲律宾语(他加禄语)",
|
|
||||||
};
|
|
||||||
const defaultPlatformSpec = platformSpecOptions[0]!;
|
|
||||||
const getPlatformSpec = (value: string) =>
|
|
||||||
platformSpecOptions.find((option) => option.label === value || option.aliases?.includes(value)) ?? defaultPlatformSpec;
|
|
||||||
const legacyPlatformAliases: Record<string, string> = {
|
|
||||||
"淘宝/天猫": "淘宝/天猫",
|
|
||||||
"京东": "京东",
|
|
||||||
"拼多多": "拼多多",
|
|
||||||
"抖音电商": "抖音电商",
|
|
||||||
"亚马逊Amazon": "亚马逊 Amazon",
|
|
||||||
"速卖通": "速卖通",
|
|
||||||
};
|
|
||||||
const normalizePlatform = (value: string) => getPlatformSpec(legacyPlatformAliases[value] ?? value).label;
|
|
||||||
const domesticPlatformLabels = new Set(["淘宝/天猫", "京东", "拼多多", "抖音电商"]);
|
|
||||||
const domesticPlatformLanguages = ["中文"];
|
|
||||||
const isDomesticPlatform = (platformValue: string) => domesticPlatformLabels.has(normalizePlatform(platformValue));
|
|
||||||
const getPlatformRatioGroup = (value: string, mode?: PlatformRatioModeKey): PlatformRatioGroup => {
|
|
||||||
const platformSpec = getPlatformSpec(value);
|
|
||||||
return (mode ? platformSpec.ratioGroups?.[mode] : null) ?? {
|
|
||||||
ratios: platformSpec.ratios,
|
|
||||||
defaultRatio: platformSpec.defaultRatio,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const getPlatformRatioOptions = (value: string, mode?: PlatformRatioModeKey) => getPlatformRatioGroup(value, mode).ratios;
|
|
||||||
const getPlatformDefaultRatio = (value: string, mode?: PlatformRatioModeKey) => getPlatformRatioGroup(value, mode).defaultRatio;
|
|
||||||
const getUniqueRatioOptions = (ratios: string[]) => Array.from(new Set(ratios));
|
|
||||||
const normalizeRatioForPlatform = (platformValue: string, ratioValue: string, mode?: PlatformRatioModeKey) => {
|
|
||||||
const platformRatios = getPlatformRatioOptions(platformValue, mode);
|
|
||||||
if (platformRatios.includes(ratioValue)) return ratioValue;
|
|
||||||
const normalizedRatio = normalizeRatioToken(ratioValue);
|
|
||||||
const matchedRatio = platformRatios.find((option) => normalizeRatioToken(option).includes(normalizedRatio));
|
|
||||||
return matchedRatio ?? getPlatformDefaultRatio(platformValue, mode);
|
|
||||||
};
|
|
||||||
const formatUploadedImageRatio = (image?: CloneImageItem) => {
|
|
||||||
if (!image) return null;
|
|
||||||
const format = image.format ? `\u00a0\u00a0\u00a0${image.format}` : "";
|
|
||||||
if (!image.width || !image.height) return `上传图片\u00a0\u00a0\u00a0原图比例${format}`;
|
|
||||||
return `上传图片 ${image.width}×${image.height}px\u00a0\u00a0\u00a0${formatAspectRatio(image.width, image.height)}${format}`;
|
|
||||||
};
|
|
||||||
const defaultMarketLanguageOption = marketLanguageOptions[0]!;
|
|
||||||
const normalizeMarket = (value: string) =>
|
|
||||||
marketLanguageOptions.some((option) => option.country === value) ? value : defaultMarketLanguageOption.country;
|
|
||||||
const normalizeLanguage = (value: string) => languageAliases[value] ?? value;
|
|
||||||
const uniqueLanguages = (languages: string[]) => Array.from(new Set(languages));
|
|
||||||
const appendEnglish = (languages: string[]) => Array.from(new Set([...languages, "英文"]));
|
|
||||||
const getMarketLanguageOptions = (marketValue: string) =>
|
|
||||||
appendEnglish((marketLanguageOptions.find((option) => option.country === marketValue) ?? defaultMarketLanguageOption).languages);
|
|
||||||
const getPlatformLanguageOptions = (platformValue: string, marketValue: string) => {
|
|
||||||
const marketLanguages = getMarketLanguageOptions(marketValue);
|
|
||||||
if (!isDomesticPlatform(platformValue)) return marketLanguages;
|
|
||||||
const localLanguages = marketLanguages.filter((item) => item !== "英文");
|
|
||||||
return uniqueLanguages([...localLanguages, ...domesticPlatformLanguages, "英文"]);
|
|
||||||
};
|
|
||||||
const getPlatformDefaultLanguage = (platformValue: string, marketValue: string) =>
|
|
||||||
isDomesticPlatform(platformValue) ? "中文" : (getPlatformLanguageOptions(platformValue, marketValue)[0] ?? languageOptions[0] ?? "英文");
|
|
||||||
const normalizeLanguageForPlatform = (platformValue: string, marketValue: string, languageValue: string) => {
|
|
||||||
const normalizedLanguage = normalizeLanguage(languageValue);
|
|
||||||
const platformLanguages = getPlatformLanguageOptions(platformValue, marketValue);
|
|
||||||
return platformLanguages.includes(normalizedLanguage) ? normalizedLanguage : getPlatformDefaultLanguage(platformValue, marketValue);
|
|
||||||
};
|
|
||||||
const productSetOutputOptions: Array<{ key: ProductSetOutputKey; label: string; desc: string; icon: ReactNode }> = [
|
const productSetOutputOptions: Array<{ key: ProductSetOutputKey; label: string; desc: string; icon: ReactNode }> = [
|
||||||
{ key: "set", label: "套图", desc: "主图/卖点/场景", icon: <AppstoreOutlined /> },
|
{ key: "set", label: "套图", desc: "主图/卖点/场景", icon: <AppstoreOutlined /> },
|
||||||
{ key: "detail", label: "详情图", desc: "长图模块化生成", icon: <LayoutOutlined /> },
|
{ key: "detail", label: "详情图", desc: "长图模块化生成", icon: <LayoutOutlined /> },
|
||||||
@@ -1185,9 +788,6 @@ const maxCloneProductImages = 20;
|
|||||||
const maxCloneReferenceImages = 20;
|
const maxCloneReferenceImages = 20;
|
||||||
const cloneVideoDurationMin = 5;
|
const cloneVideoDurationMin = 5;
|
||||||
const cloneVideoDurationMax = 45;
|
const cloneVideoDurationMax = 45;
|
||||||
const defaultEcommercePlatform = "淘宝/天猫";
|
|
||||||
const defaultProductSetOutput: ProductSetOutputKey = "set";
|
|
||||||
const defaultCloneOutput: CloneOutputKey = "set";
|
|
||||||
const cloneVideoQualityOptions: Array<{ key: CloneVideoQualityKey; label: string; desc: string }> = [
|
const cloneVideoQualityOptions: Array<{ key: CloneVideoQualityKey; label: string; desc: string }> = [
|
||||||
{ key: "standard", label: "标准", desc: "快速出片" },
|
{ key: "standard", label: "标准", desc: "快速出片" },
|
||||||
{ key: "high", label: "高清", desc: "推荐" },
|
{ key: "high", label: "高清", desc: "推荐" },
|
||||||
|
|||||||
Reference in New Issue
Block a user