⚗️ Implement chat API
This commit is contained in:
@ -94,11 +94,11 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
data:
|
||||
'groups' in data
|
||||
? data
|
||||
: (parseNewTypebot({
|
||||
: parseNewTypebot({
|
||||
ownerAvatarUrl: user.image,
|
||||
isBrandingEnabled: workspace.plan === Plan.FREE,
|
||||
...data,
|
||||
}) as Prisma.TypebotUncheckedCreateInput),
|
||||
}),
|
||||
})
|
||||
return res.send(typebot)
|
||||
}
|
||||
|
@ -1,8 +1,15 @@
|
||||
import { createContext } from '@/utils/server/context'
|
||||
import { appRouter } from '@/utils/server/routers/v1/_app'
|
||||
import { captureException } from '@sentry/nextjs'
|
||||
import { createOpenApiNextHandler } from 'trpc-openapi'
|
||||
|
||||
export default createOpenApiNextHandler({
|
||||
router: appRouter,
|
||||
createContext,
|
||||
onError({ error }) {
|
||||
if (error.code === 'INTERNAL_SERVER_ERROR') {
|
||||
captureException(error)
|
||||
console.error('Something went wrong', error)
|
||||
}
|
||||
},
|
||||
})
|
||||
|
Reference in New Issue
Block a user