Fix to LocalAI code for nvim
This commit is contained in:
5
init.lua
5
init.lua
@@ -355,9 +355,6 @@ local function get_visual_selection()
|
|||||||
line_start = line_start - 1
|
line_start = line_start - 1
|
||||||
end
|
end
|
||||||
local line_stop = vim.api.nvim_buf_get_mark(buf, ">")[1]
|
local line_stop = vim.api.nvim_buf_get_mark(buf, ">")[1]
|
||||||
if line_stop > 1 then
|
|
||||||
line_stop = line_stop - 1
|
|
||||||
end
|
|
||||||
local lines = vim.api.nvim_buf_get_lines(buf, line_start, line_stop, true)
|
local lines = vim.api.nvim_buf_get_lines(buf, line_start, line_stop, true)
|
||||||
local result = ""
|
local result = ""
|
||||||
for _, line in pairs(lines) do
|
for _, line in pairs(lines) do
|
||||||
@@ -405,7 +402,7 @@ end
|
|||||||
|
|
||||||
function localai_review(args)
|
function localai_review(args)
|
||||||
local visual_selection = get_visual_selection()
|
local visual_selection = get_visual_selection()
|
||||||
local prompt = "Please review the following code:\n```\n" .. visual_selection .. "\n```\n"
|
local prompt = "Please review the following code:\n```\n" .. visual_selection .. "```"
|
||||||
call_localai("WizardCoder-15B-1.0.ggmlv3.q4_1.bin", prompt, 0.1)
|
call_localai("WizardCoder-15B-1.0.ggmlv3.q4_1.bin", prompt, 0.1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user