🐛 (web) Dynamic first host avatar not displaying in viewer

This commit is contained in:
Baptiste Arnaud
2024-01-18 11:13:45 +01:00
parent d6f94d37d8
commit 98107ee636
6 changed files with 32 additions and 27 deletions

View File

@@ -86,31 +86,30 @@ export const ConversationContainer = (props: Props) => {
onMount(() => {
;(async () => {
const initialChunk = chatChunks()[0]
if (initialChunk.clientSideActions) {
const actionsBeforeFirstBubble = initialChunk.clientSideActions.filter(
(action) => isNotDefined(action.lastBubbleBlockId)
if (!initialChunk.clientSideActions) return
const actionsBeforeFirstBubble = initialChunk.clientSideActions.filter(
(action) => isNotDefined(action.lastBubbleBlockId)
)
for (const action of actionsBeforeFirstBubble) {
if (
'streamOpenAiChatCompletion' in action ||
'webhookToExecute' in action
)
for (const action of actionsBeforeFirstBubble) {
if (
'streamOpenAiChatCompletion' in action ||
'webhookToExecute' in action
)
setIsSending(true)
const response = await executeClientSideAction({
clientSideAction: action,
context: {
apiHost: props.context.apiHost,
sessionId: props.initialChatReply.sessionId,
},
onMessageStream: streamMessage,
})
if (response && 'replyToSend' in response) {
sendMessage(response.replyToSend, response.logs)
return
}
if (response && 'blockedPopupUrl' in response)
setBlockedPopupUrl(response.blockedPopupUrl)
setIsSending(true)
const response = await executeClientSideAction({
clientSideAction: action,
context: {
apiHost: props.context.apiHost,
sessionId: props.initialChatReply.sessionId,
},
onMessageStream: streamMessage,
})
if (response && 'replyToSend' in response) {
sendMessage(response.replyToSend, response.logs)
return
}
if (response && 'blockedPopupUrl' in response)
setBlockedPopupUrl(response.blockedPopupUrl)
}
})()
})

View File

@@ -8,7 +8,7 @@ export const Avatar = (props: { initialAvatarSrc?: string }) => {
createEffect(() => {
if (
avatarSrc()?.startsWith('{{') &&
(avatarSrc()?.startsWith('{{') || !avatarSrc()) &&
props.initialAvatarSrc?.startsWith('http')
)
setAvatarSrc(props.initialAvatarSrc)