diff --git a/src/utils/server/get-headers.ts b/src/utils/server/get-headers.ts index 168a6cb6e3..9df28d1e2e 100644 --- a/src/utils/server/get-headers.ts +++ b/src/utils/server/get-headers.ts @@ -9,14 +9,17 @@ export const getApiHeaders = ({ }): Record => { const headers: Record = { 'Content-Type': 'application/json', - 'Api-Key': process.env.OPENAI_API_KEY, }; if (chatId) { headers['X-CONVERSATION-ID'] = chatId; } + if (jwt) { headers['authorization'] = 'Bearer ' + jwt; + } else { + headers['Api-Key'] = process.env.OPENAI_API_KEY; } + if (jobTitle) { headers['X-JOB-TITLE'] = jobTitle; }