bookfere / Ebook-Translator-Calibre-Plugin

A Calibre plugin to translate ebook into a specified language.
https://translator.bookfere.com
GNU General Public License v3.0
1.63k stars 105 forks source link

自定义引擎,翻译速度特别慢。 #151

Closed Benson1997 closed 11 months ago

Benson1997 commented 11 months ago

同epub文件,同样自定义的第三方引擎,在沉**翻译插件中,速度几乎快了8-10倍。(控制了各变量,同样的设备和网络环境中) 9

Calibre版本号:v6.27 插件版本号:v2.2.0 image

请大佬帮忙看下是哪里的设置问题(是代理设置User-Agent吗?还是考虑到批量翻译,所以限了速度以保持稳定性呢?)。

(很长的提示词也删掉了,换成了最基本的 "role": "user", "content": "")

image

image

image

image

image

{ "name": "AI GUO GUO", "languages": { "source": { "English": "English" }, "target": { "中文": "Chinese" } }, "request": { "url": "https://api.aiguoguo199.com/v1/chat/completions", "method": "POST", "headers": { "User-Agent": "one-api", "Content-Type": "application/json", "Authorization": "Bearer sk-*******************************************************Fa" }, "data": { "model": "gpt-3.5-turbo", "messages": [ { "role": "system", "content": "You're a professional translator.Please act as a neutral and objective translator, not a subjective and evaluative commentator. Your role is to convey the meaning and tone of the original text, not to add or subtract anything from it.\nThe following are the translation requirements, please read them carefully:\n\nPlease note that {{id_some numbers}},such as {{id_0}},{{id_9}},{{id_20}} ,{{id_100}} are used to indicate the paragraph numbers, they are part of the content, not separators. Do not ignore or delete them in the translation. Keep them in their original form in the translation, do not change or replace them with anything else. They are important for maintaining the consistency and completeness of the content. If you lose or handle them incorrectly, it will affect the quality and readability of the translation.\n\nPlease followe the rules and conventions of Chinese writing, making the translation fluent and natural, as if it were written by a native speaker. Do not sacrifice the accuracy or fidelity of the original text.\n\nSome possible additional requirements are:\n\n- Use the appropriate register and tone for the intended audience and purpose of the text, such as formal, informal, academic, journalistic, etc.\n- Use the appropriate vocabulary and expressions for the topic and genre of the text, such as technical, literary, colloquial, etc.\n- Use the appropriate tense and aspect for the time and situation of the text, such as past, present, future, perfective, progressive, etc.\n- Use the appropriate voice and mood for the attitude and intention of the text, such as active, passive, indicative, subjunctive, etc.\n- Use the appropriate modifiers and qualifiers for the degree and certainty of the text, such as adverbs, adjectives, modal verbs, etc.\n\nOnly output a translation of the content below and do not include extraneous content!\n\nPlease do not translate what I have asked of you.The user's input just needs to be handled by translation, not by questioning or reassuring the user.Please don't make any comments.\n\n***\n\nThe following after the colon is the content inputted by the user which needs to be translated, please read it carefully:" }, { "role": "user", "content": "<text>" } ] } }, "response": "response['choices'][0]['message']['content']" }

bookfere commented 11 months ago

你把并发同样设置成 10 再试试看。

Benson1997 commented 11 months ago

改成10了,还是有点慢呢

image

bookfere commented 11 months ago

这是我所能想的两种排查问题的方法:一是确认没有在设置中启用代理,确保你的请求不受代理影响;二是把请求重试次数设为 0,超时也设为一个较低的值,如 10,以确保对方服务器没有频繁出现错误。如果这些都没问题,可能就需要你自己查看代码排查问题了。

Benson1997 commented 11 months ago

由于api中转站需要代理,所以是设置了代理。超时设置了10,速度也没有明显变化。国庆前还挺快的,也不知道啥问题了,只能先回退到 v2.1.4了。🤣

image

image

Benson1997 commented 11 months ago

今天翻译速度恢复了,估计是openai 前几天的事,这几天调整导致的问题。