WongSaang / chatgpt-ui-server

A ChatGPT UI server based on the Django framework.
https://wongsaang.github.io/chatgpt-ui/
297 stars 161 forks source link

Support for Azure OpenAI #20

Open jannable opened 1 year ago

jannable commented 1 year ago

I've been struggling to get Azure OpenAI supported in a fork so that I could submit a pull request back to main. I feel others would be more proficient and it might be easy, so am expressing the desire to the community.

enzo-arata commented 1 year ago

It should be as simple as adding this line openai.api_type = "azure"

To the following code block in the llm.py file def setup_openai_env(api_base=None, api_key=None): if not openai_env['api_base']: openai_env['api_base'] = api_base if not openai_env['api_key']: openai_env['api_key'] = api_key openai.api_type = "azure" openai.api_key = openai_env['api_key'] openai.api_version = None return (openai_env['api_base'], openai_env['api_key'])

However when I add this and build my own docker image I keep getting the following error when trying to access localhost:9000 pages chatgpt_ui-backend-web-server-1 | 2023/06/26 21:01:24 [error] 27#27: *2 connect() failed (111: Connection refused) while connecting to upstream, client: ---.--.0.1, server: localhost, request: "GET /admin/ HTTP/1.1", upstream: "http://172.25.0.2:8000/admin/", host: "localhost:9000"