import { useTranslation } from "react-i18next";
import EndpointSpeedTest from "./EndpointSpeedTest";
import { ApiKeySection, EndpointField } from "./shared";
import type { ProviderCategory } from "@/types";
interface EndpointCandidate {
url: string;
}
interface CodexFormFieldsProps {
// API Key
codexApiKey: string;
onApiKeyChange: (key: string) => void;
category?: ProviderCategory;
shouldShowApiKeyLink: boolean;
websiteUrl: string;
// Base URL
shouldShowSpeedTest: boolean;
codexBaseUrl: string;
onBaseUrlChange: (url: string) => void;
isEndpointModalOpen: boolean;
onEndpointModalToggle: (open: boolean) => void;
onCustomEndpointsChange: (endpoints: string[]) => void;
// Speed Test Endpoints
speedTestEndpoints: EndpointCandidate[];
}
export function CodexFormFields({
codexApiKey,
onApiKeyChange,
category,
shouldShowApiKeyLink,
websiteUrl,
shouldShowSpeedTest,
codexBaseUrl,
onBaseUrlChange,
isEndpointModalOpen,
onEndpointModalToggle,
onCustomEndpointsChange,
speedTestEndpoints,
}: CodexFormFieldsProps) {
const { t } = useTranslation();
return (
<>
{/* Codex API Key 输入框 */}
{/* Codex Base URL 输入框 */}
{shouldShowSpeedTest && (
onEndpointModalToggle(true)}
/>
)}
{/* 端点测速弹窗 - Codex */}
{shouldShowSpeedTest && isEndpointModalOpen && (
onEndpointModalToggle(false)}
onCustomEndpointsChange={onCustomEndpointsChange}
/>
)}
>
);
}