mirror of
https://github.com/yihong0618/bilingual_book_maker.git
synced 2025-06-06 11:35:49 +00:00
modify: fix CI error
This commit is contained in:
parent
dafcdbfd60
commit
15be109c71
@ -102,7 +102,12 @@ class ChatGPTAPI(Base):
|
|||||||
]
|
]
|
||||||
if self.context_flag:
|
if self.context_flag:
|
||||||
messages.append({"role": "user", "content": "\n".join(self.context_list)})
|
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})
|
messages.append({"role": "user", "content": content})
|
||||||
|
|
||||||
completion = self.openai_client.chat.completions.create(
|
completion = self.openai_client.chat.completions.create(
|
||||||
@ -129,6 +134,7 @@ class ChatGPTAPI(Base):
|
|||||||
self.save_context(text, t_text)
|
self.save_context(text, t_text)
|
||||||
|
|
||||||
return t_text
|
return t_text
|
||||||
|
|
||||||
def save_context(self, text, t_text):
|
def save_context(self, text, t_text):
|
||||||
if self.context_paragraph_limit > 0:
|
if self.context_paragraph_limit > 0:
|
||||||
self.context_list.append(text)
|
self.context_list.append(text)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user