Skip to content

Conversation

@sam-lippert
Copy link
Contributor

Summary

  • make AI request helper headers configurable via referer and title
  • expose AI_REFERER and AI_TITLE environment variables

Testing

  • pnpm test:unit (fails: ConnectTimeoutError)

@vercel
Copy link

vercel bot commented May 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ai ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 28, 2025 3:06pm

@github-actions
Copy link
Contributor

📦 Next.js Bundle Analysis for do

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@sam-lippert sam-lippert marked this pull request as ready for review May 29, 2025 02:13
Copilot AI review requested due to automatic review settings May 29, 2025 02:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR makes AI request helper headers configurable by allowing dynamic overrides via settings and corresponding environment variables. The changes expose AI_REFERER and AI_TITLE as environment variables and update three AI generation modules accordingly.

  • Made header values configurable via settings and environment variables in generateText, generateObjectArray, and generateObject.
  • Updated .env.example to include new environment variable placeholders.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tasks/ai/generateText.ts Replaces hardcoded header values with dynamic header extraction.
tasks/ai/generateObjectArray.ts Updates header configuration to leverage dynamic settings.
tasks/ai/generateObject.ts Implements similar dynamic header configuration logic.
.env.example Adds AI_REFERER and AI_TITLE for environment configuration.
Comments suppressed due to low confidence (3)

tasks/ai/generateText.ts:40

  • Please add unit tests to verify that the dynamic header logic works correctly when both settings and environment variables are provided or omitted.
const referer = settings?.referer || process.env.AI_REFERER

tasks/ai/generateObjectArray.ts:61

  • Please add tests to ensure that the dynamic header fallback for both referer and title behaves as expected in various configurations.
const referer = settings?.referer || process.env.AI_REFERER

tasks/ai/generateObject.ts:66

  • Consider adding unit tests to validate that the dynamic header values are correctly applied from settings and environment variables in all scenarios.
const referer = settings?.referer || process.env.AI_REFERER

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants