From 1c0392099c6cc08f27e9a418ddc50d9e49bd92d2 Mon Sep 17 00:00:00 2001 From: zerozzz123456 <110470300+zerozzz123456@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:13:33 +0800 Subject: [PATCH 1/3] Update chatgpt.py gpt-4o update to gpt-4o-mini-2024-07-18 --- manga_translator/translators/chatgpt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manga_translator/translators/chatgpt.py b/manga_translator/translators/chatgpt.py index b65e6461b..5ad3bc2d5 100644 --- a/manga_translator/translators/chatgpt.py +++ b/manga_translator/translators/chatgpt.py @@ -328,7 +328,7 @@ def strip_first_line(txt: str) : return txt response = await self.client.chat.completions.create( - model='gpt-4o', + model='gpt-4o-mini-2024-07-18', messages=messages, max_tokens=self._MAX_TOKENS // 2, temperature=self.temperature, From 17fabee1bd8b201fffed68fcfa4446a389cb45a6 Mon Sep 17 00:00:00 2001 From: zerozzz123456 <110470300+zerozzz123456@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:15:24 +0800 Subject: [PATCH 2/3] Update keys.py Place the chatgpt4 model selection into the .env file for user modification replacement --- manga_translator/translators/keys.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manga_translator/translators/keys.py b/manga_translator/translators/keys.py index f08a289ac..932777638 100644 --- a/manga_translator/translators/keys.py +++ b/manga_translator/translators/keys.py @@ -16,6 +16,7 @@ OPENAI_HTTP_PROXY = os.getenv('OPENAI_HTTP_PROXY') # TODO: Replace with --proxy OPENAI_API_BASE = os.getenv('OPENAI_API_BASE', 'https://api.openai.com/v1') #使用api-for-open-llm例子 http://127.0.0.1:8000/v1 +CHATGPT_4_MODEL=os.getenv('CHATGPT_4_MODEL','gpt-4o') # sakura SAKURA_API_BASE = os.getenv('SAKURA_API_BASE', 'http://127.0.0.1:8080/v1') #SAKURA API地址 @@ -27,4 +28,4 @@ # deepseek DEEPSEEK_API_KEY = os.getenv('DEEPSEEK_API_KEY', '') -DEEPSEEK_API_BASE = os.getenv('DEEPSEEK_API_BASE', 'https://api.deepseek.com') \ No newline at end of file +DEEPSEEK_API_BASE = os.getenv('DEEPSEEK_API_BASE', 'https://api.deepseek.com') From 351b35779a6b93136a9cd1c14b7af534fbc2604c Mon Sep 17 00:00:00 2001 From: zerozzz123456 <110470300+zerozzz123456@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:16:32 +0800 Subject: [PATCH 3/3] Update chatgpt.py Place the chatgpt4 model selection into the .env file for user modification replacement --- manga_translator/translators/chatgpt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manga_translator/translators/chatgpt.py b/manga_translator/translators/chatgpt.py index 5ad3bc2d5..31dc6d3e4 100644 --- a/manga_translator/translators/chatgpt.py +++ b/manga_translator/translators/chatgpt.py @@ -8,7 +8,7 @@ from typing import List, Dict from .common import CommonTranslator, MissingAPIKeyException -from .keys import OPENAI_API_KEY, OPENAI_HTTP_PROXY, OPENAI_API_BASE +from .keys import OPENAI_API_KEY, OPENAI_HTTP_PROXY, OPENAI_API_BASE,CHATGPT_4_MODEL CONFIG = None class GPT3Translator(CommonTranslator): @@ -328,7 +328,7 @@ def strip_first_line(txt: str) : return txt response = await self.client.chat.completions.create( - model='gpt-4o-mini-2024-07-18', + model=CHATGPT_4_MODEL, messages=messages, max_tokens=self._MAX_TOKENS // 2, temperature=self.temperature,