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

Function extract

eval.py:37–73  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

35 return None
36
37def extract(text):
38 ans = {
39 'type': None,
40 'label': None,
41 'param': None
42 }
43
44 match = parse_function_call(text)
45 if match:
46 ans['type'] = match[0]
47 args = match[1]
48
49 if ans['type']:
50 if ans['type'] == 'click':
51 ans['label'] = args[0]
52 elif ans['type'] == 'hover':
53 ans['label'] = args[0]
54 elif ans['type'] == 'select':
55 ans['label'] = args[0]
56 ans['param'] = args[1]
57 elif ans['type'] == 'type_string':
58 ans['label'] = args[0]
59 ans['param'] = args[1]
60 elif ans['type'] == 'scroll_page':
61 ans['param'] = args[0]
62 elif ans['type'] == 'go':
63 ans['param'] = args[0]
64 elif ans['type'] == 'jump_to':
65 ans['param'] = args[0]
66 elif ans['type'] == 'switch_tab':
67 ans['param'] = args[0]
68 elif ans['type'] == 'user_input':
69 ans['param'] = args[0]
70 elif ans['type'] == 'finish':
71 ans['param'] = args[0]
72
73 return ans
74
75if __name__ == '__main__':
76 result_path = sys.argv[1]

Callers 1

eval.pyFile · 0.85

Calls 1

parse_function_callFunction · 0.85

Tested by

no test coverage detected