From cc9e816c578d7f0908f982c3598e2719b4cfcfd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Will=20=E4=BF=9D=E5=93=A5?= Date: Sun, 2 Apr 2023 17:09:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=BF=20BBM=5FCHATGPTAPI=5FSYS=5FMSG=20?= =?UTF-8?q?=E8=88=87=20BBM=5FCHATGPTAPI=5FUSER=5FMSG=5FTEMPLATE=20?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=96=B7=E8=A1=8C=E8=83=BD=E5=8A=9B=20(#224)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- book_maker/translator/chatgptapi_translator.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/book_maker/translator/chatgptapi_translator.py b/book_maker/translator/chatgptapi_translator.py index 476614e..19f3456 100644 --- a/book_maker/translator/chatgptapi_translator.py +++ b/book_maker/translator/chatgptapi_translator.py @@ -50,8 +50,10 @@ class ChatGPTAPI(Base): openai.api_key = next(self.keys) def create_chat_completion(self, text): - content = self.prompt_template.format(text=text, language=self.language) - sys_content = self.system_content or self.prompt_sys_msg + content = self.prompt_template.format( + text=text, language=self.language, crlf="\n" + ) + sys_content = self.system_content or self.prompt_sys_msg.format(crlf="\n") messages = [ {"role": "system", "content": sys_content}, {"role": "user", "content": content},