MCPcopy Create free account
hub / github.com/Gan-Xing/CodexBridge / loadLaunchModelOptions

Function loadLaunchModelOptions

apps/web/components/codex-sessions-shell.tsx:313–347  ·  view source on GitHub ↗
(nextSettings?: {
    model?: string | null;
    reasoningEffort?: string | null;
  })

Source from the content-addressed store, hash-verified

311 }, [modelMenuOpen, permissionsMenuOpen]);
312
313 async function loadLaunchModelOptions(nextSettings?: {
314 model?: string | null;
315 reasoningEffort?: string | null;
316 }) {
317 if (loadingLaunchModelOptions && !nextSettings) {
318 return;
319 }
320 setLoadingLaunchModelOptions(true);
321 try {
322 const searchParams = new URLSearchParams();
323 const nextModel = typeof nextSettings?.model === 'string' ? nextSettings.model : launchModel;
324 const nextEffort = typeof nextSettings?.reasoningEffort === 'string'
325 ? nextSettings.reasoningEffort
326 : launchReasoningEffort;
327 if (nextModel) {
328 searchParams.set('model', nextModel);
329 }
330 if (nextEffort) {
331 searchParams.set('reasoningEffort', nextEffort);
332 }
333 const query = searchParams.toString();
334 const response = await fetch(`/api/codex-launch/model-options${query ? `?${query}` : ''}`, {
335 cache: 'no-store',
336 });
337 const payload = await response.json().catch(() => null) as (ThreadModelOptions & { error?: string }) | null;
338 if (!response.ok || payload?.error) {
339 throw new Error((payload?.error && String(payload.error).trim()) || '模型列表加载失败');
340 }
341 setLaunchModelOptions(payload);
342 } catch (error) {
343 setLaunchError(error instanceof Error ? error.message : '模型列表加载失败');
344 } finally {
345 setLoadingLaunchModelOptions(false);
346 }
347 }
348
349 async function applyLaunchModelUpdate(nextSettings: {
350 model?: string | null;

Callers 2

applyLaunchModelUpdateFunction · 0.85
CodexSessionsEmptyStateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected