href="?__debugger__=yes&cmd=resource&f=console.png">
AttributeError
AttributeError: 'str' object has no attribute 'choices'
Traceback (most recent call last)
File "C:\Users\rcssa\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py",
line 1488,
in __call__
return self.wsgi_app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rcssa\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py",
line 1466,
in wsgi_app
response = self.handle_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rcssa\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py",
line 1463,
in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rcssa\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py",
line 872,
in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rcssa\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py",
line 870,
in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rcssa\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py",
line 855,
in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rcssa\chatbot\app.py",
line 65,
in chat
texto_resposta = resposta.choices[0].message.content
^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'choices'
This is the Copy/Paste friendly version of the traceback.
Traceback (most recent call last):<br> File "C:\Users\rcssa\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 1488, in __call__<br> return self.wsgi_app(environ, start_response)<br> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br> File "C:\Users\rcssa\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 1466, in wsgi_app<br> response = self.handle_exception(e)<br> ^^^^^^^^^^^^^^^^^^^^^^^^<br> File "C:\Users\rcssa\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 1463, in wsgi_app<br> response = self.full_dispatch_request()<br> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br> File "C:\Users\rcssa\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 872, in full_dispatch_request<br> rv = self.handle_user_exception(e)<br> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br> File "C:\Users\rcssa\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 870, in full_dispatch_request<br> rv = self.dispatch_request()<br> ^^^^^^^^^^^^^^^^^^^^^^^<br> File "C:\Users\rcssa\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask\app.py", line 855, in dispatch_request<br> return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]<br> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br> File "C:\Users\rcssa\chatbot\app.py", line 65, in chat<br> texto_resposta = resposta.choices[0].message.content<br> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br>AttributeError: 'str' object has no attribute 'choices'<br>
The debugger caught an exception in your WSGI application. You can now
look at the traceback which led to the error.
If you enable JavaScript you can also use additional features such as code
execution (if the evalex feature is enabled), automatic pasting of the
exceptions and much more.