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