⚡ (openai) Stream chat completion to avoid serverless timeout (#526)
Closes #520
This commit is contained in:
@@ -28,7 +28,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const data = (
|
||||
typeof req.body === 'string' ? JSON.parse(req.body) : req.body
|
||||
) as Credentials
|
||||
const { encryptedData, iv } = encrypt(data.data)
|
||||
const { encryptedData, iv } = await encrypt(data.data)
|
||||
const workspace = await prisma.workspace.findFirst({
|
||||
where: { id: workspaceId, members: { some: { userId: user.id } } },
|
||||
select: { id: true },
|
||||
|
||||
@@ -37,7 +37,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
return res
|
||||
.status(400)
|
||||
.send({ message: "User didn't accepted required scopes" })
|
||||
const { encryptedData, iv } = encrypt(tokens)
|
||||
const { encryptedData, iv } = await encrypt(tokens)
|
||||
const credentials = {
|
||||
name: email,
|
||||
type: 'google sheets',
|
||||
|
||||
Reference in New Issue
Block a user