🐛 (pictureChoice) Fix dynamic image only variable saving
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import { PictureChoiceBlock, SessionState } from '@typebot.io/schemas'
|
||||
import { ParsedReply } from '../../../types'
|
||||
import { injectVariableValuesInPictureChoiceBlock } from './injectVariableValuesInPictureChoiceBlock'
|
||||
import { isNotEmpty } from '@typebot.io/lib/utils'
|
||||
|
||||
export const parsePictureChoicesReply =
|
||||
(state: SessionState) =>
|
||||
@ -64,7 +65,9 @@ export const parsePictureChoicesReply =
|
||||
return {
|
||||
status: 'success',
|
||||
reply: matchedItems
|
||||
.map((item) => item.title ?? item.pictureSrc ?? '')
|
||||
.map((item) =>
|
||||
isNotEmpty(item.title) ? item.title : item.pictureSrc ?? ''
|
||||
)
|
||||
.join(', '),
|
||||
}
|
||||
}
|
||||
@ -81,6 +84,8 @@ export const parsePictureChoicesReply =
|
||||
if (!matchedItem) return { status: 'fail' }
|
||||
return {
|
||||
status: 'success',
|
||||
reply: matchedItem.title ?? matchedItem.pictureSrc ?? '',
|
||||
reply: isNotEmpty(matchedItem.title)
|
||||
? matchedItem.title
|
||||
: matchedItem.pictureSrc ?? '',
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user