Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/utils/status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,9 @@ export function buildAPIProviderProperties(): Property[] {
bedrock: 'AWS Bedrock',
vertex: 'Google Vertex AI',
foundry: 'Microsoft Foundry',
gemini: 'Gemini API'
gemini: 'Gemini API',
grok: 'Grok API',
openai: 'OpenAI API',
}[apiProvider]
properties.push({
label: 'API provider',
Expand Down Expand Up @@ -430,6 +432,18 @@ export function buildAPIProviderProperties(): Property[] {
label: 'Gemini base URL',
value: geminiBaseUrl,
})
} else if (apiProvider === 'grok') {
const grokBaseUrl = process.env.GROK_BASE_URL
properties.push({
label: 'Grok base URL',
value: grokBaseUrl,
})
} else if (apiProvider === 'openai') {
const openaiBaseUrl = process.env.OPENAI_BASE_URL
properties.push({
label: 'OpenAI base URL',
value: openaiBaseUrl,
})
Comment on lines +435 to +446
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Inconsistent base URL handling compared to existing patterns.

Two issues with the new provider branches:

  1. Grok (lines 436-440): The Grok client defaults to https://api.x.ai/v1 when GROK_BASE_URL is unset. The status display should show this default (like Gemini does on line 430) rather than undefined.

  2. OpenAI (lines 442-446): Unlike Grok, OpenAI has no explicit default in the codebase. The property should only be shown when the env var is set (like Bedrock, Vertex, and Foundry patterns).

♻️ Proposed fix for consistent behavior
   } else if (apiProvider === 'grok') {
-    const grokBaseUrl = process.env.GROK_BASE_URL
+    const grokBaseUrl = process.env.GROK_BASE_URL || 'https://api.x.ai/v1'
     properties.push({
       label: 'Grok base URL',
       value: grokBaseUrl,
     })
   } else if (apiProvider === 'openai') {
     const openaiBaseUrl = process.env.OPENAI_BASE_URL
-    properties.push({
-      label: 'OpenAI base URL',
-      value: openaiBaseUrl,
-    })
+    if (openaiBaseUrl) {
+      properties.push({
+        label: 'OpenAI base URL',
+        value: openaiBaseUrl,
+      })
+    }
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/utils/status.tsx` around lines 435 - 446, Update the Grok and OpenAI
branches in the status construction: for the Grok branch use the GROK_BASE_URL
env var but fall back to the actual client default ("https://api.x.ai/v1") when
process.env.GROK_BASE_URL is falsy so the properties.push entry for grokBaseUrl
never shows undefined, and for the OpenAI branch only add the properties.push
for openaiBaseUrl when process.env.OPENAI_BASE_URL is set (omit it when
undefined) so OpenAI follows the same conditional pattern as
Bedrock/Vertex/Foundry; refer to the grokBaseUrl and openaiBaseUrl variables and
the properties.push calls to locate and update the logic.

}

const proxyUrl = getProxyUrl()
Expand Down
Loading