mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 19:59:50 +08:00
12 lines
303 B
TypeScript
12 lines
303 B
TypeScript
|
import { SearchIndex } from 'emoji-mart'
|
||
|
import type { Emoji } from '@emoji-mart/data'
|
||
|
|
||
|
export async function searchEmoji(value: string) {
|
||
|
const emojis: Emoji[] = await SearchIndex.search(value) || []
|
||
|
|
||
|
const results = emojis.map((emoji) => {
|
||
|
return emoji.skins[0].native
|
||
|
})
|
||
|
return results
|
||
|
}
|