diff options
author | Michael Coppola <m18coppola@gmail.com> | 2024-01-23 01:51:27 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-23 08:51:27 +0200 |
commit | 125d03a5036a02a983c8e98c2cdc126e061afb8e (patch) | |
tree | eb48893172783e6bf8b05524b2b66981035d9585 /examples | |
parent | 011e8ec577fd135cbc02993d3ea9840c516d6a1c (diff) |
llama.vim : added api key support (#5090)
Co-authored-by: Michael Coppola <info@michaeljcoppola.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/llama.vim | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/llama.vim b/examples/llama.vim index f03fadfb..1b5ad6ba 100644 --- a/examples/llama.vim +++ b/examples/llama.vim @@ -6,7 +6,7 @@ " Similarly, you could add an insert mode keybind with " inoremap <C-B> <Cmd>call llama#doLlamaGen()<CR> " -" g:llama_api_url and g:llama_overrides can be configured in your .vimrc +" g:llama_api_url, g:llama_api_key and g:llama_overrides can be configured in your .vimrc " let g:llama_api_url = "192.168.1.10:8080" " llama_overrides can also be set through buffer/window scopes. For instance " autocmd filetype python let b:llama_overrides = {"temp": 0.2} @@ -82,6 +82,9 @@ func llama#doLlamaGen() endif let l:querydata.prompt = join(l:buflines, "\n") let l:curlcommand = copy(s:curlcommand) + if exists("g:llama_api_key") + call extend(l:curlcommand, ['--header', 'Authorization: Bearer ' .. g:llama_api_key]) + endif let l:curlcommand[2] = json_encode(l:querydata) let b:job = job_start(l:curlcommand, {"callback": function("s:callbackHandler", [l:cbuffer])}) endfunction |