🐛 Fix streaming text selection (#1444)
This commit is contained in:
@@ -13,7 +13,6 @@ import { decrypt } from '@typebot.io/lib/api/encryption/decrypt'
|
||||
import { resumeChatCompletion } from './resumeChatCompletion'
|
||||
import { parseChatCompletionMessages } from './parseChatCompletionMessages'
|
||||
import { executeChatCompletionOpenAIRequest } from './executeChatCompletionOpenAIRequest'
|
||||
import { isPlaneteScale } from '@typebot.io/lib/isPlanetScale'
|
||||
import prisma from '@typebot.io/lib/prisma'
|
||||
import { ExecuteIntegrationResponse } from '../../../../types'
|
||||
import { parseVariableNumber } from '@typebot.io/variables/parseVariableNumber'
|
||||
@@ -23,6 +22,7 @@ import {
|
||||
defaultOpenAIOptions,
|
||||
} from '@typebot.io/schemas/features/blocks/integrations/openai/constants'
|
||||
import { BubbleBlockType } from '@typebot.io/schemas/features/blocks/bubbles/constants'
|
||||
import { isPlaneteScale } from '@typebot.io/lib/isPlanetScale'
|
||||
|
||||
export const createChatCompletionOpenAI = async (
|
||||
state: SessionState,
|
||||
@@ -90,7 +90,8 @@ export const createChatCompletionOpenAI = async (
|
||||
blockId,
|
||||
assistantMessageVariableName
|
||||
) &&
|
||||
!process.env.VERCEL_ENV
|
||||
(!process.env.VERCEL_ENV ||
|
||||
(isPlaneteScale() && credentials && isCredentialsV2(credentials)))
|
||||
) {
|
||||
return {
|
||||
clientSideActions: [
|
||||
@@ -101,6 +102,7 @@ export const createChatCompletionOpenAI = async (
|
||||
content?: string
|
||||
role: (typeof chatCompletionMessageRoles)[number]
|
||||
}[],
|
||||
runtime: process.env.VERCEL_ENV ? 'edge' : 'nodejs',
|
||||
},
|
||||
expectsDedicatedReply: true,
|
||||
},
|
||||
|
||||
@@ -59,11 +59,8 @@ export const executeForgedBlock = async (
|
||||
) &&
|
||||
state.isStreamEnabled &&
|
||||
!state.whatsApp &&
|
||||
// TODO: Enable once chat api is rolling
|
||||
isPlaneteScale() &&
|
||||
credentials &&
|
||||
isCredentialsV2(credentials)
|
||||
// !process.env.VERCEL_ENV
|
||||
(!process.env.VERCEL_ENV ||
|
||||
(isPlaneteScale() && credentials && isCredentialsV2(credentials)))
|
||||
) {
|
||||
return {
|
||||
outgoingEdgeId: block.outgoingEdgeId,
|
||||
@@ -72,6 +69,7 @@ export const executeForgedBlock = async (
|
||||
type: 'stream',
|
||||
expectsDedicatedReply: true,
|
||||
stream: true,
|
||||
runtime: process.env.VERCEL_ENV ? 'edge' : 'nodejs',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user