mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-14 15:25:17 +02:00
refactor: prompt
This commit is contained in:
parent
b5c149f225
commit
e06aa62ac4
1 changed files with 20 additions and 0 deletions
|
|
@ -27,6 +27,26 @@ class TalkAction(Action):
|
|||
|
||||
@property
|
||||
def prompt(self):
|
||||
prompt = ""
|
||||
if CONFIG.agent_description:
|
||||
prompt = (
|
||||
f"You are {CONFIG.agent_description}. Your responses should align with the role-play agreement, "
|
||||
f"maintaining the character's persona and habits. When faced with unrelated questions, playfully "
|
||||
f"decline to answer without revealing your AI nature to preserve the character's image.\n\n"
|
||||
)
|
||||
prompt += f"Background knowledge:\n{self._knowledge}\n\n" if self._knowledge else ""
|
||||
prompt += f"{self._history_summary}\n\n"
|
||||
if self._history_summary != "":
|
||||
prompt += "According to the historical conversation above, "
|
||||
language = CONFIG.language or DEFAULT_LANGUAGE
|
||||
prompt += (
|
||||
f"Answer the following questions in {language}, and the answers must follow the Markdown format.\n "
|
||||
f"{self._talk}"
|
||||
)
|
||||
return prompt
|
||||
|
||||
@property
|
||||
def prompt_new(self):
|
||||
kvs = {
|
||||
"{role}": CONFIG.agent_description or "",
|
||||
"{history}": self._history_summary or "",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue