mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-25 13:58:46 +01:00
llama.vim : added api key support (#5090)
Co-authored-by: Michael Coppola <info@michaeljcoppola.com>
This commit is contained in:
parent
011e8ec577
commit
125d03a503
@ -6,7 +6,7 @@
|
|||||||
" Similarly, you could add an insert mode keybind with
|
" Similarly, you could add an insert mode keybind with
|
||||||
" inoremap <C-B> <Cmd>call llama#doLlamaGen()<CR>
|
" 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"
|
" let g:llama_api_url = "192.168.1.10:8080"
|
||||||
" llama_overrides can also be set through buffer/window scopes. For instance
|
" llama_overrides can also be set through buffer/window scopes. For instance
|
||||||
" autocmd filetype python let b:llama_overrides = {"temp": 0.2}
|
" autocmd filetype python let b:llama_overrides = {"temp": 0.2}
|
||||||
@ -82,6 +82,9 @@ func llama#doLlamaGen()
|
|||||||
endif
|
endif
|
||||||
let l:querydata.prompt = join(l:buflines, "\n")
|
let l:querydata.prompt = join(l:buflines, "\n")
|
||||||
let l:curlcommand = copy(s:curlcommand)
|
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 l:curlcommand[2] = json_encode(l:querydata)
|
||||||
let b:job = job_start(l:curlcommand, {"callback": function("s:callbackHandler", [l:cbuffer])})
|
let b:job = job_start(l:curlcommand, {"callback": function("s:callbackHandler", [l:cbuffer])})
|
||||||
endfunction
|
endfunction
|
||||||
|
Loading…
Reference in New Issue
Block a user