🐛 Fix remember user streaming messages
This commit is contained in:
@@ -171,7 +171,10 @@ export const ChatChunk = (props: Props) => {
|
||||
: '100%',
|
||||
}}
|
||||
>
|
||||
<StreamingBubble streamingMessageId={streamingMessageId} />
|
||||
<StreamingBubble
|
||||
streamingMessageId={streamingMessageId}
|
||||
context={props.context}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -73,7 +73,7 @@ type Props = {
|
||||
|
||||
export const ConversationContainer = (props: Props) => {
|
||||
let chatContainer: HTMLDivElement | undefined
|
||||
const [chatChunks, setChatChunks, isRecovered] = persist(
|
||||
const [chatChunks, setChatChunks, isRecovered, setIsRecovered] = persist(
|
||||
createSignal<ChatChunkType[]>([
|
||||
{
|
||||
input: props.initialChatReply.input,
|
||||
@@ -146,6 +146,7 @@ export const ConversationContainer = (props: Props) => {
|
||||
message?: string,
|
||||
attachments?: Answer['attachments']
|
||||
) => {
|
||||
setIsRecovered(false)
|
||||
setHasError(false)
|
||||
const currentInputBlock = [...chatChunks()].pop()?.input
|
||||
if (currentInputBlock?.id && props.onAnswer && message)
|
||||
@@ -274,6 +275,7 @@ export const ConversationContainer = (props: Props) => {
|
||||
const processClientSideActions = async (
|
||||
actions: NonNullable<ContinueChatResponse['clientSideActions']>
|
||||
) => {
|
||||
console.log('YES')
|
||||
if (isRecovered()) return
|
||||
for (const action of actions) {
|
||||
if (
|
||||
|
||||
@@ -3,13 +3,19 @@ import { For, createEffect, createSignal } from 'solid-js'
|
||||
import { marked } from 'marked'
|
||||
import domPurify from 'dompurify'
|
||||
import { isNotEmpty } from '@typebot.io/lib'
|
||||
import { persist } from '@/utils/persist'
|
||||
import { BotContext } from '@/types'
|
||||
|
||||
type Props = {
|
||||
streamingMessageId: string
|
||||
context: BotContext
|
||||
}
|
||||
|
||||
export const StreamingBubble = (props: Props) => {
|
||||
const [content, setContent] = createSignal<string[]>([])
|
||||
const [content, setContent] = persist(createSignal<string[]>([]), {
|
||||
key: `typebot-streaming-message-${props.streamingMessageId}`,
|
||||
storage: props.context.storage,
|
||||
})
|
||||
|
||||
marked.use({
|
||||
renderer: {
|
||||
|
||||
Reference in New Issue
Block a user