Skip to content

Commit

Permalink
fix: interval option implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
risin42 committed Oct 15, 2024
1 parent 39431f3 commit dca26d9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
5 changes: 3 additions & 2 deletions book_maker/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,10 @@ def main():
e.batch_flag = options.batch_flag
if 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.interval:
e.translate_model.set_interval(options.interval)
if options.model_list:
e.translate_model.set_model_list(options.model_list.split(","))
else:
Expand Down
2 changes: 0 additions & 2 deletions book_maker/loader/epub_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def __init__(
context_flag=False,
temperature=1.0,
context_paragraph_limit=0,
interval=0.01,
):
self.epub_name = epub_name
self.new_epub = epub.EpubBook()
Expand All @@ -46,7 +45,6 @@ def __init__(
context_flag=context_flag,
context_paragraph_limit=context_paragraph_limit,
temperature=temperature,
interval=interval,
**prompt_config_to_kwargs(prompt_config),
)
self.is_test = is_test
Expand Down
5 changes: 3 additions & 2 deletions book_maker/translator/gemini_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,10 @@ def __init__(
prompt_sys_msg=None,
context_flag=False,
temperature=1.0,
interval=0.01,
**kwargs,
) -> None:
super().__init__(key, language)
self.context_flag = context_flag
self.interval = interval
self.prompt = (
prompt_template
or environ.get(PROMPT_ENV_MAP["user"])
Expand Down Expand Up @@ -161,6 +159,9 @@ def translate(self, text):
t_text = str(num) + "\n" + t_text
return t_text

def set_interval(self, interval):
self.interval = interval

def set_geminipro_models(self):
self.set_models(GEMINIPRO_MODEL_LIST)

Expand Down

0 comments on commit dca26d9

Please sign in to comment.