Update public-api.js via upload script - 2026-10-23 11:54:53
This commit is contained in:
parent
f8569e4008
commit
e8b3a00266
|
|
@ -64,6 +64,19 @@ const FIELDS = {
|
|||
interfacePort: 'interfacePort',
|
||||
humidity: 'humidity',
|
||||
noiseLevel: 'noiseLevel',
|
||||
// —— 机架式 / 在线式 UPS 的参数 ——
|
||||
phase: 'phase',
|
||||
inputPowerFactor: 'inputPowerFactor',
|
||||
transferTimeAcToBattery: 'transferTimeAcToBattery',
|
||||
currentCrestRatio: 'currentCrestRatio',
|
||||
harmonicDistortion: 'harmonicDistortion',
|
||||
efficiencyAcMode: 'efficiencyAcMode',
|
||||
efficiencyBatteryMode: 'efficiencyBatteryMode',
|
||||
chargingVoltage: 'chargingVoltage',
|
||||
optionalSnmp: 'optionalSnmp',
|
||||
outputPowerFactor: 'outputPowerFactor',
|
||||
parallelUnits: 'parallelUnits',
|
||||
overload: 'overload',
|
||||
sockets: 'webSockets', // 网站展示的默认插座配置 [{ type: 'SCHUKO'|'NEMA'|'UK'|'UNIVERSAL'|'IEC'|'AU', count }]
|
||||
};
|
||||
const PUBLISH_FLAG = 'publishToWeb'; // 新增:"发布到网站"开关
|
||||
|
|
@ -145,7 +158,9 @@ async function translateStrings(ai, strings) {
|
|||
// 结果放在 specI18n: { 字段: { en, es, ru } },网站按语言取用;翻译失败的字段网站上不显示(不会露出中文)。
|
||||
const SPEC_TRANSLATE_FIELDS = ['inputVoltage', 'acInputVoltage', 'inputVoltageRange', 'inputFrequency', 'outputVoltage', 'outputVoltageRange', 'transferTime', 'waveform',
|
||||
'frequencyRangeBatteryMode', 'batteryVoltage', 'chargeCurrent', 'chargeTime', 'lcdDisplay', 'ledDisplay', 'fullProtection', 'alarmInfo', 'interfacePort',
|
||||
'humidity', 'noiseLevel', 'outputPower', 'powerFactor', 'batterySpec', 'dimensions', 'netWeight'];
|
||||
'humidity', 'noiseLevel', 'outputPower', 'powerFactor', 'batterySpec', 'dimensions', 'netWeight',
|
||||
'phase', 'inputPowerFactor', 'transferTimeAcToBattery', 'harmonicDistortion', 'efficiencyAcMode', 'efficiencyBatteryMode', 'chargingVoltage',
|
||||
'optionalSnmp', 'outputPowerFactor', 'parallelUnits', 'overload'];
|
||||
const ZH_TARGETS = { en: 'English', ...WEB_TRANSLATE_LANGS };
|
||||
const hasZh = (s) => /[\u4e00-\u9fff]/.test(String(s || ''));
|
||||
async function translateSpecs(ai, products) {
|
||||
|
|
@ -228,12 +243,13 @@ async function translateTemplateHtml(ai, products) {
|
|||
|
||||
// ===== 网站产品介绍:没手动填英文介绍的产品,由 AI 根据参数自动写一段 =====
|
||||
// 参数变了会重新生成(缓存按参数内容算);手动填了英文介绍就一直用手动的。
|
||||
const TYPE_EN = { '迷你UPS': 'Mini DC UPS', '离线式UPS': 'Offline UPS', '离线式锂电UPS': 'Lithium-ion offline UPS', '在线互动式UPS': 'Line-interactive UPS' };
|
||||
const TYPE_EN = { '迷你UPS': 'Mini DC UPS', '离线式UPS': 'Offline UPS', '离线式锂电UPS': 'Lithium-ion offline UPS', '在线互动式UPS': 'Line-interactive UPS', '机架式UPS': 'Rack-mount online double-conversion UPS' };
|
||||
const DESC_SKIP = new Set(['model', 'brand', 'category', 'type', 'machineVariant', 'description', 'sale', 'youtube', 'sellingPoints', 'sockets', 'extraSpecs', 'pack']);
|
||||
const SOCKET_EN = { SCHUKO: 'Schuko', NEMA: 'NEMA 5-15', UK: 'BS 1363 (UK)', UNIVERSAL: 'universal', IEC: 'IEC C13', AU: 'Type I (AU/CN)' };
|
||||
function descFacts(p) {
|
||||
const f = { model: p.model };
|
||||
if (TYPE_EN[p.type]) f.type = TYPE_EN[p.type];
|
||||
if (p.type === '机架式UPS' && p.machineVariant) f.variant = /长/.test(p.machineVariant) ? 'Long-run model: no internal batteries, connects to an external battery bank' : 'Standard model with internal batteries';
|
||||
for (const [k, v] of Object.entries(p)) {
|
||||
if (DESC_SKIP.has(k) || k.startsWith('_') || ['slug', 'images', 'detailImages', 'templateImages', 'templateHtml', 'specI18n'].includes(k)) continue;
|
||||
const en = p.specI18n && p.specI18n[k] && p.specI18n[k].en;
|
||||
|
|
|
|||
Loading…
Reference in New Issue