Skip to content

Commit ffdf287

Browse files
committed
move azure variables into control flow below
1 parent 8a4551f commit ffdf287

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

plugin/chatgpt.vim

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ def safe_vim_eval(expression):
5151
def create_client():
5252
api_type = safe_vim_eval('g:api_type')
5353
api_key = os.getenv('OPENAI_API_KEY') or safe_vim_eval('g:chat_gpt_key') or safe_vim_eval('g:openai_api_key')
54-
5554
openai_base_url = safe_vim_eval('g:openai_base_url')
56-
azure_endpoint = safe_vim_eval('g:azure_endpoint')
57-
azure_api_version = safe_vim_eval('g:azure_api_version')
58-
azure_deployment = safe_vim_eval('g:azure_deployment')
55+
5956
if api_type == 'azure':
57+
azure_endpoint = safe_vim_eval('g:azure_endpoint')
58+
azure_api_version = safe_vim_eval('g:azure_api_version')
59+
azure_deployment = safe_vim_eval('g:azure_deployment')
6060
assert azure_endpoint and azure_api_version and azure_deployment, "azure_endpoint, azure_api_version and azure_deployment not set property, please check your settings in `vimrc` or `enviroment`."
6161
assert api_key, "api_key not set, please configure your `openai_api_key` in your `vimrc` or `enviroment`"
6262
client = AzureOpenAI(

0 commit comments

Comments
 (0)