[Question] lobe-i18n cli run failed?
xieyezi opened this issue · comments
🧐 问题描述 | Proposed Solution
First of all, thank you very much for providing this tool!
I'm having some problems now.
This my script:
...
execSync(`lobe-i18n md --config ${componentTranslateConfigPath}`, {
cwd: process.cwd(),
stdio: "inherit",
env: {
OPENAI_PROXY_URL: "xxxx",
OPENAI_API_KEY: "xxxx"
}
});
...
and this is my .i18nrc.js
:
const path = require("path");
const { defineConfig } = require("@lobehub/i18n-cli");
module.exports = defineConfig({
markdown: {
entry: [path.resolve(__dirname, "./index.md")],
entryLocale: "en-US",
entryExtension: ".md",
outputLocales: ["zh-CN"],
outputExtensions: (locale, { getDefaultExtension }) => {
//if (locale === "en-US") return ".md";
return getDefaultExtension(locale);
}
}
});
All the config load normally, but it's failed:
ℹ start translate portal doc... 17:17:02
o Lobe I18N is analyzing your markdown... 🤯🌏🔍 17:17:05
o Running in 📄 1 Markdown, and translating to zh-CN locales.. 17:17:05
i 📄 To zh-CN: src\portal\index.md 17:17:05
i Current model setting: gpt-3.5-turbo (temperature: 0) } 17:17:05
──── 📝 E:\project\incall-fuxi\packages\fuxi\src\portal\index.zh-CN.md
- from en-US to zh-CN [Tokens: 1619]
⠧ 0% [0/1 chunks]
ERROR Translate failed, TypeError: Cannot read properties of undefined (reading 'message') 17:17:07
📝 补充信息 | Additional Information
No response
👀 @xieyezi
Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。
@xieyezi 可能需要你这边排除下问题
- 直接用命令行执行 cli 是否成功
- 试试在 index.md 中只输入简单语句看看是否正确执行翻译
- 如果上述可以执行,尝试吧 splitToken 改小
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
@xieyezi You may need to troubleshoot the problem here
- Is it successful to execute cli directly from the command line?
- Try entering only simple statements in index.md to see if the translation is performed correctly
- If the above can be executed, try changing splitToken to smaller size
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
@xieyezi You may need to troubleshoot the problem here
- Whether executing cli directly from the command line is successful?
- Try entering only simple statements in index.md to see if the translation is performed correctly
- If the above can be executed, try changing splitToken to smaller size
Hello, please tell me how to pass in the two environment variables OPENAI_API_KEY
and OPENAI_PROXY_URL
when executing directly from the command line.
我直接使用 cli方式进行调用:
export OPENAI_PROXY_URL=xxx
export OPENAI_API_KEY=xxx
lobe-i18n md -c ./.i18nrc.js
这是我的markdown
文件:
// index.md
## Features
- Multi portals handling.
- Multi portal hosts handling.
- Allow override functionality.
- Compatible with React Native Web.
- Compatible with Expo, check out the project Expo Snack.
- Written in TypeScript.
但是仍然无法调用,提示如下错误:
$ lobe-i18n md -c ./.i18nrc.js
◐ Lobe I18N is analyzing your markdown... 🤯🌏🔍 15:21:01
◐ Running in 📄 1 Markdown, and translating to zh-CN locales.. 15:21:01
ℹ 📄 To zh-CN: index.md 15:21:01
ℹ Current model setting: gpt-3.5-turbo (temperature: 0) } 15:21:01
─── 📝 E:\project\incall-fuxi\packages\fuxi\src\portal\index.zh-CN.md
- from en-US to zh-CN [Tokens: 200]
⠋ 0% [0/1 chunks] ░░░░░░░░░░░
ERROR Translate failed, TypeError: Cannot read properties of undefined (reading 'message') 15:21:03
以下是我的环境信息:
System:
OS: Windows 10 10.0.19045
CPU: (16) x64 Intel(R) Xeon(R) W-2245 CPU @ 3.90GHz
Memory: 18.50 GB / 31.73 GB
Binaries:
Node: 18.12.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
pnpm: 8.8.0 - ~\AppData\Roaming\npm\pnpm.CMD
@xieyezi curl 试试 ? curl {{OPENAI_PROXY_URL}}/engines -H "Authorization: Bearer {{OPENAI_API_KEY}}"
Thank you for your hard work and dedication in creating such great tools. I encountered a similar issue with lobeChat before, where responses failed. After numerous attempts, I discovered that by simply appending /v1
to my proxy address (https://proxy-url/v1), all features, including lobeChat
and lobeI18n
, started working properly.
Thank you once again for your strenuous efforts, it's so cool!
✅ @xieyezi
This issue is closed, If you have any questions, you can comment and reply.
此问题已经关闭。如果您有任何问题,可以留言并回复。