Skip to content

Commit

Permalink
Fully tested cli/console/webgui
Browse files Browse the repository at this point in the history
  • Loading branch information
Bikatr7 committed Mar 10, 2024
1 parent 4eefc28 commit ed88a1d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
1 change: 1 addition & 0 deletions handlers/json_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ def validate_json() -> None:

except Exception as e:
Logger.log_action("Kijiku Rules.json is not valid, setting to invalid_placeholder, current:")
Logger.log_action("Reason: " + str(e))
Logger.log_action(str(JsonHandler.current_kijiku_rules))
JsonHandler.current_kijiku_rules = FileEnsurer.INVALID_KIJIKU_RULES_PLACEHOLDER

Expand Down
11 changes: 3 additions & 8 deletions kudasai.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,11 @@ def boot() -> None:

FileEnsurer.setup_needed_files()

Logger.clear_log_file()

Logger.log_barrier()
Logger.log_action("Kudasai started")
Logger.log_action("Current version: " + Toolkit.CURRENT_VERSION)
Logger.log_barrier()

Logger.push_batch()
Logger.clear_batch()

try:

with open(FileEnsurer.config_kijiku_rules_path, "r") as kijiku_rules_file:
Expand Down Expand Up @@ -316,11 +311,11 @@ async def main() -> None:
"""

Kudasai.boot()
Toolkit.clear_console()

try:

Kudasai.boot()
Toolkit.clear_console()

if(len(sys.argv) <= 1):
await run_console_version()

Expand Down
17 changes: 10 additions & 7 deletions models/kijiku.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,11 @@ async def commence_translation(is_webgui:bool=False) -> None:
"""


Logger.log_barrier()
Logger.log_action("Kijiku Activated, LLM Type : " + Kijiku.LLM_TYPE)
Logger.log_barrier()
Logger.log_action("Kijiku Activated, Settings are as follows : ")
Logger.log_action("Settings are as follows : ")
Logger.log_barrier()

JsonHandler.print_kijiku_rules()
Expand Down Expand Up @@ -545,10 +548,10 @@ def generate_text_to_translate_batches(index:int) -> tuple[typing.List[str],int]

sentence = Kijiku.text_to_translate[index]
stripped_sentence = sentence.strip()
lower_sentence = sentence.lower()
lowercase_sentence = sentence.lower()

has_quotes = any(char in sentence for char in ["「", "」", "『", "』", "【", "】", "\"", "'"])
is_part_in_sentence = "part" in lower_sentence
is_part_in_sentence = "part" in lowercase_sentence

if(len(prompt) < Kijiku.number_of_lines_per_batch):

Expand Down Expand Up @@ -620,13 +623,13 @@ def build_translation_batches() -> None:

i+=1

if(i % 2 == 0):
Logger.log_action(str(message))
message = str(message) if Kijiku.LLM_TYPE == 'gemini' else message.content # type: ignore

else:
Logger.log_action(str(message))
if(i % 2 == 1):
Logger.log_barrier()

Logger.log_action(message)

##-------------------start-of-estimate_cost()---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

@staticmethod
Expand Down
6 changes: 3 additions & 3 deletions modules/common/file_ensurer.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ class FileEnsurer():
"openai_model": "gpt-4",
"openai_system_message": "As a Japanese to English translator, translate narration into English simple past, everything else should remain in its original tense. Maintain original formatting, punctuation, and paragraph structure. Keep pre-translated terms and anticipate names not replaced. Preserve terms and markers marked with >>><<< and match the output's line count to the input's. Note: 〇 indicates chapter changes.",
"openai_temperature": 0.3,
"openai_top_p": 1,
"openai_top_p": 1.0,
"openai_n": 1,
"openai_stream": False,
"openai_stop": None,
"openai_logit_bias": None,
"openai_max_tokens": None,
"openai_presence_penalty": 0,
"openai_frequency_penalty": 0
"openai_presence_penalty": 0.0,
"openai_frequency_penalty": 0.0
},

"gemini settings": {
Expand Down
2 changes: 1 addition & 1 deletion modules/common/toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def get_timestamp(is_archival:bool=False) -> str:
"""

if(is_archival):
time_stamp = datetime.now().strftime("%Y-%m-%d %H-%M-%S")
time_stamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")

else:
time_stamp = "[" + datetime.now().strftime("%Y-%m-%d %H:%M:%S") + "] "
Expand Down

0 comments on commit ed88a1d

Please sign in to comment.