From 541d53ec676fdc554dfa49433e63a81f8ae2794f Mon Sep 17 00:00:00 2001 From: horek Date: Mon, 6 May 2024 11:30:54 +0200 Subject: [PATCH] fix: comment code in route for build purpose --- webapp-next/pages/api/chat.ts | 56 +++++++++++++++++------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/webapp-next/pages/api/chat.ts b/webapp-next/pages/api/chat.ts index 362b6af..16a784a 100644 --- a/webapp-next/pages/api/chat.ts +++ b/webapp-next/pages/api/chat.ts @@ -1,33 +1,33 @@ -import { Configuration, OpenAIApi } from 'openai'; -import type { NextApiRequest, NextApiResponse } from 'next'; +// import { Configuration, OpenAIApi } from 'openai'; +// import type { NextApiRequest, NextApiResponse } from 'next'; -const configuration = new Configuration({ - apiKey: process.env.OPENAI_API_KEY -}); +// const configuration = new Configuration({ +// apiKey: process.env.OPENAI_API_KEY +// }); -const openai = new OpenAIApi(configuration); +// const openai = new OpenAIApi(configuration); -type DataResponse = { - text: string; -}; +// type DataResponse = { +// text: string; +// }; -export default async function handler( - req: NextApiRequest, - res: NextApiResponse -) { - if (req.method === 'POST') { - const prompt = req.body.text; - const response = await openai.createCompletion({ - model: 'text-davinci-003', - prompt: prompt, - max_tokens: 60 - }); +// export default async function handler( +// req: NextApiRequest, +// res: NextApiResponse +// ) { +// if (req.method === 'POST') { +// const prompt = req.body.text; +// const response = await openai.createCompletion({ +// model: 'text-davinci-003', +// prompt: prompt, +// max_tokens: 60 +// }); - res - .status(200) - .json({ text: (response.data.choices[0].text || '').trim() }); - } else { - res.setHeader('Allow', 'POST'); - res.status(405).end('Method Not Allowed'); - } -} +// res +// .status(200) +// .json({ text: (response.data.choices[0].text || '').trim() }); +// } else { +// res.setHeader('Allow', 'POST'); +// res.status(405).end('Method Not Allowed'); +// } +// }