fix: interval option implementation

This commit is contained in:
risin42 2024-10-16 01:24:58 +09:00
parent 39431f3cb6
commit dca26d992e
3 changed files with 6 additions and 6 deletions

View File

@ -486,9 +486,10 @@ So you are close to reaching the limit. You have to choose your own value, there
e.batch_flag = options.batch_flag e.batch_flag = options.batch_flag
if options.batch_use_flag: if options.batch_use_flag:
e.batch_use_flag = options.batch_use_flag e.batch_use_flag = options.batch_use_flag
if options.interval:
e.interval = options.interval
if options.model == "gemini": if options.model == "gemini":
if options.interval:
e.translate_model.set_interval(options.interval)
if options.model_list: if options.model_list:
e.translate_model.set_model_list(options.model_list.split(",")) e.translate_model.set_model_list(options.model_list.split(","))
else: else:

View File

@ -35,7 +35,6 @@ class EPUBBookLoader(BaseBookLoader):
context_flag=False, context_flag=False,
temperature=1.0, temperature=1.0,
context_paragraph_limit=0, context_paragraph_limit=0,
interval=0.01,
): ):
self.epub_name = epub_name self.epub_name = epub_name
self.new_epub = epub.EpubBook() self.new_epub = epub.EpubBook()
@ -46,7 +45,6 @@ class EPUBBookLoader(BaseBookLoader):
context_flag=context_flag, context_flag=context_flag,
context_paragraph_limit=context_paragraph_limit, context_paragraph_limit=context_paragraph_limit,
temperature=temperature, temperature=temperature,
interval=interval,
**prompt_config_to_kwargs(prompt_config), **prompt_config_to_kwargs(prompt_config),
) )
self.is_test = is_test self.is_test = is_test

View File

@ -61,12 +61,10 @@ class Gemini(Base):
prompt_sys_msg=None, prompt_sys_msg=None,
context_flag=False, context_flag=False,
temperature=1.0, temperature=1.0,
interval=0.01,
**kwargs, **kwargs,
) -> None: ) -> None:
super().__init__(key, language) super().__init__(key, language)
self.context_flag = context_flag self.context_flag = context_flag
self.interval = interval
self.prompt = ( self.prompt = (
prompt_template prompt_template
or environ.get(PROMPT_ENV_MAP["user"]) or environ.get(PROMPT_ENV_MAP["user"])
@ -161,6 +159,9 @@ class Gemini(Base):
t_text = str(num) + "\n" + t_text t_text = str(num) + "\n" + t_text
return t_text return t_text
def set_interval(self, interval):
self.interval = interval
def set_geminipro_models(self): def set_geminipro_models(self):
self.set_models(GEMINIPRO_MODEL_LIST) self.set_models(GEMINIPRO_MODEL_LIST)