Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

refactor: prompt

莘权 马e06aa62ac4dc
diff --git a/metagpt/actions/talk_action.py b/metagpt/actions/talk_action.py
index 2a04fb9c8..526d921f8 100644
--- a/metagpt/actions/talk_action.py
+++ b/metagpt/actions/talk_action.py
@@ -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 "",