🚸 (openai) Improve streaming bubble sequence and visual
This commit is contained in:
@ -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",
|
||||
|
@ -117,7 +117,9 @@ export const ChatChunk = (props: Props) => {
|
||||
<div
|
||||
class="flex flex-col flex-1 gap-2"
|
||||
style={{
|
||||
width: isMobile() ? 'calc(100% - 32px)' : 'calc(100% - 48px)',
|
||||
'max-width': isMobile()
|
||||
? 'calc(100% - 32px)'
|
||||
: 'calc(100% - 48px)',
|
||||
'margin-right': props.theme.chat.guestAvatar?.isEnabled
|
||||
? isMobile()
|
||||
? '32px'
|
||||
|
@ -297,8 +297,9 @@ export const ConversationContainer = (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}
|
||||
|
@ -28,7 +28,7 @@ export const StreamingBubble = (props: Props) => {
|
||||
return (
|
||||
<div class="flex flex-col animate-fade-in">
|
||||
<div class="flex w-full items-center">
|
||||
<div class="flex relative items-start typebot-host-bubble w-full">
|
||||
<div class="flex relative items-start typebot-host-bubble max-w-full">
|
||||
<div
|
||||
class="flex items-center absolute px-4 py-2 bubble-typing "
|
||||
style={{
|
||||
|
@ -39,7 +39,52 @@ export const PlateElement = (props: Props) => (
|
||||
</For>
|
||||
</a>
|
||||
</Match>
|
||||
<Match when={props.element.type !== 'a'}>
|
||||
<Match when={props.element.type === 'ol'}>
|
||||
<ol>
|
||||
<For each={props.element.children as TDescendant[]}>
|
||||
{(child) => (
|
||||
<PlateElement
|
||||
element={child}
|
||||
isUniqueChild={
|
||||
(props.element.children as TDescendant[])?.length === 1
|
||||
}
|
||||
inElement={true}
|
||||
/>
|
||||
)}
|
||||
</For>
|
||||
</ol>
|
||||
</Match>
|
||||
<Match when={props.element.type === 'ul'}>
|
||||
<ul>
|
||||
<For each={props.element.children as TDescendant[]}>
|
||||
{(child) => (
|
||||
<PlateElement
|
||||
element={child}
|
||||
isUniqueChild={
|
||||
(props.element.children as TDescendant[])?.length === 1
|
||||
}
|
||||
inElement={true}
|
||||
/>
|
||||
)}
|
||||
</For>
|
||||
</ul>
|
||||
</Match>
|
||||
<Match when={props.element.type === 'li'}>
|
||||
<li>
|
||||
<For each={props.element.children as TDescendant[]}>
|
||||
{(child) => (
|
||||
<PlateElement
|
||||
element={child}
|
||||
isUniqueChild={
|
||||
(props.element.children as TDescendant[])?.length === 1
|
||||
}
|
||||
inElement={true}
|
||||
/>
|
||||
)}
|
||||
</For>
|
||||
</li>
|
||||
</Match>
|
||||
<Match when={true}>
|
||||
<ElementRoot
|
||||
element={props.element as TElement}
|
||||
inElement={props.inElement ?? false}
|
||||
|
@ -51,10 +51,7 @@ export const executeClientSideAction = async ({
|
||||
const { error, message } = await streamChat(context)(
|
||||
clientSideAction.streamOpenAiChatCompletion.messages,
|
||||
{
|
||||
onMessageStream: clientSideAction.streamOpenAiChatCompletion
|
||||
.displayStream
|
||||
? onMessageStream
|
||||
: undefined,
|
||||
onMessageStream,
|
||||
}
|
||||
)
|
||||
if (error)
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@typebot.io/nextjs",
|
||||
"version": "0.2.3",
|
||||
"version": "0.2.4",
|
||||
"description": "Convenient library to display typebots on your Next.js website",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@typebot.io/react",
|
||||
"version": "0.2.3",
|
||||
"version": "0.2.4",
|
||||
"description": "Convenient library to display typebots on your React app",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
Reference in New Issue
Block a user