nvda-OpenAI icon indicating copy to clipboard operation
nvda-OpenAI copied to clipboard

Add-on doesn't work in corporate settings

Open Neurrone opened this issue 1 year ago • 5 comments

Hi,

I'm u sing a computer that has a custom root certificate in the root store, that is my suspicion about why the add-on is unable to make any API calls. I get the following logs with debug logging when attempting to send a prompt.

ERROR - unhandled exception (14:05:31.742) - MainThread (14144):
Traceback (most recent call last):
  File "C:\Users\Dickson\AppData\Roaming\nvda\addons\OpenAI\globalPlugins\openai\maindialog.py", line 1088, in OnResult
    if isinstance(event.data, openai._base_client.HttpxBinaryResponseContent):
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'openai._base_client' has no attribute 'HttpxBinaryResponseContent'

There isn't any additional information in the logs.

Neurrone avatar Mar 18 '24 06:03 Neurrone

It also seems to me to have encountered the error after the recent update of dependencies (this week).

Could you please remove the code block if isinstance(event.data, openai._base_client.HttpxBinaryResponseContent): which seems to be no longer valid, and try again? Thanks

AAClause avatar Mar 18 '24 07:03 AAClause

That causes something different to happen now: a dialog box that says "connection error" appears, with no additional information about the actual error in the debug logs.

Neurrone avatar Mar 18 '24 07:03 Neurrone

OK, the fix seems the following: please replace the following line: if isinstance(event.data, openai._base_client.HttpxBinaryResponseContent): With this one: if isinstance(event.data, openai._legacy_response.HttpxBinaryResponseContent):

AAClause avatar Mar 18 '24 07:03 AAClause

The issue I'm encountering is probably https://github.com/nvaccess/nvda/issues/15905

Neurrone avatar Mar 18 '24 07:03 Neurrone

OK, we have two problems at once. ;) Can you make API requests outside NVDA environment by providing proxy settings? See here for example: https://stackoverflow.com/questions/77606417/openai-api-request-with-proxy

AAClause avatar Mar 18 '24 07:03 AAClause