microsoft / UFO

A UI-Focused Agent for Windows OS Interaction.
https://arxiv.org/abs/2402.07939
MIT License
7.84k stars 1.05k forks source link

The variable "self._response" seems not to be a json object. #115

Open pursuingf opened 3 months ago

pursuingf commented 3 months ago

When I tried to deploy the project on my own PC with openai apikey ,I encountered the following problems.

Traceback (most recent call last): File "D:\code\Anaconda3\envs\UFO\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "D:\code\Anaconda3\envs\UFO\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "E:\homework\PHD-00\UFO\ufo__main__.py", line 7, in ufo.main() File "E:\homework\PHD-00\UFO\ufo\ufo.py", line 56, in main clients.run_all() File "E:\homework\PHD-00\UFO\ufo\module\client.py", line 28, in run_all session.run() File "E:\homework\PHD-00\UFO\ufo\module\sessions\session.py", line 103, in run super().run() File "E:\homework\PHD-00\UFO\ufo\module\basic.py", line 355, in run round.run() File "E:\homework\PHD-00\UFO\ufo\module\basic.py", line 104, in run self.agent.handle(self.context) File "E:\homework\PHD-00\UFO\ufo\agents\agent\basic.py", line 224, in handle self.state.handle(self, context) File "E:\homework\PHD-00\UFO\ufo\agents\states\host_agent_state.py", line 132, in handle agent.process(context) File "E:\homework\PHD-00\UFO\ufo\agents\agent\host_agent.py", line 241, in process self.processor.process() File "E:\homework\PHD-00\UFO\ufo\agents\processors\basic.py", line 99, in process self.parse_response() File "E:\homework\PHD-00\UFO\ufo\agents\processors\host_agent_processor.py", line 154, in parse_response
self.host_agent.print_response(self._response_json) File "E:\homework\PHD-00\UFO\ufo\agents\agent\host_agent.py", line 264, in print_response message = list(response_dict.get("Message")) TypeError: 'NoneType' object is not iterable

The error appears to have originated from the variable "self._response" in file "ufo\agents\processors\host_agent_processor.py", line 135. The variable "self._response" is not a json object.

vyokky commented 2 months ago

Hi @pursuingf .Thanks for raising this. For quick fix, please change to code from

message = list(response_dict.get("Message"))

to

message = list(response_dict.get("Message", ""))

We will update it in the future version.