Spaces:
Sleeping
Sleeping
茂道 commited on
Commit ·
98c3c3c
1
Parent(s): 6021581
update prompt
Browse files- .idea/workspace.xml +1 -1
- werewolf/wolf/prompt.py +1 -1
- werewolf/wolf/wolf_agent.py +4 -4
.idea/workspace.xml
CHANGED
|
@@ -70,7 +70,7 @@
|
|
| 70 |
<option name="number" value="Default" />
|
| 71 |
<option name="presentableId" value="Default" />
|
| 72 |
<updated>1745132074997</updated>
|
| 73 |
-
<workItem from="1745132078229" duration="
|
| 74 |
</task>
|
| 75 |
<servers />
|
| 76 |
</component>
|
|
|
|
| 70 |
<option name="number" value="Default" />
|
| 71 |
<option name="presentableId" value="Default" />
|
| 72 |
<updated>1745132074997</updated>
|
| 73 |
+
<workItem from="1745132078229" duration="5725000" />
|
| 74 |
</task>
|
| 75 |
<servers />
|
| 76 |
</component>
|
werewolf/wolf/prompt.py
CHANGED
|
@@ -50,5 +50,5 @@ KILL_PROMPT = """{history}
|
|
| 50 |
4. 考虑游戏的整体战略,选择最有利于狼人获胜的目标
|
| 51 |
|
| 52 |
从以下玩家中选择你要击杀的人:{choices}
|
| 53 |
-
请直接返回你要击杀的玩家名字:
|
| 54 |
"""
|
|
|
|
| 50 |
4. 考虑游戏的整体战略,选择最有利于狼人获胜的目标
|
| 51 |
|
| 52 |
从以下玩家中选择你要击杀的人:{choices}
|
| 53 |
+
请直接返回你要击杀的玩家名字,不需要添加任何分析:
|
| 54 |
"""
|
werewolf/wolf/wolf_agent.py
CHANGED
|
@@ -22,6 +22,10 @@ class WolfAgent(BasicRoleAgent):
|
|
| 22 |
self.memory.set_variable("teammates", []) # 重置队友信息
|
| 23 |
self.memory.append_history("主持人:大家好,我们正在玩狼人杀游戏,6人局,包括预言家、女巫、猎人、平民和狼人")
|
| 24 |
self.memory.append_history("主持人:你好,你分配到的角色是[狼人]")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
elif req.status == STATUS_NIGHT:
|
| 26 |
self.memory.append_history("主持人:现在进入夜晚,天黑请闭眼")
|
| 27 |
elif req.status == STATUS_WOLF_SPEECH:
|
|
@@ -86,10 +90,6 @@ class WolfAgent(BasicRoleAgent):
|
|
| 86 |
return AgentResp(success=True, result=result, errMsg=None)
|
| 87 |
|
| 88 |
elif req.status == STATUS_WOLF_SPEECH:
|
| 89 |
-
if req.message: # 如果有队友信息
|
| 90 |
-
teammates = req.message.split(",")
|
| 91 |
-
self.memory.set_variable("teammates", teammates)
|
| 92 |
-
self.memory.append_history(f"主持人:你的狼人队友是: {req.message}")
|
| 93 |
teammates = self.memory.load_variable("teammates")
|
| 94 |
prompt = format_prompt(WOLF_SPEECH_PROMPT, {
|
| 95 |
"name": self.memory.load_variable("name"),
|
|
|
|
| 22 |
self.memory.set_variable("teammates", []) # 重置队友信息
|
| 23 |
self.memory.append_history("主持人:大家好,我们正在玩狼人杀游戏,6人局,包括预言家、女巫、猎人、平民和狼人")
|
| 24 |
self.memory.append_history("主持人:你好,你分配到的角色是[狼人]")
|
| 25 |
+
if req.message: # 如果有队友信息
|
| 26 |
+
teammates = req.message.split(",")
|
| 27 |
+
self.memory.set_variable("teammates", teammates)
|
| 28 |
+
self.memory.append_history(f"主持人:你的狼人队友是: {req.message}")
|
| 29 |
elif req.status == STATUS_NIGHT:
|
| 30 |
self.memory.append_history("主持人:现在进入夜晚,天黑请闭眼")
|
| 31 |
elif req.status == STATUS_WOLF_SPEECH:
|
|
|
|
| 90 |
return AgentResp(success=True, result=result, errMsg=None)
|
| 91 |
|
| 92 |
elif req.status == STATUS_WOLF_SPEECH:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
teammates = self.memory.load_variable("teammates")
|
| 94 |
prompt = format_prompt(WOLF_SPEECH_PROMPT, {
|
| 95 |
"name": self.memory.load_variable("name"),
|