(message: str)
| 15 | player_context = await get_client_context(env_vals) |
| 16 | |
| 17 | async def request_handler(message: str): |
| 18 | result = await translator.translate(message) |
| 19 | if isinstance(result, Failure): |
| 20 | print(result.message) |
| 21 | else: |
| 22 | result = result.value |
| 23 | print(json.dumps(result, indent=2)) |
| 24 | try: |
| 25 | for action in result["actions"]: |
| 26 | await handle_call(action, player_context) |
| 27 | except Exception as error: |
| 28 | print("An exception occurred: ", error) |
| 29 | |
| 30 | if any(item["actionName"] == "Unknown" for item in result["actions"]): |
| 31 | print("I did not understand the following") |
| 32 | for item in result["actions"]: |
| 33 | if item["actionName"] == "Unknown": |
| 34 | print(item["text"]) |
| 35 | |
| 36 | file_path = sys.argv[1] if len(sys.argv) == 2 else None |
| 37 | await process_requests("🎵> ", file_path, request_handler) |
nothing calls this directly
no test coverage detected
searching dependent graphs…