AI env vars

This commit is contained in:
Leon van Zyl
2025-08-13 15:03:27 +02:00
parent 557bbccb7d
commit 6d376f84dc
5 changed files with 28 additions and 7 deletions

View File

@@ -5,7 +5,7 @@ export async function POST(req: Request) {
const { messages }: { messages: UIMessage[] } = await req.json();
const result = streamText({
model: openai("gpt-5-mini"),
model: openai(process.env.OPENAI_MODEL || "gpt-5-mini"),
messages: convertToModelMessages(messages),
});

View File

@@ -59,6 +59,20 @@ The only things to preserve are:
- shadcn/ui components
- Lucide React icons
## AI Model Configuration
**IMPORTANT**: When implementing any AI functionality, always use the \`OPENAI_MODEL\` environment variable for the model name instead of hardcoding it:
\`\`\`typescript
// ✅ Correct - Use environment variable
const model = process.env.OPENAI_MODEL || "gpt-5-mini";
model: openai(model)
// ❌ Incorrect - Don't hardcode model names
model: openai("gpt-5-mini")
\`\`\`
This allows for easy model switching without code changes and ensures consistency across the application.
## Component Development Guidelines
**Always prioritize shadcn/ui components** when building the application: