fix: Modify log location and regular expressions

This commit is contained in:
h 2023-03-17 03:36:50 +08:00
parent c28ae78119
commit 413810e2bf

View File

@ -86,7 +86,7 @@ class ChatGPTAPI(Base):
t_text = choice.get("message").get("content").encode("utf8").decode()
if choice["finish_reason"] == "length":
with open("long_text.txt", "a") as f:
with open("log/long_text.txt", "a") as f:
print(
f"""==================================================
The total token is too long and cannot be completely translated\n
@ -245,5 +245,5 @@ The total token is too long and cannot be completely translated\n
self.log_translation_mismatch(plist_len, result_list, new_str, sep, log_path)
# del (num), num. sometime (num) will translated to num.
result_list = [re.sub(r"^(\(\d+\)|\d+\.)\s*", "", s) for s in result_list]
result_list = [re.sub(r"^(\(\d+\)|\d+\.|\d+)\s*", "", s) for s in result_list]
return result_list