fix: ci error

This commit is contained in:
mkXultra 2024-08-20 16:29:52 +09:00
parent fd92f7ae56
commit 452c1bdbaf
2 changed files with 8 additions and 6 deletions

View File

@ -1,8 +1,8 @@
config = { config = {
"translator": { "translator": {
"chatgptapi": { "chatgptapi": {
"context_paragraph_limit" : 3, "context_paragraph_limit": 3,
"batch_context_update_interval" : 50, "batch_context_update_interval": 50,
} }
}, },
} }

View File

@ -12,6 +12,7 @@ from rich import print
from .base_translator import Base from .base_translator import Base
from ..config import config from ..config import config
CHATGPT_CONFIG = config["translator"]["chatgptapi"] CHATGPT_CONFIG = config["translator"]["chatgptapi"]
PROMPT_ENV_MAP = { PROMPT_ENV_MAP = {
@ -42,6 +43,7 @@ GPT4oMINI_MODEL_LIST = [
"gpt-4o-mini-2024-07-18", "gpt-4o-mini-2024-07-18",
] ]
class ChatGPTAPI(Base): class ChatGPTAPI(Base):
DEFAULT_PROMPT = "Please help me to translate,`{text}` to {language}, please return only translated content not include the origin text" DEFAULT_PROMPT = "Please help me to translate,`{text}` to {language}, please return only translated content not include the origin text"
@ -486,9 +488,9 @@ class ChatGPTAPI(Base):
def create_batch_context_messages(self, index): def create_batch_context_messages(self, index):
messages = [] messages = []
if self.context_flag: if self.context_flag:
if index % CHATGPT_CONFIG["batch_context_update_interval"] == 0 or not hasattr( if index % CHATGPT_CONFIG[
self, "cached_context_messages" "batch_context_update_interval"
): ] == 0 or not hasattr(self, "cached_context_messages"):
context_messages = [] context_messages = []
for i in range(index - 1, -1, -1): for i in range(index - 1, -1, -1):
item = self.batch_text_list[i] item = self.batch_text_list[i]