Skip to content

Commit

Permalink
modify: fix CI error
Browse files Browse the repository at this point in the history
  • Loading branch information
mkXultra committed Aug 14, 2024
1 parent dafcdbf commit 15be109
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion book_maker/translator/chatgptapi_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@ def create_chat_completion(self, text):
]
if self.context_flag:
messages.append({"role": "user", "content": "\n".join(self.context_list)})
messages.append({"role": "assistant", "content": "\n".join(self.context_translated_list)})
messages.append(
{
"role": "assistant",
"content": "\n".join(self.context_translated_list),
}
)
messages.append({"role": "user", "content": content})

completion = self.openai_client.chat.completions.create(
Expand All @@ -129,6 +134,7 @@ def get_translation(self, text):
self.save_context(text, t_text)

return t_text

def save_context(self, text, t_text):
if self.context_paragraph_limit > 0:
self.context_list.append(text)
Expand Down

0 comments on commit 15be109

Please sign in to comment.