2
0

🐛 (pictureChoice) Fix choice parsing too unrestrictive

This commit is contained in:
Baptiste Arnaud
2023-11-23 14:14:43 +01:00
parent bb41226a04
commit 542e632472

View File

@@ -19,7 +19,7 @@ export const parsePictureChoicesReply =
(acc, item) => { (acc, item) => {
if ( if (
item.title && item.title &&
acc.strippedInput.toLowerCase().includes(item.title.toLowerCase()) acc.strippedInput.toLowerCase() === item.title.toLowerCase()
) )
return { return {
strippedInput: acc.strippedInput.replace(item.title ?? '', ''), strippedInput: acc.strippedInput.replace(item.title ?? '', ''),
@@ -74,14 +74,9 @@ export const parsePictureChoicesReply =
const matchedItem = longestItemsFirst.find( const matchedItem = longestItemsFirst.find(
(item) => (item) =>
item.id === inputValue || item.id === inputValue ||
item.title item.title?.toLowerCase().trim() === inputValue.toLowerCase().trim() ||
?.toLowerCase() item.pictureSrc?.toLowerCase().trim() ===
.trim() inputValue.toLowerCase().trim()
.includes(inputValue.toLowerCase().trim()) ||
item.pictureSrc
?.toLowerCase()
.trim()
.includes(inputValue.toLowerCase().trim())
) )
if (!matchedItem) return { status: 'fail' } if (!matchedItem) return { status: 'fail' }
return { return {