File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ export async function POST(req) {
2121 if ( ! process . env . OPENAI_API_KEY ) {
2222 return NextResponse . json (
2323 { message : 'API not available during build' } ,
24- { status : 503 } ,
24+ { status : 503 }
2525 ) ;
2626 }
2727
@@ -41,7 +41,7 @@ export async function POST(req) {
4141 content : `Current resume state: ${ JSON . stringify (
4242 currentResume ,
4343 null ,
44- 2 ,
44+ 2
4545 ) } `,
4646 } ,
4747 ...messages . map ( ( msg ) => ( {
@@ -178,7 +178,7 @@ export async function POST(req) {
178178 if ( toolCall . function . name === 'update_resume' ) {
179179 try {
180180 const { changes, explanation } = JSON . parse (
181- toolCall . function . arguments ,
181+ toolCall . function . arguments
182182 ) ;
183183 return NextResponse . json ( {
184184 message : explanation ,
Original file line number Diff line number Diff line change @@ -3,11 +3,18 @@ import { writeFile } from 'fs/promises';
33import { join } from 'path' ;
44import fs from 'fs' ;
55
6- const openai = new OpenAI ( {
7- apiKey : process . env . OPENAI_API_KEY ,
8- } ) ;
9-
106export async function POST ( req ) {
7+ if ( ! process . env . OPENAI_API_KEY ) {
8+ return NextResponse . json (
9+ { message : 'API not available during build' } ,
10+ { status : 503 }
11+ ) ;
12+ }
13+
14+ const openai = new OpenAI ( {
15+ apiKey : process . env . OPENAI_API_KEY ,
16+ } ) ;
17+
1118 try {
1219 const formData = await req . formData ( ) ;
1320 const audioFile = formData . get ( 'audio' ) ;
You can’t perform that action at this time.
0 commit comments