From 377ecf9e9b86e30dde2919f32816d3ffb62c8ace Mon Sep 17 00:00:00 2001 From: jwj7140 Date: Sun, 2 Jul 2023 20:17:03 +0900 Subject: [PATCH] fix bugs --- examples/server/api_like_OAI.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/server/api_like_OAI.py b/examples/server/api_like_OAI.py index 01e4bf528..6eee550c6 100755 --- a/examples/server/api_like_OAI.py +++ b/examples/server/api_like_OAI.py @@ -37,6 +37,7 @@ def convert_chat(messages): system_n = args.system_name.replace("\\n", "\n") user_n = args.user_name.replace("\\n", "\n") ai_n = args.ai_name.replace("\\n", "\n") + stop = args.stop.replace("\\n", "\n") for line in messages: @@ -45,8 +46,8 @@ def convert_chat(messages): if (line["role"] == "user"): prompt += f"{user_n}{line['content']}" if (line["role"] == "assistant"): - prompt += f"{ai_n}{line['content']}{args.stop}" - prompt += ai_n + prompt += f"{ai_n}{line['content']}{stop}" + prompt += ai_n.rstrip() return prompt