@@ -36,13 +36,14 @@ import { defaultPictureChoiceOptions } from '@typebot.io/schemas/features/blocks
|
||||
import { defaultFileInputOptions } from '@typebot.io/schemas/features/blocks/inputs/file/constants'
|
||||
import { VisitedEdge } from '@typebot.io/prisma'
|
||||
import { getBlockById } from '@typebot.io/schemas/helpers'
|
||||
import { ForgedBlock, forgedBlocks } from '@typebot.io/forge-schemas'
|
||||
import { enabledBlocks } from '@typebot.io/forge-repository'
|
||||
import { ForgedBlock } from '@typebot.io/forge-repository/types'
|
||||
import { forgedBlocks } from '@typebot.io/forge-repository/definitions'
|
||||
import { resumeChatCompletion } from './blocks/integrations/legacy/openai/resumeChatCompletion'
|
||||
import { env } from '@typebot.io/env'
|
||||
import { downloadMedia } from './whatsapp/downloadMedia'
|
||||
import { uploadFileToBucket } from '@typebot.io/lib/s3/uploadFileToBucket'
|
||||
import { isURL } from '@typebot.io/lib/validators/isURL'
|
||||
import { isForgedBlockType } from '@typebot.io/schemas/features/blocks/forged/helpers'
|
||||
|
||||
type Params = {
|
||||
version: 1 | 2
|
||||
@@ -111,14 +112,12 @@ export const continueBotFlow = async (
|
||||
response: JSON.parse(reply),
|
||||
})
|
||||
if (result.newSessionState) newSessionState = result.newSessionState
|
||||
} else if (
|
||||
enabledBlocks.includes(block.type as (typeof enabledBlocks)[number])
|
||||
) {
|
||||
} else if (isForgedBlockType(block.type)) {
|
||||
if (reply) {
|
||||
const options = (block as ForgedBlock).options
|
||||
const action = forgedBlocks
|
||||
.find((b) => b.id === block.type)
|
||||
?.actions.find((a) => a.name === options?.action)
|
||||
const action = forgedBlocks[block.type].actions.find(
|
||||
(a) => a.name === options?.action
|
||||
)
|
||||
if (action) {
|
||||
if (action.run?.stream?.getStreamVariableId) {
|
||||
firstBubbleWasStreamed = true
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { VariableStore, LogsStore } from '@typebot.io/forge'
|
||||
import { ForgedBlock, forgedBlocks } from '@typebot.io/forge-schemas'
|
||||
import { forgedBlocks } from '@typebot.io/forge-repository/definitions'
|
||||
import { ForgedBlock } from '@typebot.io/forge-repository/types'
|
||||
import { decrypt } from '@typebot.io/lib/api/encryption/decrypt'
|
||||
import { isPlaneteScale } from '@typebot.io/lib/isPlanetScale'
|
||||
import prisma from '@typebot.io/lib/prisma'
|
||||
@@ -23,7 +24,7 @@ export const executeForgedBlock = async (
|
||||
state: SessionState,
|
||||
block: ForgedBlock
|
||||
): Promise<ExecuteIntegrationResponse> => {
|
||||
const blockDef = forgedBlocks.find((b) => b.id === block.type)
|
||||
const blockDef = forgedBlocks[block.type]
|
||||
if (!blockDef) return { outgoingEdgeId: block.outgoingEdgeId }
|
||||
const action = blockDef.actions.find((a) => a.name === block.options.action)
|
||||
const noCredentialsError = {
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
"devDependencies": {
|
||||
"@typebot.io/forge": "workspace:*",
|
||||
"@typebot.io/forge-repository": "workspace:*",
|
||||
"@typebot.io/forge-schemas": "workspace:*",
|
||||
"@types/nodemailer": "6.4.8",
|
||||
"@types/qs": "6.9.7"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user