diff --git a/lib/translate/tool.js b/lib/translate/tool.js index c09602223..83733cc7e 100644 --- a/lib/translate/tool.js +++ b/lib/translate/tool.js @@ -145,6 +145,8 @@ if (uuid) { if (ai) { const tt = getToTranslate(ai); console.log(tt); + if (!process.env.gpt) + throw new Error("Please set GPT_TOKEN: export gpt=sk-"); fetch("https://api.chatanywhere.tech/v1/chat/completions", { method: "POST", headers: { @@ -200,9 +202,6 @@ if (ai) { const id = source[i]; out[id] = v[id] || l[id] || ""; } - fs.writeFileSync( - `${ai}.json`, - `${JSON.stringify(out, null, 4)}\n`, - ); + fs.writeFileSync(`${ai}.json`, `${JSON.stringify(out, null, 4)}\n`); }); }