Skip to content

fix(studio): fallback to env variable to detect ai feature#3713

Merged
farnabaz merged 1 commit intomainfrom
fix/studio-ai-key
Feb 5, 2026
Merged

fix(studio): fallback to env variable to detect ai feature#3713
farnabaz merged 1 commit intomainfrom
fix/studio-ai-key

Conversation

@larbish
Copy link
Copy Markdown
Collaborator

@larbish larbish commented Feb 5, 2026

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
content Ready Ready Preview, Comment Feb 5, 2026 4:28pm

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Feb 5, 2026

npm i https://pkg.pr.new/@nuxt/content@3713

commit: 6a6e77e

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

This change modifies the Studio API key initialization in src/utils/studio.ts to support configuration via an environment variable as a fallback mechanism. The updated logic checks for the API key in the existing configuration object first, then falls back to the AI_GATEWAY_API_KEY environment variable if the configuration value is not available. The modification adds an early exit condition if the API key cannot be resolved from either source. The rest of the studio collection resolution and exclusion logic remains unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The description is essentially the PR template with no substantive details provided, but the title and code changes are related to the studio AI feature. Provide meaningful description details explaining the problem solved, why this change is needed, and any relevant context for reviewers.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a fallback to an environment variable for the Studio AI API key detection.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/studio-ai-key

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/utils/studio.ts`:
- Around line 32-35: The code uses logical OR when deriving apiKey which causes
an explicitly configured empty studioAIConfig.apiKey to be overridden by
process.env.AI_GATEWAY_API_KEY; change the assignment for apiKey to use nullish
coalescing so an empty string remains respected (i.e., pick
studioAIConfig.apiKey unless it is null or undefined, otherwise fall back to
process.env.AI_GATEWAY_API_KEY) and leave the existing (!apiKey) return check
as-is; update the expression where apiKey is set (refer to the studioAIConfig
and apiKey variables) accordingly.

@farnabaz farnabaz merged commit 3fc8b7b into main Feb 5, 2026
8 checks passed
@farnabaz farnabaz deleted the fix/studio-ai-key branch February 5, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants