Update storage.js via upload script - 2026-11-09 16:28:13
This commit is contained in:
parent
255e1e92c0
commit
1528d5643e
18
storage.js
18
storage.js
|
|
@ -283,7 +283,6 @@ export async function parseCatalogFiles(files, hints) {
|
||||||
if (hints.category) fd.append('hintCategory', hints.category);
|
if (hints.category) fd.append('hintCategory', hints.category);
|
||||||
if (hints.brand) fd.append('hintBrand', hints.brand);
|
if (hints.brand) fd.append('hintBrand', hints.brand);
|
||||||
if (hints.type) fd.append('hintType', hints.type);
|
if (hints.type) fd.append('hintType', hints.type);
|
||||||
if (hints.precise) fd.append('precise', '1'); // 精准导入:同时生成原版版式的彩页
|
|
||||||
}
|
}
|
||||||
// async=1:后端立刻返回 jobId,然后这里每 3 秒查一次结果,避免长请求被代理掐断(Failed to fetch)
|
// async=1:后端立刻返回 jobId,然后这里每 3 秒查一次结果,避免长请求被代理掐断(Failed to fetch)
|
||||||
let res;
|
let res;
|
||||||
|
|
@ -327,23 +326,6 @@ async function pollAiJob(jobId) {
|
||||||
throw new Error('AI导入超过15分钟没有完成,请重试');
|
throw new Error('AI导入超过15分钟没有完成,请重试');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 精准导入生成的"原版彩页":基本信息(页数、原文语言、已翻译的语言)
|
|
||||||
export async function getPreciseDoc(id) {
|
|
||||||
const res = await fetch(`/api/precise/${encodeURIComponent(id)}`);
|
|
||||||
const data = await res.json().catch(() => ({}));
|
|
||||||
if (!res.ok) throw new Error(data.error || `HTTP ${res.status}`);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
// 把原版彩页翻译成某种语言(AI 翻译,结果存在服务器上,之后切换语言直接显示)
|
|
||||||
export async function translatePreciseDoc(id, lang, force) {
|
|
||||||
const res = await fetch(`/api/precise/${encodeURIComponent(id)}/translate`, {
|
|
||||||
method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ lang, force: !!force }),
|
|
||||||
});
|
|
||||||
const data = await res.json().catch(() => ({}));
|
|
||||||
if (!res.ok) throw new Error(data.error || `翻译失败(HTTP ${res.status})`);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 把一批中文词汇翻译成目标语言(en/fr/ru/es/ar),返回 {原词: 译文} 的映射。
|
// 把一批中文词汇翻译成目标语言(en/fr/ru/es/ar),返回 {原词: 译文} 的映射。
|
||||||
// 词条缓存由调用方(App.jsx)自己管理,这里只负责翻译本身。
|
// 词条缓存由调用方(App.jsx)自己管理,这里只负责翻译本身。
|
||||||
export async function translateTerms(terms, targetLang) {
|
export async function translateTerms(terms, targetLang) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue