refactor(rag): rewrote the starting command (#2874)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
This commit is contained in:
@@ -149,35 +149,32 @@ function M.launch_rag_service(cb)
|
|||||||
|
|
||||||
Utils.debug(string.format("launching %s with nix...", container_name))
|
Utils.debug(string.format("launching %s with nix...", container_name))
|
||||||
|
|
||||||
local cmd = string.format(
|
vim.system({ "sh", "run.sh", service_path }, {
|
||||||
"cd %s && ALLOW_RESET=TRUE PORT=%d DATA_DIR=%s RAG_EMBED_PROVIDER=%s RAG_EMBED_ENDPOINT=%s RAG_EMBED_API_KEY=%s RAG_EMBED_MODEL=%s RAG_EMBED_EXTRA=%s RAG_LLM_PROVIDER=%s RAG_LLM_ENDPOINT=%s RAG_LLM_API_KEY=%s RAG_LLM_MODEL=%s RAG_LLM_EXTRA=%s sh run.sh %s",
|
|
||||||
rag_service_dir,
|
|
||||||
port,
|
|
||||||
service_path,
|
|
||||||
Config.rag_service.embed.provider,
|
|
||||||
Config.rag_service.embed.endpoint,
|
|
||||||
embed_api_key,
|
|
||||||
Config.rag_service.embed.model,
|
|
||||||
embed_extra,
|
|
||||||
Config.rag_service.llm.provider,
|
|
||||||
Config.rag_service.llm.endpoint,
|
|
||||||
llm_api_key,
|
|
||||||
Config.rag_service.llm.model,
|
|
||||||
llm_extra,
|
|
||||||
service_path
|
|
||||||
)
|
|
||||||
|
|
||||||
vim.fn.jobstart(cmd, {
|
|
||||||
detach = true,
|
detach = true,
|
||||||
on_exit = function(_, exit_code)
|
cwd = rag_service_dir,
|
||||||
if exit_code ~= 0 then
|
env = {
|
||||||
Utils.error(string.format("service %s failed to start, exit code: %d", container_name, exit_code))
|
ALLOW_RESET = "TRUE",
|
||||||
else
|
PORT = port,
|
||||||
Utils.debug(string.format("service %s started", container_name))
|
DATA_DIR = service_path,
|
||||||
cb()
|
RAG_EMBED_PROVIDER = Config.rag_service.embed.provider,
|
||||||
end
|
RAG_EMBED_ENDPOINT = Config.rag_service.embed.endpoint,
|
||||||
end,
|
RAG_EMBED_API_KEY = embed_api_key,
|
||||||
})
|
RAG_EMBED_MODEL = Config.rag_service.embed.model,
|
||||||
|
RAG_EMBED_EXTRA = embed_extra,
|
||||||
|
RAG_LLM_PROVIDER = Config.rag_service.llm.provider,
|
||||||
|
RAG_LLM_ENDPOINT = Config.rag_service.llm.endpoint,
|
||||||
|
RAG_LLM_API_KEY = llm_api_key,
|
||||||
|
RAG_LLM_MODEL = Config.rag_service.llm.model,
|
||||||
|
RAG_LLM_EXTRA = llm_extra,
|
||||||
|
},
|
||||||
|
}, function(res)
|
||||||
|
if res.code ~= 0 then
|
||||||
|
Utils.error(string.format("service %s failed to start, exit code: %d", container_name, res.code))
|
||||||
|
else
|
||||||
|
Utils.debug(string.format("service %s started", container_name))
|
||||||
|
cb()
|
||||||
|
end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user