diff --git a/apps/builder/next.config.mjs b/apps/builder/next.config.mjs index 479b45482..6bcc63c63 100644 --- a/apps/builder/next.config.mjs +++ b/apps/builder/next.config.mjs @@ -56,14 +56,12 @@ const nextConfig = { if (nextRuntime === 'edge') { config.resolve.alias['minio'] = false config.resolve.alias['got'] = false - config.resolve.alias['qrcode'] = false return config } // These packages are imports from the integrations definition files that can be ignored for the client. config.resolve.alias['minio'] = false config.resolve.alias['got'] = false config.resolve.alias['openai'] = false - config.resolve.alias['qrcode'] = false return config }, headers: async () => { diff --git a/apps/docs/contribute/the-forge/block.mdx b/apps/docs/contribute/the-forge/block.mdx index 9ab0bbc54..b43bad9d0 100644 --- a/apps/docs/contribute/the-forge/block.mdx +++ b/apps/docs/contribute/the-forge/block.mdx @@ -26,7 +26,7 @@ After using the [CLI](./cli) to create your new block. The `index.ts` file conta name="LightLogo" type="(props: React.SVGProps) => React.JSX.Element" required -> +/> { + console.log('test') const session = await getSession(sessionId) if (!session) { diff --git a/packages/bot-engine/executeGroup.ts b/packages/bot-engine/executeGroup.ts index c5beeb59f..ac9eb1392 100644 --- a/packages/bot-engine/executeGroup.ts +++ b/packages/bot-engine/executeGroup.ts @@ -111,6 +111,7 @@ export const executeGroup = async ( logs, visitedEdges, } + console.log('yes') const executionResponse = ( isLogicBlock(block) ? await executeLogic(newSessionState)(block) diff --git a/packages/bot-engine/executeIntegration.ts b/packages/bot-engine/executeIntegration.ts index 0820e4995..ba28836bf 100644 --- a/packages/bot-engine/executeIntegration.ts +++ b/packages/bot-engine/executeIntegration.ts @@ -16,6 +16,7 @@ import { env } from '@typebot.io/env' export const executeIntegration = (state: SessionState) => async (block: IntegrationBlock): Promise => { + console.log('HI') switch (block.type) { case IntegrationBlockType.GOOGLE_SHEETS: return { diff --git a/packages/bot-engine/forge/executeForgedBlock.ts b/packages/bot-engine/forge/executeForgedBlock.ts index 32e0e01c9..5ee8d13ac 100644 --- a/packages/bot-engine/forge/executeForgedBlock.ts +++ b/packages/bot-engine/forge/executeForgedBlock.ts @@ -27,6 +27,7 @@ export const executeForgedBlock = async ( const blockDef = forgedBlocks[block.type] if (!blockDef) return { outgoingEdgeId: block.outgoingEdgeId } const action = blockDef.actions.find((a) => a.name === block.options.action) + console.log('test', action) const noCredentialsError = { status: 'error', description: 'Credentials not provided for integration', @@ -60,7 +61,9 @@ export const executeForgedBlock = async ( state.isStreamEnabled && !state.whatsApp && // TODO: Enable once chat api is rolling - isPlaneteScale() + isPlaneteScale() && + credentials && + isCredentialsV2(credentials) // !process.env.VERCEL_ENV ) { return { diff --git a/packages/forge/blocks/anthropic/actions/createChatMessage.tsx b/packages/forge/blocks/anthropic/actions/createChatMessage.tsx index 26c366605..ed0e994e2 100644 --- a/packages/forge/blocks/anthropic/actions/createChatMessage.tsx +++ b/packages/forge/blocks/anthropic/actions/createChatMessage.tsx @@ -1,6 +1,5 @@ import { createAction, option } from '@typebot.io/forge' import { auth } from '../auth' -import { Anthropic } from '@anthropic-ai/sdk' import { AnthropicStream } from 'ai' import { anthropicModels, defaultAnthropicOptions } from '../constants' import { parseChatMessages } from '../helpers/parseChatMessages' @@ -104,6 +103,8 @@ export const createChatMessage = createAction({ responseMapping?.map((res) => res.variableId).filter(isDefined) ?? [], run: { server: async ({ credentials: { apiKey }, options, variables, logs }) => { + const { Anthropic } = await import('@anthropic-ai/sdk') + const client = new Anthropic({ apiKey: apiKey, }) @@ -149,6 +150,8 @@ export const createChatMessage = createAction({ (res) => res.item === 'Message Content' || !res.item )?.variableId, run: async ({ credentials: { apiKey }, options, variables }) => { + const { Anthropic } = await import('@anthropic-ai/sdk') + const client = new Anthropic({ apiKey: apiKey, }) diff --git a/packages/forge/blocks/mistral/actions/createChatCompletion.ts b/packages/forge/blocks/mistral/actions/createChatCompletion.ts index ad2fa6a34..f1a59d444 100644 --- a/packages/forge/blocks/mistral/actions/createChatCompletion.ts +++ b/packages/forge/blocks/mistral/actions/createChatCompletion.ts @@ -1,7 +1,6 @@ import { option, createAction } from '@typebot.io/forge' import { isDefined } from '@typebot.io/lib' import { auth } from '../auth' -import MistralClient from '@mistralai/mistralai' import { parseMessages } from '../helpers/parseMessages' import { OpenAIStream } from 'ai' @@ -96,6 +95,7 @@ export const createChatCompletion = createAction({ id: 'fetchModels', dependencies: [], fetch: async ({ credentials }) => { + const MistralClient = (await import('@mistralai/mistralai')).default const client = new MistralClient(credentials.apiKey) const listModelsResponse = await client.listModels() @@ -111,6 +111,7 @@ export const createChatCompletion = createAction({ run: { server: async ({ credentials: { apiKey }, options, variables, logs }) => { if (!options.model) return logs.add('No model selected') + const MistralClient = (await import('@mistralai/mistralai')).default const client = new MistralClient(apiKey) const response = await client.chat({ @@ -131,6 +132,7 @@ export const createChatCompletion = createAction({ )?.variableId, run: async ({ credentials: { apiKey }, options, variables }) => { if (!options.model) return + const MistralClient = (await import('@mistralai/mistralai')).default const client = new MistralClient(apiKey) const response = client.chatStream({ diff --git a/packages/forge/blocks/mistral/package.json b/packages/forge/blocks/mistral/package.json index 1e113824a..a10740354 100644 --- a/packages/forge/blocks/mistral/package.json +++ b/packages/forge/blocks/mistral/package.json @@ -13,7 +13,7 @@ "typescript": "5.3.2" }, "dependencies": { - "@mistralai/mistralai": "0.0.10", + "@mistralai/mistralai": "0.1.3", "ai": "3.0.12" } } diff --git a/packages/forge/blocks/qrcode/actions/generateQrCodeImage.ts b/packages/forge/blocks/qrcode/actions/generateQrCodeImage.ts index f1506fb92..e5396cfc5 100644 --- a/packages/forge/blocks/qrcode/actions/generateQrCodeImage.ts +++ b/packages/forge/blocks/qrcode/actions/generateQrCodeImage.ts @@ -1,5 +1,4 @@ import { createAction, option } from '@typebot.io/forge' -import { toBuffer as generateQrCodeBuffer } from 'qrcode' import { uploadFileToBucket } from '@typebot.io/lib/s3/uploadFileToBucket' import { createId } from '@typebot.io/lib/createId' @@ -29,6 +28,8 @@ export const generateQrCode = createAction({ 'QR code image URL is not specified. Please select a variable to save the generated QR code image.' ) + const generateQrCodeBuffer = (await import('qrcode')).toBuffer + const url = await uploadFileToBucket({ file: await generateQrCodeBuffer(options.data), key: `tmp/qrcodes/${createId() + createId()}.png`, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c0195c2d7..807bc72ca 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1387,8 +1387,8 @@ importers: packages/forge/blocks/mistral: dependencies: '@mistralai/mistralai': - specifier: 0.0.10 - version: 0.0.10 + specifier: 0.1.3 + version: 0.1.3 ai: specifier: 3.0.12 version: 3.0.12(react@18.2.0)(solid-js@1.7.8)(svelte@4.2.12)(vue@3.4.21)(zod@3.22.4) @@ -7461,8 +7461,8 @@ packages: zod-to-json-schema: 3.22.4(zod@3.22.4) dev: true - /@mistralai/mistralai@0.0.10: - resolution: {integrity: sha512-fZOt7A32DcPSff58wTa44pKUBoJBH5toAuzNI9yoM7s5NjTupa1IYcSqqk2LigO8M5EtOEkFsD/XzdyWPnhaRA==} + /@mistralai/mistralai@0.1.3: + resolution: {integrity: sha512-WUHxC2xdeqX9PTXJEqdiNY54vT2ir72WSJrZTTBKRnkfhX6zIfCYA24faRlWjUB5WTpn+wfdGsTMl3ArijlXFA==} dependencies: node-fetch: 2.7.0 transitivePeerDependencies: