MCPcopy Create free account
hub / github.com/Tencent/digitalhuman / player_init

Function player_init

SAGE/simulator_response.py:29–53  ·  view source on GitHub ↗
(id = None)

Source from the content-addressed store, hash-verified

27 return ret
28
29def player_init(id = None):
30 with open(simulator_profile,'r', encoding='utf-8') as datafile:
31 data = []
32 for line in datafile:
33 data.append(json.loads(line))
34
35 role = random.sample(data,1)[0]
36 if id:
37 for rl in data:
38 if rl["id"] == id:
39 role = rl
40 #initialize class player, history will be used to store the content
41 player_data = {
42 "id":role["id"],
43 "emo_point": 40,
44 "emo_state": "Emotion-B",
45 "player": role["player"],
46 "scene": role["scene"],
47 "character": role["main_cha"],
48 # "topic": role["topic"],
49 "task": role["task"],
50 "history": []
51 }
52
53 return player_data
54
55
56def planning_reply(player_data):

Callers 2

test_npc.pyFile · 0.90

Calls 2

appendMethod · 0.80
sampleMethod · 0.80

Tested by

no test coverage detected