Cerlancism / chatgpt-subtitle-translator

Efficient translation tool based on ChatGPT API
https://cerlancism.github.io/chatgpt-subtitle-translator/
MIT License
199 stars 16 forks source link

请问怎么设置代理服务器 #14

Closed bee2287448 closed 8 months ago

bee2287448 commented 9 months ago

大佬你好, 我用windows 安装了nodejs,然后用命令行运行: node cli\translator.mjs --plain-text "你好" 然后报错: [Translator] System Instruction: Translate to English [Error_CheckModeration] 2023-12-16T06:12:30.608Z Status undefined Error Connection error. undefined

我用clash进行代理,我在命令行窗口用 set http_proxy=127.0.0.1:7890 set https_proxy=127.0.0.1:7890 也不管用,请问怎么设置走代理。

Cerlancism commented 9 months ago

你好,

现在还没有直接支持走代理, 今晚我会试试看

Cerlancism commented 9 months ago

刚支持了 http_proxy 代理。要用 http://, 代理需要转换 HTTP -> HTTPS

Command Prompt

set http_proxy=http://192.168.1.106:18899
node cli\translator.mjs --plain-text "你好"
[CLI HTTP PROXY] Using HTTP Proxy from ENV Detected http://192.168.1.106:18899
[Translator] System Instruction: Translate to English
Hello.
bee2287448 commented 9 months ago

大佬, 我依然会报错: 你那句话 代理需要转换http--》https是什么意思呢? E:\Program Files (x86)\chatgpt-subtitle-translator-1.4.0>node cli\translator.mjs --plain-text "你好" [CLI HTTP PROXY] Using HTTP Proxy from ENV Detected http://127.0.0.1:7890 [Translator] System Instruction: Translate to English [Error_CheckModeration] 2023-12-16T13:18:13.156Z Status 502 Error 502 status code (no body) undefined [Error_CheckModeration] Retries 1 Delay 1000 [Error_CheckModeration] 2023-12-16T13:22:02.276Z Status 502 Error 502 status code (no body) undefined [Error_CheckModeration] Retries 2 Delay 8000 [Error_CheckModeration] 2023-12-16T13:25:05.095Z Status undefined Error Connection error. undefined

Cerlancism commented 9 months ago

现在试一试只在 https_proxy 但设置 http://

set https_proxy=http://127.0.0.1:7890
node cli\translator.mjs --plain-text "你好"
[CLI HTTP/HTTPS PROXY] Using HTTP/HTTP Proxy from ENV Detected {
  httpProxyConfig: undefined,
  httpsProxyConfig: 'http://127.0.0.1:7890'
}
[Translator] System Instruction: Translate to English
Hello

image

bee2287448 commented 9 months ago

大佬,非常感谢,已经可以了。

bee2287448 commented 9 months ago

大佬,非常感谢,已经可以了。