From d8279dc71083a1b150bde340f95d17b2cb1d6a75 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Tue, 19 Dec 2023 17:31:46 -0800 Subject: [PATCH] Replace character name placeholders in chat context (closes #5007) --- modules/chat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/chat.py b/modules/chat.py index 973a7fbd..8ddb7531 100644 --- a/modules/chat.py +++ b/modules/chat.py @@ -95,7 +95,8 @@ def generate_chat_prompt(user_input, state, **kwargs): else: renderer = chat_renderer if state['context'].strip() != '': - messages.append({"role": "system", "content": state['context']}) + context = replace_character_names(state['context'], state['name1'], state['name2']) + messages.append({"role": "system", "content": context}) insert_pos = len(messages) for user_msg, assistant_msg in reversed(history):