fix: Skip translation if the content is null. (#1136)

This commit is contained in:
Caspian Zhao 2023-12-13 19:49:36 +00:00 committed by GitHub
parent c1acd5b3f0
commit 81caf99fb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 2 deletions

View File

@ -88,8 +88,15 @@ const getOriginalTranslation = async (
translationChains.set(`${modelSize}_${targetLang}`, chain)
}
const t = await chain.call({ text: title })
const c = await chain.call({ text: content })
const t =
String(title).trim().length === 0
? { text: "" }
: await chain.call({ text: title })
const c =
String(content).trim().length === 0
? { text: "" }
: await chain.call({ text: content })
console.timeEnd(`fetching translation ${cid}, ${targetLang}`)