fix: asynchronously start rag service (#1355)
This commit is contained in:
@@ -68,13 +68,20 @@ function M.launch_rag_service()
|
|||||||
openai_base_url,
|
openai_base_url,
|
||||||
image
|
image
|
||||||
)
|
)
|
||||||
local result_ = vim.fn.system(cmd_)
|
vim.fn.jobstart(cmd_, {
|
||||||
local exit_code = vim.v.shell_error
|
detach = true,
|
||||||
|
on_stderr = function(_, data, _)
|
||||||
|
Utils.error(string.format("container %s failed to start: %s", container_name, data))
|
||||||
|
end,
|
||||||
|
on_exit = function(_, exit_code)
|
||||||
if exit_code ~= 0 then
|
if exit_code ~= 0 then
|
||||||
Utils.error(string.format("failed to start rag service: %s", result_))
|
Utils.error(string.format("container %s failed to start, exit code: %d", container_name, exit_code))
|
||||||
return false
|
else
|
||||||
end
|
|
||||||
Utils.debug(string.format("container %s started", container_name))
|
Utils.debug(string.format("container %s started", container_name))
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
})
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user