From 2e893fd75ecd1e99553d6948b4c0eff5ecea9ad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Humberto=20Yusta=20G=C3=B3mez?= Date: Thu, 19 Dec 2024 23:40:30 +0100 Subject: [PATCH] revert: fixes of prepending system prompt manually Not needed now since with last fixes of at commands it works well always --- python_binding_and_cmdline/refact/chat_client.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/python_binding_and_cmdline/refact/chat_client.py b/python_binding_and_cmdline/refact/chat_client.py index b331a369b..1be3e4693 100644 --- a/python_binding_and_cmdline/refact/chat_client.py +++ b/python_binding_and_cmdline/refact/chat_client.py @@ -117,17 +117,14 @@ def join_messages_and_choices( if len(deterministic_messages) > 0 and deterministic_messages[-1].role == "user": while len(messages) > 0 and messages[-1].role == "user": messages.pop() + messages.extend(deterministic_messages) msg: Optional[Message] - for msg in deterministic_messages: - if msg.role == "system": - messages.insert(0, msg) - else: - messages.append(msg) - if verbose: + if verbose: + for msg in deterministic_messages: print("deterministic", - termcolor.colored(str(msg.role), "yellow"), - str(msg.content), - termcolor.colored(str(msg.finish_reason), "red")) + termcolor.colored(str(msg.role), "yellow"), + str(msg.content), + termcolor.colored(str(msg.finish_reason), "red")) output = [copy.deepcopy(messages) for _ in range(len(choices))] for i, msg in enumerate(choices): if msg is None: