fix: 修复 Codex OAuth 配置文件关联逻辑
This commit is contained in:
parent
47ad305b4e
commit
aa4b8692af
2 changed files with 31 additions and 0 deletions
|
|
@ -29,6 +29,7 @@ export async function scanConfigFiles(currentConfig, providerPoolManager) {
|
||||||
addToUsedPaths(usedPaths, currentConfig.ANTIGRAVITY_OAUTH_CREDS_FILE_PATH);
|
addToUsedPaths(usedPaths, currentConfig.ANTIGRAVITY_OAUTH_CREDS_FILE_PATH);
|
||||||
addToUsedPaths(usedPaths, currentConfig.IFLOW_TOKEN_FILE_PATH);
|
addToUsedPaths(usedPaths, currentConfig.IFLOW_TOKEN_FILE_PATH);
|
||||||
addToUsedPaths(usedPaths, currentConfig.ORCHIDS_CREDS_FILE_PATH);
|
addToUsedPaths(usedPaths, currentConfig.ORCHIDS_CREDS_FILE_PATH);
|
||||||
|
addToUsedPaths(usedPaths, currentConfig.CODEX_OAUTH_CREDS_FILE_PATH);
|
||||||
|
|
||||||
// 使用最新的提供商池数据
|
// 使用最新的提供商池数据
|
||||||
let providerPools = currentConfig.providerPools;
|
let providerPools = currentConfig.providerPools;
|
||||||
|
|
@ -46,6 +47,7 @@ export async function scanConfigFiles(currentConfig, providerPoolManager) {
|
||||||
addToUsedPaths(usedPaths, provider.ANTIGRAVITY_OAUTH_CREDS_FILE_PATH);
|
addToUsedPaths(usedPaths, provider.ANTIGRAVITY_OAUTH_CREDS_FILE_PATH);
|
||||||
addToUsedPaths(usedPaths, provider.IFLOW_TOKEN_FILE_PATH);
|
addToUsedPaths(usedPaths, provider.IFLOW_TOKEN_FILE_PATH);
|
||||||
addToUsedPaths(usedPaths, provider.ORCHIDS_CREDS_FILE_PATH);
|
addToUsedPaths(usedPaths, provider.ORCHIDS_CREDS_FILE_PATH);
|
||||||
|
addToUsedPaths(usedPaths, provider.CODEX_OAUTH_CREDS_FILE_PATH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -227,6 +229,17 @@ function getFileUsageInfo(relativePath, fileName, usedPaths, currentConfig) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (currentConfig.CODEX_OAUTH_CREDS_FILE_PATH &&
|
||||||
|
(pathsEqual(relativePath, currentConfig.CODEX_OAUTH_CREDS_FILE_PATH) ||
|
||||||
|
pathsEqual(relativePath, currentConfig.CODEX_OAUTH_CREDS_FILE_PATH.replace(/\\/g, '/')))) {
|
||||||
|
usageInfo.usageType = 'main_config';
|
||||||
|
usageInfo.usageDetails.push({
|
||||||
|
type: 'Main Config',
|
||||||
|
location: 'Codex OAuth credentials file path',
|
||||||
|
configKey: 'CODEX_OAUTH_CREDS_FILE_PATH'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 检查提供商池中的使用情况
|
// 检查提供商池中的使用情况
|
||||||
if (currentConfig.providerPools) {
|
if (currentConfig.providerPools) {
|
||||||
// 使用 flatMap 将双重循环优化为单层循环 O(n)
|
// 使用 flatMap 将双重循环优化为单层循环 O(n)
|
||||||
|
|
@ -309,6 +322,18 @@ function getFileUsageInfo(relativePath, fileName, usedPaths, currentConfig) {
|
||||||
configKey: 'ORCHIDS_CREDS_FILE_PATH'
|
configKey: 'ORCHIDS_CREDS_FILE_PATH'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (provider.CODEX_OAUTH_CREDS_FILE_PATH &&
|
||||||
|
(pathsEqual(relativePath, provider.CODEX_OAUTH_CREDS_FILE_PATH) ||
|
||||||
|
pathsEqual(relativePath, provider.CODEX_OAUTH_CREDS_FILE_PATH.replace(/\\/g, '/')))) {
|
||||||
|
providerUsages.push({
|
||||||
|
type: 'Provider Pool',
|
||||||
|
location: `Codex OAuth credentials (node ${index + 1})`,
|
||||||
|
providerType: providerType,
|
||||||
|
providerIndex: index,
|
||||||
|
configKey: 'CODEX_OAUTH_CREDS_FILE_PATH'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (providerUsages.length > 0) {
|
if (providerUsages.length > 0) {
|
||||||
usageInfo.usageType = 'provider_pool';
|
usageInfo.usageType = 'provider_pool';
|
||||||
|
|
|
||||||
|
|
@ -849,6 +849,12 @@ function detectProviderFromPath(filePath) {
|
||||||
providerType: 'claude-orchids-oauth',
|
providerType: 'claude-orchids-oauth',
|
||||||
displayName: 'Orchids OAuth',
|
displayName: 'Orchids OAuth',
|
||||||
shortName: 'orchids-oauth'
|
shortName: 'orchids-oauth'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
patterns: ['configs/codex/', '/codex/'],
|
||||||
|
providerType: 'openai-codex-oauth',
|
||||||
|
displayName: 'OpenAI Codex OAuth',
|
||||||
|
shortName: 'codex-oauth'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue