messiasads commited on
Commit
60064c6
·
1 Parent(s): 11afaf3

fix API key initialization to ensure a default value

Browse files
Files changed (1) hide show
  1. app/api/ask-ai/route.ts +1 -1
app/api/ask-ai/route.ts CHANGED
@@ -17,7 +17,7 @@ export async function POST(request: NextRequest) {
17
  const { prompt, model, redesignMarkdown, html, apiKey, customModel, baseUrl } = body;
18
 
19
  const openai = new OpenAI({
20
- apiKey: apiKey || process.env.OPENAI_API_KEY,
21
  baseURL: baseUrl || process.env.OPENAI_BASE_URL,
22
  });
23
 
 
17
  const { prompt, model, redesignMarkdown, html, apiKey, customModel, baseUrl } = body;
18
 
19
  const openai = new OpenAI({
20
+ apiKey: apiKey || process.env.OPENAI_API_KEY || "",
21
  baseURL: baseUrl || process.env.OPENAI_BASE_URL,
22
  });
23