Skip to content

Commit

Permalink
Export openai_endpoint from openai.ts
Browse files Browse the repository at this point in the history
Part of #646.
  • Loading branch information
jkomoros committed Oct 28, 2023
1 parent 254b21e commit 3f38a04
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions functions/src/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const openai_api_key = openaiConfig ? (openaiConfig.api_key || '') : '';
const configuration = new Configuration({
apiKey: openai_api_key,
});
const openai = new OpenAIApi(configuration);
export const openai_endpoint = new OpenAIApi(configuration);

//The server-side analogue of selectUserMayUseAI
const mayUseAI = (permissions : UserPermissions | null) => {
Expand Down Expand Up @@ -75,7 +75,7 @@ export const handler = async (data : OpenAIData, context : functions.https.Calla
}

try {
const result = await openai[data.endpoint](data.payload as any);
const result = await openai_endpoint[data.endpoint](data.payload as any);
return result.data;
} catch(err) {
if (!err || typeof err != 'object') throw new functions.https.HttpsError('unknown', String(err));
Expand Down

0 comments on commit 3f38a04

Please sign in to comment.