MCPcopy Create free account
hub / github.com/OpenBMB/AgentCPM-GUI / mapping_actions

Function mapping_actions

eval/run_predict_odyssey.py:254–328  ·  view source on GitHub ↗

This functiokn is used to transform the actions from odyssey agent into micicpm action space. Args: action(str): The action generated from odyssey agent. Returns: Dict: the action in micicpm action space.

(action:str)

Source from the content-addressed store, hash-verified

252
253
254def mapping_actions(action:str) -> dict:
255 """
256 This functiokn is used to transform the actions from odyssey agent into micicpm action space.
257
258 Args:
259 action(str): The action generated from odyssey agent.
260
261 Returns:
262 Dict: the action in micicpm action space.
263 """
264
265 if action.startswith("CLICK"):
266 pattern = r"CLICK: \((\d+),\s*(\d+)\)"
267 match = re.match(pattern, action)
268 x = int(match.group(1))
269 y = int(match.group(2))
270
271 return {
272 "POINT": [x, y],
273 "duration": 200,
274 "STATUS": "continue"
275 }
276
277 elif action.startswith("PRESS"):
278 sub_action = action.split("_")[-1]
279
280 return {
281 "PRESS": sub_action if sub_action != 'RECENT' else 'APPSELECT',
282 "duration": 200,
283 "STATUS": "continue"
284 }
285
286 elif action.startswith("TYPE"):
287 text = action.split(":")[-1].strip()
288
289 return {
290 "TYPE": text,
291 "duration": 200,
292 "STATUS": "continue"
293 }
294
295 elif action == "COMPLETE":
296 return {
297 "STATUS": "finish"
298 }
299
300 elif action == "IMPOSSIBLE":
301 return {
302 "STATUS": "impossible"
303 }
304
305 elif action.startswith("SCROLL"):
306 direction = action.split(":")[-1].strip()
307
308 return {
309 "POINT": [500, 500],
310 "to": direction.lower(),
311 "duration": 200,

Callers 1

run_episodeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected