mirror of
https://github.com/justlovemaki/AIClient-2-API.git
synced 2026-06-16 02:03:36 +08:00
refactor(auth/codex-oauth): 优化Codex令牌批量导入的自动关联逻辑
调整自动关联逻辑的执行时机,从单token导入后改为批量完成后统一调用 为自动关联添加异常捕获,避免失败中断批量导入流程 升级项目版本至3.2.4.1
This commit is contained in:
@@ -813,12 +813,6 @@ export async function batchImportCodexTokensStream(tokens, onProgress = null, sk
|
||||
};
|
||||
results.success++;
|
||||
|
||||
// 自动关联到 Pools
|
||||
await autoLinkProviderConfigs(CONFIG, {
|
||||
onlyCurrentCred: true,
|
||||
credPath: relativePath
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
logger.error(`${CODEX_OAUTH_CONFIG.logPrefix} Token ${i + 1} import failed:`, error.message);
|
||||
|
||||
@@ -844,6 +838,12 @@ export async function batchImportCodexTokensStream(tokens, onProgress = null, sk
|
||||
}
|
||||
|
||||
if (results.success > 0) {
|
||||
try {
|
||||
await autoLinkProviderConfigs(CONFIG);
|
||||
} catch (linkError) {
|
||||
logger.error(`${CODEX_OAUTH_CONFIG.logPrefix} Failed to auto-link imported tokens:`, linkError.message);
|
||||
}
|
||||
|
||||
broadcastEvent('oauth_batch_success', {
|
||||
provider: 'openai-codex-oauth',
|
||||
count: results.success,
|
||||
|
||||
Reference in New Issue
Block a user