@ -12,7 +12,7 @@ import { useEffect, useState } from 'react'
|
|||||||
import { sendRequest } from 'utils'
|
import { sendRequest } from 'utils'
|
||||||
import { PackageIcon } from './icons'
|
import { PackageIcon } from './icons'
|
||||||
|
|
||||||
const intervalDuration = 1000 * 60 // 30 seconds
|
const intervalDuration = 1000 * 60
|
||||||
|
|
||||||
export const NewVersionPopup = () => {
|
export const NewVersionPopup = () => {
|
||||||
const { typebot, save } = useTypebot()
|
const { typebot, save } = useTypebot()
|
||||||
|
@ -68,6 +68,7 @@ export const ChatChunk = (props: Props) => {
|
|||||||
{(message) => (
|
{(message) => (
|
||||||
<HostBubble
|
<HostBubble
|
||||||
message={message}
|
message={message}
|
||||||
|
typingEmulation={props.settings.typingEmulation}
|
||||||
onTransitionEnd={displayNextMessage}
|
onTransitionEnd={displayNextMessage}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -9,6 +9,7 @@ import type {
|
|||||||
EmbedBubbleContent,
|
EmbedBubbleContent,
|
||||||
ImageBubbleContent,
|
ImageBubbleContent,
|
||||||
TextBubbleContent,
|
TextBubbleContent,
|
||||||
|
TypingEmulation,
|
||||||
VideoBubbleContent,
|
VideoBubbleContent,
|
||||||
} from 'models'
|
} from 'models'
|
||||||
import { BubbleBlockType } from 'models/features/blocks/bubbles/enums'
|
import { BubbleBlockType } from 'models/features/blocks/bubbles/enums'
|
||||||
@ -16,6 +17,7 @@ import { Match, Switch } from 'solid-js'
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
message: ChatMessage
|
message: ChatMessage
|
||||||
|
typingEmulation: TypingEmulation
|
||||||
onTransitionEnd: () => void
|
onTransitionEnd: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,6 +31,7 @@ export const HostBubble = (props: Props) => {
|
|||||||
<Match when={props.message.type === BubbleBlockType.TEXT}>
|
<Match when={props.message.type === BubbleBlockType.TEXT}>
|
||||||
<TextBubble
|
<TextBubble
|
||||||
content={props.message.content as Omit<TextBubbleContent, 'richText'>}
|
content={props.message.content as Omit<TextBubbleContent, 'richText'>}
|
||||||
|
typingEmulation={props.typingEmulation}
|
||||||
onTransitionEnd={onTransitionEnd}
|
onTransitionEnd={onTransitionEnd}
|
||||||
/>
|
/>
|
||||||
</Match>
|
</Match>
|
||||||
|
@ -5,8 +5,8 @@ import { computeTypingDuration } from '../utils/computeTypingDuration'
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
content: Pick<TextBubbleContent, 'html' | 'plainText'>
|
content: Pick<TextBubbleContent, 'html' | 'plainText'>
|
||||||
|
typingEmulation: TypingEmulation
|
||||||
onTransitionEnd: () => void
|
onTransitionEnd: () => void
|
||||||
typingEmulation?: TypingEmulation
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const showAnimationDuration = 400
|
export const showAnimationDuration = 400
|
||||||
@ -29,7 +29,10 @@ export const TextBubble = (props: Props) => {
|
|||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
if (!isTyping) return
|
if (!isTyping) return
|
||||||
const typingDuration = computeTypingDuration(
|
const typingDuration =
|
||||||
|
props.typingEmulation?.enabled === false
|
||||||
|
? 0
|
||||||
|
: computeTypingDuration(
|
||||||
props.content.plainText,
|
props.content.plainText,
|
||||||
props.typingEmulation ?? defaultTypingEmulation
|
props.typingEmulation ?? defaultTypingEmulation
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user