diff options
| author | Martin Bielik <mx.bielik@gmail.com> | 2023-03-25 18:50:47 +0100 |
|---|---|---|
| committer | Martin Bielik <mx.bielik@gmail.com> | 2023-03-25 18:52:08 +0100 |
| commit | f49d139ee7622ecb16542c346c6c1341afb10bc7 (patch) | |
| tree | 24a2d00048fd7f0df5f19c395dc8a8d457ce5544 | |
| parent | 894f58a9887ad91cb2567b346907b9388debf0c5 (diff) | |
| download | vim-ai-f49d139ee7622ecb16542c346c6c1341afb10bc7.tar.gz | |
handle connection timeout errors
Diffstat (limited to '')
| -rw-r--r-- | plugin/vim-ai.vim | 6 | ||||
| -rw-r--r-- | py/chat.py | 2 | ||||
| -rw-r--r-- | py/complete.py | 2 |
3 files changed, 7 insertions, 3 deletions
diff --git a/plugin/vim-ai.vim b/plugin/vim-ai.vim index 2befe89..5105abd 100644 --- a/plugin/vim-ai.vim +++ b/plugin/vim-ai.vim @@ -3,7 +3,7 @@ let g:vim_ai_complete_default = { \ "model": "text-davinci-003", \ "max_tokens": 1000, \ "temperature": 0.1, -\ "request_timeout": 10, +\ "request_timeout": 20, \ }, \} let g:vim_ai_edit_default = { @@ -11,7 +11,7 @@ let g:vim_ai_edit_default = { \ "model": "text-davinci-003", \ "max_tokens": 1000, \ "temperature": 0.1, -\ "request_timeout": 10, +\ "request_timeout": 20, \ }, \} let g:vim_ai_chat_default = { @@ -19,7 +19,7 @@ let g:vim_ai_chat_default = { \ "model": "gpt-3.5-turbo", \ "max_tokens": 1000, \ "temperature": 1, -\ "request_timeout": 10, +\ "request_timeout": 20, \ }, \} if !exists('g:vim_ai_complete') @@ -54,3 +54,5 @@ try: vim.command("redraw") except KeyboardInterrupt: vim.command("normal! a Ctrl-C...") +except openai.error.Timeout: + vim.command("normal! a Connection timeout...") diff --git a/py/complete.py b/py/complete.py index f82707a..1f32e3e 100644 --- a/py/complete.py +++ b/py/complete.py @@ -28,3 +28,5 @@ try: vim.command("redraw") except KeyboardInterrupt: vim.command("normal! a Ctrl-C...") +except openai.error.Timeout: + vim.command("normal! a Connection timeout...") |