diff --git a/manga_translator/translators/chatgpt.py b/manga_translator/translators/chatgpt.py index b65e6461b..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', + model=CHATGPT_4_MODEL, messages=messages, max_tokens=self._MAX_TOKENS // 2, temperature=self.temperature, 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')