@@ -11,12 +11,13 @@
|
||||
"test:report": "pnpm playwright show-report"
|
||||
},
|
||||
"dependencies": {
|
||||
"@lilyrose2798/trpc-openapi": "^1.3.9",
|
||||
"@planetscale/database": "1.8.0",
|
||||
"@sentry/nextjs": "7.77.0",
|
||||
"@trpc/server": "10.40.0",
|
||||
"@typebot.io/bot-engine": "workspace:*",
|
||||
"@typebot.io/nextjs": "workspace:*",
|
||||
"@typebot.io/js": "workspace:*",
|
||||
"@typebot.io/nextjs": "workspace:*",
|
||||
"@typebot.io/prisma": "workspace:*",
|
||||
"ai": "2.2.24",
|
||||
"bot-engine": "workspace:*",
|
||||
@@ -30,8 +31,7 @@
|
||||
"qs": "6.11.2",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"stripe": "12.13.0",
|
||||
"trpc-openapi": "1.2.0"
|
||||
"stripe": "12.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@faire/mjml-react": "3.3.0",
|
||||
@@ -39,13 +39,13 @@
|
||||
"@playwright/test": "1.36.0",
|
||||
"@typebot.io/emails": "workspace:*",
|
||||
"@typebot.io/env": "workspace:*",
|
||||
"@typebot.io/forge": "workspace:*",
|
||||
"@typebot.io/forge-repository": "workspace:*",
|
||||
"@typebot.io/forge-schemas": "workspace:*",
|
||||
"@typebot.io/lib": "workspace:*",
|
||||
"@typebot.io/schemas": "workspace:*",
|
||||
"@typebot.io/tsconfig": "workspace:*",
|
||||
"@typebot.io/forge-schemas": "workspace:*",
|
||||
"@typebot.io/forge": "workspace:*",
|
||||
"@typebot.io/variables": "workspace:*",
|
||||
"@typebot.io/forge-repository": "workspace:*",
|
||||
"@types/cors": "2.8.13",
|
||||
"@types/node": "20.4.2",
|
||||
"@types/nodemailer": "6.4.8",
|
||||
|
||||
@@ -19,9 +19,9 @@ export const ErrorPage = ({ error }: { error: Error }) => {
|
||||
NEXT_PUBLIC_VIEWER_URL is missing
|
||||
</h1>
|
||||
<h2>
|
||||
Make sure to configure the viewer properly (
|
||||
<a href="https://docs.typebot.io/self-hosting/configuration#viewer">
|
||||
https://docs.typebot.io/self-hosting/configuration#viewer
|
||||
Make sure to configure the app properly (
|
||||
<a href="https://docs.typebot.io/self-hosting/configuration">
|
||||
https://docs.typebot.io/self-hosting/configuration
|
||||
</a>
|
||||
)
|
||||
</h2>
|
||||
|
||||
@@ -14,14 +14,16 @@ export const continueChat = publicProcedure
|
||||
method: 'POST',
|
||||
path: '/v1/sessions/{sessionId}/continueChat',
|
||||
summary: 'Continue chat',
|
||||
description:
|
||||
'To initiate a chat, do not provide a `sessionId` nor a `message`.\n\nContinue the conversation by providing the `sessionId` and the `message` that should answer the previous question.\n\nSet the `isPreview` option to `true` to chat with the non-published version of the typebot.',
|
||||
},
|
||||
})
|
||||
.input(
|
||||
z.object({
|
||||
message: z.string().optional(),
|
||||
sessionId: z.string(),
|
||||
sessionId: z
|
||||
.string()
|
||||
.describe(
|
||||
'The session ID you got from the [startChat](./start-chat) response.'
|
||||
),
|
||||
})
|
||||
)
|
||||
.output(continueChatResponseSchema)
|
||||
|
||||
@@ -67,7 +67,7 @@ export const sendMessageV1 = publicProcedure
|
||||
? {
|
||||
type: 'preview',
|
||||
isOnlyRegistering: startParams.isOnlyRegistering ?? false,
|
||||
isStreamEnabled: startParams.isStreamEnabled,
|
||||
isStreamEnabled: startParams.isStreamEnabled ?? false,
|
||||
startFrom:
|
||||
'startGroupId' in startParams && startParams.startGroupId
|
||||
? {
|
||||
@@ -95,7 +95,7 @@ export const sendMessageV1 = publicProcedure
|
||||
: {
|
||||
type: 'live',
|
||||
isOnlyRegistering: startParams.isOnlyRegistering ?? false,
|
||||
isStreamEnabled: startParams.isStreamEnabled,
|
||||
isStreamEnabled: startParams.isStreamEnabled ?? false,
|
||||
publicId: startParams.typebot,
|
||||
prefilledVariables: startParams.prefilledVariables,
|
||||
resultId: startParams.resultId,
|
||||
|
||||
@@ -67,7 +67,7 @@ export const sendMessageV2 = publicProcedure
|
||||
? {
|
||||
type: 'preview',
|
||||
isOnlyRegistering: startParams.isOnlyRegistering ?? false,
|
||||
isStreamEnabled: startParams.isStreamEnabled,
|
||||
isStreamEnabled: startParams.isStreamEnabled ?? false,
|
||||
startFrom:
|
||||
'startGroupId' in startParams && startParams.startGroupId
|
||||
? {
|
||||
@@ -95,7 +95,7 @@ export const sendMessageV2 = publicProcedure
|
||||
: {
|
||||
type: 'live',
|
||||
isOnlyRegistering: startParams.isOnlyRegistering ?? false,
|
||||
isStreamEnabled: startParams.isStreamEnabled,
|
||||
isStreamEnabled: startParams.isStreamEnabled ?? false,
|
||||
publicId: startParams.typebot,
|
||||
prefilledVariables: startParams.prefilledVariables,
|
||||
resultId: startParams.resultId,
|
||||
|
||||
@@ -12,7 +12,7 @@ export const saveClientLogs = publicProcedure
|
||||
openapi: {
|
||||
method: 'POST',
|
||||
path: '/v1/sessions/{sessionId}/clientLogs',
|
||||
summary: 'Save client logs',
|
||||
summary: 'Save logs',
|
||||
},
|
||||
})
|
||||
.input(
|
||||
|
||||
@@ -74,7 +74,7 @@ export const startChat = publicProcedure
|
||||
},
|
||||
messages,
|
||||
input,
|
||||
resultId,
|
||||
resultId: resultId as string,
|
||||
dynamicTheme,
|
||||
logs,
|
||||
clientSideActions,
|
||||
|
||||
@@ -13,6 +13,8 @@ export const startChatPreview = publicProcedure
|
||||
method: 'POST',
|
||||
path: '/v1/typebots/{typebotId}/preview/startChat',
|
||||
summary: 'Start preview chat',
|
||||
description:
|
||||
'Use this endpoint to test your bot. The answers will not be saved. And some blocks like "Send email" will be skipped.',
|
||||
},
|
||||
})
|
||||
.input(startPreviewChatInputSchema)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { generateOpenApiDocument } from 'trpc-openapi'
|
||||
import { generateOpenApiDocument } from '@lilyrose2798/trpc-openapi'
|
||||
import { writeFileSync } from 'fs'
|
||||
import { appRouter } from './appRouter'
|
||||
|
||||
@@ -6,10 +6,7 @@ const openApiDocument = generateOpenApiDocument(appRouter, {
|
||||
title: 'Chat API',
|
||||
version: '3.0.0',
|
||||
baseUrl: 'https://typebot.io/api',
|
||||
docsUrl: 'https://docs.typebot.io/api',
|
||||
docsUrl: 'https://docs.typebot.io/api-reference',
|
||||
})
|
||||
|
||||
writeFileSync(
|
||||
'./openapi/chat/_spec_.json',
|
||||
JSON.stringify(openApiDocument, null, 2)
|
||||
)
|
||||
writeFileSync('./openapi/viewer.json', JSON.stringify(openApiDocument, null, 2))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { initTRPC } from '@trpc/server'
|
||||
import { OpenApiMeta } from 'trpc-openapi'
|
||||
import { OpenApiMeta } from '@lilyrose2798/trpc-openapi'
|
||||
import superjson from 'superjson'
|
||||
import { Context } from './context'
|
||||
import * as Sentry from '@sentry/nextjs'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { appRouter } from '@/helpers/server/appRouter'
|
||||
import * as Sentry from '@sentry/nextjs'
|
||||
import { createOpenApiNextHandler } from 'trpc-openapi'
|
||||
import { createOpenApiNextHandler } from '@lilyrose2798/trpc-openapi'
|
||||
import cors from 'nextjs-cors'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { createContext } from '@/helpers/server/context'
|
||||
|
||||
@@ -300,6 +300,8 @@ test('API chat execution should work on published bot', async ({ request }) => {
|
||||
{
|
||||
data: {
|
||||
message: 'Hey',
|
||||
isStreamEnabled: false,
|
||||
isOnlyRegistering: false,
|
||||
} satisfies Omit<StartChatInput, 'publicId'>,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
import { generateOpenApiDocument } from 'trpc-openapi'
|
||||
import { writeFileSync } from 'fs'
|
||||
import { appRouter } from '@/helpers/server/appRouter'
|
||||
|
||||
const openApiDocument = generateOpenApiDocument(appRouter, {
|
||||
title: 'Chat API',
|
||||
version: '3.0.0',
|
||||
baseUrl: 'https://typebot.io/api',
|
||||
docsUrl: 'https://docs.typebot.io/api',
|
||||
})
|
||||
|
||||
writeFileSync(
|
||||
'./openapi/chat/_spec_.json',
|
||||
JSON.stringify(openApiDocument, null, 2)
|
||||
)
|
||||
Reference in New Issue
Block a user