🐛 (pictureChoice) Fix choice parsing too unrestrictive
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user