mirror of
https://github.com/yihong0618/bilingual_book_maker.git
synced 2025-06-05 19:15:34 +00:00
fix: ci error
This commit is contained in:
parent
fd92f7ae56
commit
452c1bdbaf
@ -1,8 +1,8 @@
|
||||
config = {
|
||||
"translator": {
|
||||
"chatgptapi": {
|
||||
"context_paragraph_limit" : 3,
|
||||
"batch_context_update_interval" : 50,
|
||||
"context_paragraph_limit": 3,
|
||||
"batch_context_update_interval": 50,
|
||||
}
|
||||
},
|
||||
}
|
@ -12,6 +12,7 @@ from rich import print
|
||||
|
||||
from .base_translator import Base
|
||||
from ..config import config
|
||||
|
||||
CHATGPT_CONFIG = config["translator"]["chatgptapi"]
|
||||
|
||||
PROMPT_ENV_MAP = {
|
||||
@ -42,6 +43,7 @@ GPT4oMINI_MODEL_LIST = [
|
||||
"gpt-4o-mini-2024-07-18",
|
||||
]
|
||||
|
||||
|
||||
class ChatGPTAPI(Base):
|
||||
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):
|
||||
messages = []
|
||||
if self.context_flag:
|
||||
if index % CHATGPT_CONFIG["batch_context_update_interval"] == 0 or not hasattr(
|
||||
self, "cached_context_messages"
|
||||
):
|
||||
if index % CHATGPT_CONFIG[
|
||||
"batch_context_update_interval"
|
||||
] == 0 or not hasattr(self, "cached_context_messages"):
|
||||
context_messages = []
|
||||
for i in range(index - 1, -1, -1):
|
||||
item = self.batch_text_list[i]
|
||||
|
Loading…
x
Reference in New Issue
Block a user