From fe688cdf2db87d1bb8c50a179604bf068302c053 Mon Sep 17 00:00:00 2001 From: clidxhk <149458901+clidxhk@users.noreply.github.com> Date: Fri, 7 Feb 2025 09:52:08 +0800 Subject: [PATCH] Update utils.ts (#3699) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 本地windows平台开发,加载model列表出现两次盘符导致加载失败,修改代码确保生成的路径不会包含重复的盘符,从而避免 ENOENT 错误。 --- packages/service/core/ai/config/utils.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/service/core/ai/config/utils.ts b/packages/service/core/ai/config/utils.ts index 54cad5c2e..d303bc5b4 100644 --- a/packages/service/core/ai/config/utils.ts +++ b/packages/service/core/ai/config/utils.ts @@ -31,7 +31,10 @@ import { delay } from '@fastgpt/global/common/system/utils'; export const loadSystemModels = async (init = false) => { const getProviderList = () => { const currentFileUrl = new URL(import.meta.url); - const modelsPath = path.join(path.dirname(currentFileUrl.pathname), 'provider'); + const modelsPath = path.join( + path.dirname(currentFileUrl.pathname.replace(/^\/+/, '')), + 'provider' + ); return fs.readdirSync(modelsPath) as string[]; };