From 8137b66a46ca178e0b5bf84d59d10dfcb04bc92f Mon Sep 17 00:00:00 2001 From: claude-code-best Date: Fri, 10 Apr 2026 22:04:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=88=9D=E6=AC=A1?= =?UTF-8?q?=E7=99=BB=E9=99=86=E7=9A=84=E6=A0=A1=E9=AA=8C=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Onboarding.tsx | 7 +-- src/utils/preflightChecks.tsx | 96 ++--------------------------------- 2 files changed, 9 insertions(+), 94 deletions(-) diff --git a/src/components/Onboarding.tsx b/src/components/Onboarding.tsx index 51dc04306..8391cf886 100644 --- a/src/components/Onboarding.tsx +++ b/src/components/Onboarding.tsx @@ -148,9 +148,10 @@ export function Onboarding({ onDone }: Props): React.ReactNode { } const steps: OnboardingStep[] = [] - if (oauthEnabled) { - steps.push({ id: 'preflight', component: preflightStep }) - } + // Preflight check disabled — users may use third-party API providers + // if (oauthEnabled) { + // steps.push({ id: 'preflight', component: preflightStep }) + // } steps.push({ id: 'theme', component: themeStep }) if (apiKeyNeedingApproval) { diff --git a/src/utils/preflightChecks.tsx b/src/utils/preflightChecks.tsx index fed5b1236..82093703d 100644 --- a/src/utils/preflightChecks.tsx +++ b/src/utils/preflightChecks.tsx @@ -1,13 +1,7 @@ -import axios from 'axios' import React, { useEffect, useState } from 'react' -import { logEvent } from 'src/services/analytics/index.js' -import { Spinner } from '../components/Spinner.js' -import { getOauthConfig } from '../constants/oauth.js' import { useTimeout } from '../hooks/useTimeout.js' import { Box, Text } from '@anthropic/ink' -import { getSSLErrorHint } from '../services/api/errorUtils.js' -import { getUserAgent } from './http.js' -import { logError } from './log.js' +import { Spinner } from '../components/Spinner.js' export interface PreflightCheckResult { success: boolean @@ -16,66 +10,9 @@ export interface PreflightCheckResult { } async function checkEndpoints(): Promise { - try { - const oauthConfig = getOauthConfig() - const tokenUrl = new URL(oauthConfig.TOKEN_URL) - const endpoints = [ - `${oauthConfig.BASE_API_URL}/api/hello`, - `${tokenUrl.origin}/v1/oauth/hello`, - ] - - const checkEndpoint = async ( - url: string, - ): Promise => { - try { - const response = await axios.get(url, { - headers: { 'User-Agent': getUserAgent() }, - }) - if (response.status !== 200) { - const hostname = new URL(url).hostname - return { - success: false, - error: `Failed to connect to ${hostname}: Status ${response.status}`, - } - } - return { success: true } - } catch (error) { - const hostname = new URL(url).hostname - const sslHint = getSSLErrorHint(error) - return { - success: false, - error: `Failed to connect to ${hostname}: ${error instanceof Error ? (error as ErrnoException).code || error.message : String(error)}`, - sslHint: sslHint ?? undefined, - } - } - } - - const results = await Promise.all(endpoints.map(checkEndpoint)) - const failedResult = results.find(result => !result.success) - - if (failedResult) { - // Log failure to Statsig - logEvent('tengu_preflight_check_failed', { - isConnectivityError: false, - hasErrorMessage: !!failedResult.error, - isSSLError: !!failedResult.sslHint, - }) - } - - return failedResult || { success: true } - } catch (error) { - logError(error as Error) - - // Log to Statsig - logEvent('tengu_preflight_check_failed', { - isConnectivityError: true, - }) - - return { - success: false, - error: `Connectivity check error: ${error instanceof Error ? (error as ErrnoException).code || error.message : String(error)}`, - } - } + // Skip connectivity check — users may use third-party API providers + // (OpenAI, Gemini, Grok, etc.) or be behind restricted networks. + return { success: true } } interface PreflightStepProps { @@ -104,10 +41,8 @@ export function PreflightStep({ useEffect(() => { if (result?.success) { onSuccess() - } else if (result && !result.success) { - const timer = setTimeout(() => process.exit(1), 100) - return () => clearTimeout(timer) } + // Failure branch removed — preflight check always succeeds }, [result, onSuccess]) return ( @@ -123,27 +58,6 @@ export function PreflightStep({ Unable to connect to Anthropic services {result?.error} - {result?.sslHint ? ( - - {result.sslHint} - - See https://code.claude.com/docs/en/network-config - - - ) : ( - - - Please check your internet connection and network settings. - - - Note: Claude Code might not be available in your country. - Check supported countries at{' '} - - https://anthropic.com/supported-countries - - - - )} ) )}