Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -82,18 +82,17 @@ def format_prompt(state, bot_index, character_name, character_description, user_
|
|
82 |
user_name = "You"
|
83 |
|
84 |
prompt = f"The following is a conversation between {user_name} and {character_name}.\n\n"
|
85 |
-
prompt += f"{character_name}'s background:\n{character_description}\n\n"
|
86 |
|
87 |
# Get the last num_messages messages from the conversation history
|
88 |
recent_messages = state["history"][bot_index][-num_messages:]
|
89 |
|
90 |
for message in recent_messages:
|
91 |
if message['role'] == 'user':
|
92 |
-
prompt += f"
|
93 |
else:
|
94 |
-
prompt += f"
|
95 |
|
96 |
-
prompt += f"
|
97 |
return prompt
|
98 |
import aiohttp
|
99 |
import asyncio
|
|
|
82 |
user_name = "You"
|
83 |
|
84 |
prompt = f"The following is a conversation between {user_name} and {character_name}.\n\n"
|
|
|
85 |
|
86 |
# Get the last num_messages messages from the conversation history
|
87 |
recent_messages = state["history"][bot_index][-num_messages:]
|
88 |
|
89 |
for message in recent_messages:
|
90 |
if message['role'] == 'user':
|
91 |
+
prompt += f"<|im_start|>user {message['content']}<|im_end|>\n"
|
92 |
else:
|
93 |
+
prompt += f"<|im_start|>assistant {message['content']}<|im_end|>\n"
|
94 |
|
95 |
+
prompt += f"<|im_start|>assistant"
|
96 |
return prompt
|
97 |
import aiohttp
|
98 |
import asyncio
|