2
0

🐛 (openai) Fix incompatible OpenAI types

This commit is contained in:
Baptiste Arnaud
2023-07-12 12:28:58 +02:00
parent ba3a2b711e
commit 6565fcc29c

View File

@@ -4,6 +4,7 @@ import { SessionState } from '@typebot.io/schemas'
import { import {
ChatCompletionOpenAIOptions, ChatCompletionOpenAIOptions,
OpenAICredentials, OpenAICredentials,
chatCompletionMessageRoles,
} from '@typebot.io/schemas/features/blocks/integrations/openai' } from '@typebot.io/schemas/features/blocks/integrations/openai'
import { isEmpty } from '@typebot.io/lib' import { isEmpty } from '@typebot.io/lib'
import { decrypt, isCredentialsV2 } from '@typebot.io/lib/api/encryption' import { decrypt, isCredentialsV2 } from '@typebot.io/lib/api/encryption'
@@ -61,7 +62,16 @@ export const createChatCompletionOpenAI = async (
newSessionState.isStreamEnabled newSessionState.isStreamEnabled
) )
return { return {
clientSideActions: [{ streamOpenAiChatCompletion: { messages } }], clientSideActions: [
{
streamOpenAiChatCompletion: {
messages: messages as {
content?: string
role: (typeof chatCompletionMessageRoles)[number]
}[],
},
},
],
outgoingEdgeId, outgoingEdgeId,
newSessionState, newSessionState,
} }