diff --git a/packages/bot-engine/blocks/integrations/openai/createChatCompletionOpenAI.ts b/packages/bot-engine/blocks/integrations/openai/createChatCompletionOpenAI.ts index 10a0913e5d..e7b92d3e7f 100644 --- a/packages/bot-engine/blocks/integrations/openai/createChatCompletionOpenAI.ts +++ b/packages/bot-engine/blocks/integrations/openai/createChatCompletionOpenAI.ts @@ -72,19 +72,23 @@ export const createChatCompletionOpenAI = async ( options.advancedSettings?.temperature ) + const assistantMessageVariableName = typebot.variables.find( + (variable) => + options.responseMapping.find( + (m) => m.valueToExtract === 'Message content' + )?.variableId === variable.id + )?.name + if ( isPlaneteScale() && isCredentialsV2(credentials) && newSessionState.isStreamEnabled && - !newSessionState.whatsApp + !newSessionState.whatsApp && + isNextBubbleMessageWithAssistantMessage(typebot)( + blockId, + assistantMessageVariableName + ) ) { - const assistantMessageVariableName = typebot.variables.find( - (variable) => - options.responseMapping.find( - (m) => m.valueToExtract === 'Message content' - )?.variableId === variable.id - )?.name - return { clientSideActions: [ { @@ -93,10 +97,6 @@ export const createChatCompletionOpenAI = async ( content?: string role: (typeof chatCompletionMessageRoles)[number] }[], - displayStream: isNextBubbleMessageWithAssistantMessage(typebot)( - blockId, - assistantMessageVariableName - ), }, expectsDedicatedReply: true, }, diff --git a/packages/embeds/js/package.json b/packages/embeds/js/package.json index d52409618b..2165a0c057 100644 --- a/packages/embeds/js/package.json +++ b/packages/embeds/js/package.json @@ -1,6 +1,6 @@ { "name": "@typebot.io/js", - "version": "0.2.3", + "version": "0.2.4", "description": "Javascript library to display typebots on your website", "type": "module", "main": "dist/index.js", diff --git a/packages/embeds/js/src/components/ConversationContainer/ChatChunk.tsx b/packages/embeds/js/src/components/ConversationContainer/ChatChunk.tsx index 93942f314c..1715fdbe38 100644 --- a/packages/embeds/js/src/components/ConversationContainer/ChatChunk.tsx +++ b/packages/embeds/js/src/components/ConversationContainer/ChatChunk.tsx @@ -117,7 +117,9 @@ export const ChatChunk = (props: Props) => {
{ context={props.context} hideAvatar={ !chatChunk.input && - !chatChunk.streamingMessageId && - index() < chatChunks().length - 1 + ((chatChunks()[index() + 1]?.messages ?? 0).length > 0 || + chatChunks()[index() + 1]?.streamingMessageId !== undefined || + isSending()) } hasError={hasError() && index() === chatChunks().length - 1} onNewBubbleDisplayed={handleNewBubbleDisplayed} diff --git a/packages/embeds/js/src/components/bubbles/StreamingBubble.tsx b/packages/embeds/js/src/components/bubbles/StreamingBubble.tsx index 878252e3c8..7bba13b0da 100644 --- a/packages/embeds/js/src/components/bubbles/StreamingBubble.tsx +++ b/packages/embeds/js/src/components/bubbles/StreamingBubble.tsx @@ -28,7 +28,7 @@ export const StreamingBubble = (props: Props) => { return (
-
+
( - + +
    + + {(child) => ( + + )} + +
+
+ +
    + + {(child) => ( + + )} + +
+
+ +
  • + + {(child) => ( + + )} + +
  • +
    +