You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,15 @@ pip install openai
36
36
```
37
37
[Detailed Direction For Installation](https://github.com/CoderCookE/vim-chatgpt/issues/4#issuecomment-1704607737)
38
38
39
+
Additionally, for Azure gpt user:
40
+
```
41
+
let g:api_type = 'azure'
42
+
let g:chat_gpt_key = 'your_azure_chatgpt_api'
43
+
let g:azure_endpoint = 'your_azure_endpoint'
44
+
let g:azure_deployment = 'your_azure_deployment'
45
+
let g:azure_api_version = '2023-03-15-preview'
46
+
```
47
+
39
48
## Customization
40
49
In your `.vimrc` file you set the following options
41
50
@@ -46,6 +55,7 @@ let g:chat_gpt_session_mode=0
46
55
let g:chat_gpt_temperature = 0.7
47
56
let g:chat_gpt_lang = 'Chinese'
48
57
let g:chat_gpt_split_direction = 'vertical'
58
+
let g:split_ratio=4
49
59
```
50
60
51
61
- g:chat_gpt_max_tokens: This option allows you to set the maximum number of tokens (words or characters) that the ChatGPT API will return in its response. By default, it is set to 2000 tokens. You can adjust this value based on your needs and preferences.
@@ -55,6 +65,7 @@ let g:chat_gpt_split_direction = 'vertical'
55
65
- g:chat_gpt_lang: Answer in certain langusage, such as Chinese,
56
66
- g:chat_gpt_split_direction: Controls how to open splits, 'vertical' or 'horizontal'. Plugin opens horizontal splits by default.
57
67
By customizing these options, you can tailor the ChatGPT Vim Plugin to better suit your specific needs and preferences.
68
+
- g:split_ratio: Control the split window size. If set 4, the window size will be 1/4.
Copy file name to clipboardExpand all lines: plugin/chatgpt.vim
+61-33Lines changed: 61 additions & 33 deletions
Original file line number
Diff line number
Diff line change
@@ -6,28 +6,6 @@ if !has('python3')
6
6
finish
7
7
endif
8
8
9
-
" Add ChatGPT dependencies
10
-
python3 << EOF
11
-
import sys
12
-
importvim
13
-
import os
14
-
15
-
try:
16
-
import openai
17
-
except ImportError:
18
-
print("Error: openai module not found. Please install with Pip and ensure equality of the versions given by :!python3 -V, and :python3 import sys; print(sys.version)")
" Set default values for Vim variables if they don't exist
32
10
if!exists("g:chat_gpt_max_tokens")
33
11
letg:chat_gpt_max_tokens=2000
@@ -48,6 +26,56 @@ endif
48
26
if!exists("g:chat_gpt_split_direction")
49
27
letg:chat_gpt_split_direction='horizontal'
50
28
endif
29
+
if!exists("g:split_ratio")
30
+
letg:split_ratio=3
31
+
endif
32
+
33
+
" Add ChatGPT dependencies
34
+
python3 << EOF
35
+
import sys
36
+
importvim
37
+
import os
38
+
39
+
try:
40
+
from openai import AzureOpenAI, OpenAI
41
+
except ImportError:
42
+
print("Error: openai module not found. Please install with Pip and ensure equality of the versions given by :!python3 -V, and :python3 import sys; print(sys.version)")
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`."
61
+
assert api_key, "api_key not set, please configure your `openai_api_key` in your `vimrc` or `enviroment`"
0 commit comments