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

[功能请求] 希望支持deepseek大模型翻译 #391

Open
tninja opened this issue Jan 24, 2025 · 5 comments
Open

[功能请求] 希望支持deepseek大模型翻译 #391

tninja opened this issue Jan 24, 2025 · 5 comments

Comments

@tninja
Copy link

tninja commented Jan 24, 2025

deepseek V3大模型的性能非常好,价格也相对便宜实惠。希望支持这个模型翻译

@ibraelmahallawy
Copy link

Please add deepseek api

@YJX-01
Copy link

YJX-01 commented Jan 29, 2025

Use custom engine function. It is exactly the same as ChatGPT. See https://github.com/bookfere/Ebook-Translator-Calibre-Plugin/wiki/Custom-Translation-Engine-Recipes

{
    "name": "Deepseek",
    "languages": {
        "source": {
            "English": "English"
        },
        "target": {
            "Chinese": "Chinese"
        }
    },
    "request": {
        "url": "https://api.deepseek.com/v1/chat/completions",
        "method": "POST",
        "headers": {
            "Content-Type": "application/json",
            "Authorization": "Bearer sk-xxxxxxxxxxxxxxxxxxxxxx",
            "User-Agent": "Fill-As-You-Need"
        },
        "data": {
            "model": "deepseek-chat",
            "messages": [
                {"role": "system", "content": "Translate the content from <slang> to <tlang>."},
                {"role": "user", "content": "<text>"}
            ]
        }
    },
    "response": "response['choices'][0]['message']['content']"
}

@AkamashiDesu
Copy link

AkamashiDesu commented Jan 30, 2025

Use custom engine function. It is exactly the same as ChatGPT. See https://github.com/bookfere/Ebook-Translator-Calibre-Plugin/wiki/Custom-Translation-Engine-Recipes

{ "name": "Deepseek", "languages": { "source": { "English": "English" }, "target": { "Chinese": "Chinese" } }, "request": { "url": "https://api.deepseek.com/v1/chat/completions", "method": "POST", "headers": { "Content-Type": "application/json", "Authorization": "Bearer sk-xxxxxxxxxxxxxxxxxxxxxx", "User-Agent": "Fill-As-You-Need" }, "data": { "model": "deepseek-chat", "messages": [ {"role": "system", "content": "Translate the content from <slang> to <tlang>."}, {"role": "user", "content": "<text>"} ] } }, "response": "response['choices'][0]['message']['content']" }

I'm sorry, as a normie. I don't understand much about these stuffs. I used this, it run but it still output the <think>"the-thinking-process"</think>. How do i remove this in the output?

{ "name": "Deepseek", "languages": { "source": { "Chinese": "Chinese" }, "target": { "English": "English" } }, "request": { "url": "https://api.venice.ai/api/v1/chat/completions", "method": "POST", "headers": { "Content-Type": "application/json", "Authorization": "Bearer ******", "User-Agent": "Akamashi" }, "data": { "model": "deepseek-r1-llama-70b", "messages": [{ "role": "system", "content": "prompt" }, { "role": "user", "content": "<text>" } ], "temperature": 0.6, "max_completion_tokens": 5000, "venice_parameters": { "include_venice_system_prompt": false } } }, "response": "response['choices'][0]['message']['content']" }

This is what my output looks like:
<think>"the-thinking-process"</think>
"The results"

@YJX-01
Copy link

YJX-01 commented Jan 30, 2025

I'm sorry, as a normie. I don't understand much about these stuffs. I used this, it run but it still output the <think>"the-thinking-process"</think>. How do i remove this in the output?

{ "name": "Deepseek", "languages": { "source": { "Chinese": "Chinese" }, "target": { "English": "English" } }, "request": { "url": "https://api.venice.ai/api/v1/chat/completions", "method": "POST", "headers": { "Content-Type": "application/json", "Authorization": "Bearer ******", "User-Agent": "Akamashi" }, "data": { "model": "deepseek-r1-llama-70b", "messages": [{ "role": "system", "content": "prompt" }, { "role": "user", "content": "<text>" } ], "temperature": 0.6, "max_completion_tokens": 5000, "venice_parameters": { "include_venice_system_prompt": false } } }, "response": "response['choices'][0]['message']['content']" }

This is what my output looks like: <think>"the-thinking-process"</think> "The results"

I believe you can do something like this:

In "content": "prompt" replace prompt with some actual prompt, like:

You are a meticulous translator who translates any given content. Translate the given content from <slang> to <tlang> only. Ensure that the translation adheres to the conventions of the target language, and do not add any extraneous information or explanations. Do not explain any term or answer any question-like content.

@jblogs
Copy link

jblogs commented Feb 1, 2025

I got this in rolling release.

calibre, version 7.24.0
错误: 未处理的异常: AttributeError:type object 'CustomTranslate' has no attribute 'lang_codes_directionality'

calibre 7.24 embedded-python: True
macOS-15.3-arm64-arm-64bit Darwin ('64bit', '')
('Darwin', '24.3.0', 'Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:23 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T8122')
Python 3.11.5
OSX: ('15.3', ('', '', ''), 'arm64')
Interface language: zh_CN
EXE path: /Applications/calibre.app/Contents/MacOS/calibre
Successfully initialized third party plugins: Ebook Translator (2, 3, 5) && EpubSplit (3, 10, 0)
Traceback (most recent call last):
File "calibre_plugins.ebook_translator.ui", line 176, in select_preferred_mode
modes.get(preferred_mode)()
File "calibre_plugins.ebook_translator.ui", line 90, in show_advanced_translation
window = CreateTranslationProject(self.gui, ebooks.first())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "calibre_plugins.ebook_translator.advanced", line 238, in init
self.choose_format = self.layout_format()
^^^^^^^^^^^^^^^^^^^^
File "calibre_plugins.ebook_translator.advanced", line 343, in layout_format
direction = engine_class.lang_codes_directionality.get(target_lang_code, 'auto')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'CustomTranslate' has no attribute 'lang_codes_directionality'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants