MCPcopy Create free account
hub / github.com/THUDM/AutoWebGLM / solver_240

Function solver_240

webarena/solver/shopping_admin.py:8–69  ·  view source on GitHub ↗
(env, config_file, render_helper, agent, args, intent, field_dict)

Source from the content-addressed store, hash-verified

6)
7
8def solver_240(env, config_file, render_helper, agent, args, intent, field_dict):
9 agent.reset(config_file)
10 trajectory: Trajectory = []
11 obs, info = env.reset(options={"config_file": config_file})
12 state_info: StateInfo = {"observation": obs, "info": info}
13 trajectory.append(state_info)
14
15 meta_data = {"action_history": ["None"]}
16 traces = []
17
18 obs_info = info["observation_metadata"]["text"]
19 dom_tree, nodes_info = obs_info["dom_info"]["dom_tree"], obs_info["obs_nodes_info"]
20
21 print(field_dict)
22 instr_list = [
23 "#Click# 2",
24 "#Click# 4",
25 "#Click# 22",
26 "#Type# 42 218",
27 "#Click# 52",
28 "#Click# 41"
29 ]
30
31 for instr in instr_list:
32 obs_info = state_info["info"]["observation_metadata"]["text"]
33 dom_tree, nodes_info = obs_info["dom_info"]["dom_tree"], obs_info["obs_nodes_info"]
34 target_action = instr
35 res = step_once(env, trajectory, render_helper, traces, state_info, agent, args, intent, meta_data, target_action)
36 if res is None:
37 return traces, trajectory
38 state_info, dom_tree, nodes_info = res
39
40 # while True:
41 # obs_info = state_info["info"]["observation_metadata"]["text"]
42 # dom_tree, nodes_info = obs_info["dom_info"]["dom_tree"], obs_info["obs_nodes_info"]
43 # target_action = input()
44 # if target_action == 'noop':
45 # break
46 # res = step_once(env, trajectory, render_helper, traces, state_info, agent, args, intent, meta_data, target_action)
47 # if res is None:
48 # return traces, trajectory
49 # state_info, dom_tree, nodes_info = res
50
51 instr_list = [
52 # "#Click# 25",
53 "#Scroll_down#",
54 "#Type# 16 556 Pick Street",
55 "#Select# 21 Colorado",
56 "#Type# 23 Denver",
57 "#Type# 25 80203",
58 "#Click# 13",
59 "#Exit#"
60 ]
61
62 for instr in instr_list:
63 obs_info = state_info["info"]["observation_metadata"]["text"]
64 dom_tree, nodes_info = obs_info["dom_info"]["dom_tree"], obs_info["obs_nodes_info"]
65 target_action = instr

Callers

nothing calls this directly

Calls 2

step_onceFunction · 0.85
resetMethod · 0.45

Tested by

no test coverage detected