Spaces:
Running
Running
茂道
commited on
Commit
·
6021581
1
Parent(s):
539b420
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="4676000" />
|
74 |
</task>
|
75 |
<servers />
|
76 |
</component>
|
werewolf/wolf/prompt.py
CHANGED
@@ -28,7 +28,7 @@ VOTE_PROMPT = """{history}
|
|
28 |
"""
|
29 |
|
30 |
WOLF_SPEECH_PROMPT = """{history}
|
31 |
-
你是{name},现在是狼人之间的交流时间。你可以与你的狼人队友{teammates}
|
32 |
|
33 |
请考虑以下因素:
|
34 |
1. 哪个玩家对狼人阵营威胁最大(如预言家、女巫)
|
|
|
28 |
"""
|
29 |
|
30 |
WOLF_SPEECH_PROMPT = """{history}
|
31 |
+
你是{name},现在是狼人之间的交流时间。你可以与你的狼人队友{teammates}讨论今晚要击杀谁。你只有一次的交流机会,请根据游戏局势做出你的选择。
|
32 |
|
33 |
请考虑以下因素:
|
34 |
1. 哪个玩家对狼人阵营威胁最大(如预言家、女巫)
|
werewolf/wolf/wolf_agent.py
CHANGED
@@ -22,10 +22,6 @@ class WolfAgent(BasicRoleAgent):
|
|
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,6 +86,10 @@ class WolfAgent(BasicRoleAgent):
|
|
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"),
|
|
|
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 |
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"),
|