feat: add useSpeedTestEndpoints hook to collect all endpoint candidates for speed test modal
- Create useSpeedTestEndpoints hook that collects endpoints from: 1. Current baseUrl/codexBaseUrl 2. Initial data URL (edit mode) 3. Preset's endpointCandidates array - Pass speedTestEndpoints to ClaudeFormFields and CodexFormFields - Update EndpointSpeedTest to use collected endpoints instead of just current URL - Fix PackyCode preset endpoints not appearing in speed test modal
This commit is contained in:
@@ -31,6 +31,7 @@ import {
|
||||
useTemplateValues,
|
||||
useCommonConfigSnippet,
|
||||
useCodexCommonConfig,
|
||||
useSpeedTestEndpoints,
|
||||
} from "./hooks";
|
||||
|
||||
const CLAUDE_DEFAULT_CONFIG = JSON.stringify({ env: {}, config: {} }, null, 2);
|
||||
@@ -370,6 +371,16 @@ export function ProviderForm({
|
||||
codexBaseUrl,
|
||||
});
|
||||
|
||||
// 使用端点测速候选 hook
|
||||
const speedTestEndpoints = useSpeedTestEndpoints({
|
||||
appType,
|
||||
selectedPresetId,
|
||||
presetEntries,
|
||||
baseUrl,
|
||||
codexBaseUrl,
|
||||
initialData,
|
||||
});
|
||||
|
||||
const handlePresetChange = (value: string) => {
|
||||
setSelectedPresetId(value);
|
||||
if (value === "custom") {
|
||||
@@ -470,6 +481,7 @@ export function ProviderForm({
|
||||
kimiAnthropicModel={kimiAnthropicModel}
|
||||
kimiAnthropicSmallFastModel={kimiAnthropicSmallFastModel}
|
||||
onKimiModelChange={handleKimiModelChange}
|
||||
speedTestEndpoints={speedTestEndpoints}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -487,6 +499,7 @@ export function ProviderForm({
|
||||
isEndpointModalOpen={isCodexEndpointModalOpen}
|
||||
onEndpointModalToggle={setIsCodexEndpointModalOpen}
|
||||
onCustomEndpointsChange={setDraftCustomEndpoints}
|
||||
speedTestEndpoints={speedTestEndpoints}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user