Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] lobe-i18n cli run failed? #67

Closed
xieyezi opened this issue Dec 13, 2023 · 8 comments
Closed

[Question] lobe-i18n cli run failed? #67

xieyezi opened this issue Dec 13, 2023 · 8 comments
Labels
๐Ÿ˜‡ Help Wanted Need help | ้œ€่ฆๅธฎๅŠฉ

Comments

@xieyezi
Copy link
Contributor

xieyezi commented Dec 13, 2023

๐Ÿง ้—ฎ้ข˜ๆ่ฟฐ | 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 xieyezi added the ๐Ÿ˜‡ Help Wanted Need help | ้œ€่ฆๅธฎๅŠฉ label Dec 13, 2023
@lobehubbot
Copy link
Member

๐Ÿ‘€ @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ใ€‚ๆˆ‘ไปฌไผšๅฐฝๅฟซ่ฐƒๆŸฅๆญคไบ‹๏ผŒๅนถๅฐฝๅฟซๅ›žๅคๆ‚จใ€‚ ่ฏท็กฎไฟๆ‚จๅทฒ็ปๆไพ›ไบ†ๅฐฝๅฏ่ƒฝๅคš็š„่ƒŒๆ™ฏไฟกๆฏใ€‚

@canisminor1990
Copy link
Member

@xieyezi ๅฏ่ƒฝ้œ€่ฆไฝ ่ฟ™่พนๆŽ’้™คไธ‹้—ฎ้ข˜

  • ็›ดๆŽฅ็”จๅ‘ฝไปค่กŒๆ‰ง่กŒ cli ๆ˜ฏๅฆๆˆๅŠŸ
  • ่ฏ•่ฏ•ๅœจ index.md ไธญๅช่พ“ๅ…ฅ็ฎ€ๅ•่ฏญๅฅ็œ‹็œ‹ๆ˜ฏๅฆๆญฃ็กฎๆ‰ง่กŒ็ฟป่ฏ‘
  • ๅฆ‚ๆžœไธŠ่ฟฐๅฏไปฅๆ‰ง่กŒ๏ผŒๅฐ่ฏ•ๅง splitToken ๆ”นๅฐ

@lobehubbot
Copy link
Member

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

@lobehubbot
Copy link
Member

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.

@xieyezi
Copy link
Contributor Author

xieyezi commented Dec 15, 2023

ๆˆ‘็›ดๆŽฅไฝฟ็”จ 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

@canisminor1990
Copy link
Member

canisminor1990 commented Dec 15, 2023

@xieyezi curl ่ฏ•่ฏ• ๏ผŸ curl {{OPENAI_PROXY_URL}}/engines -H "Authorization: Bearer {{OPENAI_API_KEY}}"

@xieyezi
Copy link
Contributor Author

xieyezi commented Dec 18, 2023

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 xieyezi closed this as completed Dec 18, 2023
@lobehubbot
Copy link
Member

โœ… @xieyezi

This issue is closed, If you have any questions, you can comment and reply.
ๆญค้—ฎ้ข˜ๅทฒ็ปๅ…ณ้—ญใ€‚ๅฆ‚ๆžœๆ‚จๆœ‰ไปปไฝ•้—ฎ้ข˜๏ผŒๅฏไปฅ็•™่จ€ๅนถๅ›žๅคใ€‚

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
๐Ÿ˜‡ Help Wanted Need help | ้œ€่ฆๅธฎๅŠฉ
Projects
None yet
Development

No branches or pull requests

3 participants