From 2ef9b5731445791d7c5f92672accb3d250c14f64 Mon Sep 17 00:00:00 2001 From: BaoGuo <19379443+ba0gu0@users.noreply.github.com> Date: Tue, 6 Aug 2024 16:27:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=9D=E6=AC=A1=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/node/src/modules/utils/conda.ts | 10 +++++++++- apps/node/src/routes/api/bootstrap.ts | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/node/src/modules/utils/conda.ts b/apps/node/src/modules/utils/conda.ts index ddb2bccb..60b054f3 100644 --- a/apps/node/src/modules/utils/conda.ts +++ b/apps/node/src/modules/utils/conda.ts @@ -34,9 +34,17 @@ class Conda { * Init conda env */ updateCondaInfo () { + const defaultCondaEnv: CondaEnvInfo = { + CONDA_ENV_PATH: '', + CONDA_ENV_NAME: '', + PYTHON_PATH: '', + PIP_PATH: '', + CONDA_ENV_SCRIPTS_PATH: '' + }; + // 如果有配置本地自定义的 python 环境,那么就简单设置 PYTHON 和 PIP 就好 this.info = getCondaInfo(); - this.env = getCondaEnv(CONDA_ENV_NAME, this.info!); + this.env = getCondaEnv(CONDA_ENV_NAME, this.info!) || defaultCondaEnv; console.log("env", this.info, this.env); logger.info("update conda info" + JSON.stringify(this.info) + JSON.stringify(this.env)); diff --git a/apps/node/src/routes/api/bootstrap.ts b/apps/node/src/routes/api/bootstrap.ts index 0f8884af..b2c3e861 100644 --- a/apps/node/src/routes/api/bootstrap.ts +++ b/apps/node/src/routes/api/bootstrap.ts @@ -247,9 +247,9 @@ export async function ApiSetupConfig(req: Request, res: Response) { appConfigManager.set(CONFIG_KEYS.appSetupConfig, setupString); - // if (data.pythonPath) { - // conda.updateCondaInfo(); - // } + if (data.pythonPath) { + conda.updateCondaInfo(); + } res.send({ success: true,