替 BBM_CHATGPTAPI_SYS_MSG 與 BBM_CHATGPTAPI_USER_MSG_TEMPLATE 加入斷行能力 (#224)

This commit is contained in:
Will 保哥 2023-04-02 17:09:22 +08:00 committed by GitHub
parent ffb76baa21
commit cc9e816c57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,8 +50,10 @@ class ChatGPTAPI(Base):
openai.api_key = next(self.keys) openai.api_key = next(self.keys)
def create_chat_completion(self, text): def create_chat_completion(self, text):
content = self.prompt_template.format(text=text, language=self.language) content = self.prompt_template.format(
sys_content = self.system_content or self.prompt_sys_msg text=text, language=self.language, crlf="\n"
)
sys_content = self.system_content or self.prompt_sys_msg.format(crlf="\n")
messages = [ messages = [
{"role": "system", "content": sys_content}, {"role": "system", "content": sys_content},
{"role": "user", "content": content}, {"role": "user", "content": content},