From 6ebe0f1778dbc3dc940efacfdc68c851175a3e15 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 12 May 2026 07:15:45 +0000 Subject: [PATCH] feat: add support for Grok 4.3 model - Added Grok 4.3 to the model selection form in settings. - Updated `getModel` utility to handle Grok 4.3 selection, mapping it to `grok-latest`. - Updated Grok 4.2 badge to "Stable" and Grok 4.3 to "New". - Maintained support for both Grok 4.2 and Grok 4.3 based on user toggle. Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com> --- .../settings/components/model-selection-form.tsx | 14 +++++++++++--- lib/utils/index.ts | 16 ++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/components/settings/components/model-selection-form.tsx b/components/settings/components/model-selection-form.tsx index bc6164ba..edfbddc6 100644 --- a/components/settings/components/model-selection-form.tsx +++ b/components/settings/components/model-selection-form.tsx @@ -35,13 +35,21 @@ const models = [ badgeVariant: "default" as const, }, { - id: "Grok 4.2", - name: "Grok 4.2", - description: "The latest from xAI, pushing the boundaries of reasoning and problem-solving.", + id: "Grok 4.3", + name: "Grok 4.3", + description: "The latest from xAI, featuring enhanced reasoning and real-time knowledge.", icon: Rocket, badge: "New", badgeVariant: "secondary" as const, }, + { + id: "Grok 4.2", + name: "Grok 4.2", + description: "Reliable reasoning model from xAI, pushing the boundaries of problem-solving.", + icon: Rocket, + badge: "Stable", + badgeVariant: "outline" as const, + }, { id: "Gemini 3.1 Pro", name: "Gemini 3.1 Pro", diff --git a/lib/utils/index.ts b/lib/utils/index.ts index 15565281..ac48c8f1 100644 --- a/lib/utils/index.ts +++ b/lib/utils/index.ts @@ -34,6 +34,22 @@ export async function getModel(requireVision: boolean = false) { if (selectedModel) { switch (selectedModel) { + case 'Grok 4.3': + if (xaiApiKey) { + const xai = createXai({ + apiKey: xaiApiKey, + baseURL: 'https://api.x.ai/v1', + }); + try { + return xai('grok-latest'); + } catch (error) { + console.error('Selected model "Grok 4.3" is configured but failed to initialize.', error); + throw new Error('Failed to initialize selected model.'); + } + } else { + console.error('User selected "Grok 4.3" but XAI_API_KEY is not set.'); + throw new Error('Selected model is not configured.'); + } case 'Grok 4.2': if (xaiApiKey) { const xai = createXai({