From 6565fcc29c7a88f0dd6e6c30a7ece7cfe16024c8 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Wed, 12 Jul 2023 12:28:58 +0200 Subject: [PATCH] :bug: (openai) Fix incompatible OpenAI types --- .../openai/createChatCompletionOpenAI.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/viewer/src/features/blocks/integrations/openai/createChatCompletionOpenAI.ts b/apps/viewer/src/features/blocks/integrations/openai/createChatCompletionOpenAI.ts index 4029d3b877..a484bda6d2 100644 --- a/apps/viewer/src/features/blocks/integrations/openai/createChatCompletionOpenAI.ts +++ b/apps/viewer/src/features/blocks/integrations/openai/createChatCompletionOpenAI.ts @@ -4,6 +4,7 @@ import { SessionState } from '@typebot.io/schemas' import { ChatCompletionOpenAIOptions, OpenAICredentials, + chatCompletionMessageRoles, } from '@typebot.io/schemas/features/blocks/integrations/openai' import { isEmpty } from '@typebot.io/lib' import { decrypt, isCredentialsV2 } from '@typebot.io/lib/api/encryption' @@ -61,7 +62,16 @@ export const createChatCompletionOpenAI = async ( newSessionState.isStreamEnabled ) return { - clientSideActions: [{ streamOpenAiChatCompletion: { messages } }], + clientSideActions: [ + { + streamOpenAiChatCompletion: { + messages: messages as { + content?: string + role: (typeof chatCompletionMessageRoles)[number] + }[], + }, + }, + ], outgoingEdgeId, newSessionState, }