Skip to content

Commit a62a988

Browse files
fix API key initialization to ensure a default value
1 parent db498be commit a62a988

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/api/ask-ai/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export async function POST(request: NextRequest) {
1717
const { prompt, model, redesignMarkdown, html, apiKey, customModel, baseUrl } = body;
1818

1919
const openai = new OpenAI({
20-
apiKey: apiKey || process.env.OPENAI_API_KEY,
20+
apiKey: apiKey || process.env.OPENAI_API_KEY || "",
2121
baseURL: baseUrl || process.env.OPENAI_BASE_URL,
2222
});
2323

0 commit comments

Comments
 (0)