Replace character name placeholders in chat context (closes #5007)

This commit is contained in:
oobabooga 2023-12-19 17:31:46 -08:00
parent e83e6cedbe
commit d8279dc710

View File

@ -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):