Skip to content

Commit

Permalink
国际化 脚本提示ai key
Browse files Browse the repository at this point in the history
  • Loading branch information
xushengfeng committed Sep 9, 2024
1 parent bb14cb9 commit 1db85da
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/translate/tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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`);
});
}

0 comments on commit 1db85da

Please sign in to comment.