diff --git a/backend/internal/auth/codex_api.go b/backend/internal/auth/codex_api.go index 1e29823..16961d2 100644 --- a/backend/internal/auth/codex_api.go +++ b/backend/internal/auth/codex_api.go @@ -492,6 +492,7 @@ func (c *CodexAPIAuth) ObtainAuthorizationCode() (string, error) { verifyHeaders["OpenAI-Sentinel-Token"] = c.getSentinelHeader("password_verify") passwordPayload := map[string]string{ + "username": c.email, "password": c.password, } @@ -500,6 +501,7 @@ func (c *CodexAPIAuth) ObtainAuthorizationCode() (string, error) { c.logError(StepInputPassword, "密码验证失败: %d - %s", resp.StatusCode, string(body[:min(200, len(body))])) return "", fmt.Errorf("密码验证失败: %d", resp.StatusCode) } + c.logStep(StepInputPassword, "密码验证成功") // 解析密码验证响应 json.Unmarshal(body, &data) diff --git a/frontend/src/pages/CodexProxyConfig.tsx b/frontend/src/pages/CodexProxyConfig.tsx index 8f5bed1..c705c48 100644 --- a/frontend/src/pages/CodexProxyConfig.tsx +++ b/frontend/src/pages/CodexProxyConfig.tsx @@ -51,8 +51,10 @@ export default function CodexProxyConfig() { const [batchInput, setBatchInput] = useState('') // 获取代理列表 - const fetchProxies = useCallback(async () => { - setLoading(true) + const fetchProxies = useCallback(async (showLoading = true) => { + if (showLoading) { + setLoading(true) + } try { const res = await fetch('/api/codex-proxy') const data = await res.json() @@ -63,7 +65,9 @@ export default function CodexProxyConfig() { } catch (error) { console.error('获取代理列表失败:', error) } finally { - setLoading(false) + if (showLoading) { + setLoading(false) + } } }, []) @@ -183,8 +187,8 @@ export default function CodexProxyConfig() { if (data.code === 0) { toast.success(`成功添加 ${data.data.added}/${data.data.total} 个代理`) setBatchInput('') - // 批量添加后需要刷新列表获取新的代理ID - fetchProxies() + // 批量添加后需要刷新列表获取新的代理ID(不显示全局加载状态) + fetchProxies(false) } else { toast.error(data.message || '添加失败') } @@ -346,8 +350,8 @@ export default function CodexProxyConfig() { }) } - // 刷新列表获取最新数据 - await fetchProxies() + // 刷新列表获取最新数据(不显示全局加载状态) + await fetchProxies(false) setTestingAll(false) // 使用 toast 提示结果