MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / handleBatchUploadCodex2api

Function handleBatchUploadCodex2api

static/js/accounts.js:2130–2159  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2128}
2129
2130async function handleBatchUploadCodex2api() {
2131 const count = getEffectiveCount();
2132 if (count === 0) return;
2133
2134 const choice = await selectCodex2apiService();
2135 if (choice === null) return;
2136
2137 const confirmed = await confirm(`确定要将选中的 ${count} 个账号上传到 Codex2API 吗?`);
2138 if (!confirmed) return;
2139
2140 elements.batchUploadBtn.disabled = true;
2141 elements.batchUploadBtn.textContent = '上传中...';
2142
2143 try {
2144 const payload = buildBatchPayload();
2145 if (choice.service_id != null) payload.service_id = choice.service_id;
2146 const result = await api.post('/accounts/batch-upload-codex2api', payload);
2147
2148 let message = `成功: ${result.success_count}`;
2149 if (result.failed_count > 0) message += `, 失败: ${result.failed_count}`;
2150 if (result.skipped_count > 0) message += `, 跳过: ${result.skipped_count}`;
2151
2152 toast.success(message);
2153 loadAccounts();
2154 } catch (error) {
2155 toast.error('批量上传失败: ' + error.message);
2156 } finally {
2157 updateBatchButtons();
2158 }
2159}
2160
2161async function uploadToCodex2api(id) {
2162 const choice = await selectCodex2apiService();

Callers 1

initEventListenersFunction · 0.85

Calls 9

getEffectiveCountFunction · 0.85
selectCodex2apiServiceFunction · 0.85
confirmFunction · 0.85
buildBatchPayloadFunction · 0.85
successMethod · 0.80
errorMethod · 0.80
loadAccountsFunction · 0.70
updateBatchButtonsFunction · 0.70
postMethod · 0.45

Tested by

no test coverage detected