diff --git a/lib/openclaw-provider.js b/lib/openclaw-provider.js index a507560..1eaeda2 100644 --- a/lib/openclaw-provider.js +++ b/lib/openclaw-provider.js @@ -31,10 +31,6 @@ function restartGateway() { }); } -function authProfilesPathFromConfig(configFile) { - return path.join(path.dirname(configFile), 'agents', 'main', 'agent', 'auth-profiles.json'); -} - function buildModelsUrl(baseUrl) { let u = String(baseUrl || '').trim().replace(/\/+$/, ''); if (!/\/v1$/.test(u)) u = `${u}/v1`; @@ -105,7 +101,7 @@ function writeJsonFile(filePath, obj) { } /** - * 同步:从 openclaw.json + auth-profiles.json 删除指定 provider(解绑)。 + * 同步:从 openclaw.json 删除指定 provider(解绑)。 * 若 primary 指向该 provider,先置为空串。 */ function removeProviderByName(providerId) { @@ -146,20 +142,6 @@ function removeProviderByName(providerId) { } writeJsonFile(configFile, config); - - const authPath = authProfilesPathFromConfig(configFile); - try { - if (fs.existsSync(authPath)) { - const authProfiles = readJsonFile(authPath); - if (authProfiles.profiles?.[`${providerId}:default`]) { - delete authProfiles.profiles[`${providerId}:default`]; - writeJsonFile(authPath, authProfiles); - } - } - } catch (e) { - log.warn('openclaw-provider', `auth-profiles 更新失败: ${e.message}`); - } - log.info('openclaw-provider', `provider 已移除: ${providerId}`); restartGateway(); } @@ -223,24 +205,6 @@ function addProviderSync(configFile, providerId, baseUrl, apiKey, models, defaul }; writeJsonFile(configFile, config); - - const authPath = authProfilesPathFromConfig(configFile); - try { - let authProfiles = { profiles: {} }; - if (fs.existsSync(authPath)) { - authProfiles = readJsonFile(authPath); - if (!authProfiles.profiles) authProfiles.profiles = {}; - } - authProfiles.profiles[`${providerId}:default`] = { - type: 'api_key', - provider: providerId, - key: apiKey, - }; - writeJsonFile(authPath, authProfiles); - } catch (e) { - log.warn('openclaw-provider', `auth-profiles 写入失败: ${e.message}`); - } - log.info('openclaw-provider', `provider 已写入: ${providerId}(${models.length} 个模型)`); }