mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-28 08:18:09 -05:00
fix: include keywords in search filter + show service name in tool operations
This commit is contained in:
@@ -207,9 +207,9 @@ export function SearchModal({
|
||||
const showToolOperations = isOnWorkflowPage && toolOperations.length > 0
|
||||
const showDocs = isOnWorkflowPage && docs.length > 0
|
||||
|
||||
const customFilter = useCallback((value: string, search: string) => {
|
||||
const valueLower = value.toLowerCase()
|
||||
const customFilter = useCallback((value: string, search: string, keywords?: string[]) => {
|
||||
const searchLower = search.toLowerCase()
|
||||
const valueLower = value.toLowerCase()
|
||||
|
||||
if (valueLower === searchLower) return 1
|
||||
if (valueLower.startsWith(searchLower)) return 0.8
|
||||
@@ -219,6 +219,13 @@ export function SearchModal({
|
||||
const allWordsMatch = searchWords.every((word) => valueLower.includes(word))
|
||||
if (allWordsMatch && searchWords.length > 0) return 0.4
|
||||
|
||||
if (keywords?.length) {
|
||||
const keywordsLower = keywords.join(' ').toLowerCase()
|
||||
if (keywordsLower.includes(searchLower)) return 0.3
|
||||
const keywordWordsMatch = searchWords.every((word) => keywordsLower.includes(word))
|
||||
if (keywordWordsMatch && searchWords.length > 0) return 0.2
|
||||
}
|
||||
|
||||
return 0
|
||||
}, [])
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ export const useSearchModalStore = create<SearchModalState>()(
|
||||
.filter((op) => allowedBlockTypes.has(op.blockType))
|
||||
.map((op) => ({
|
||||
id: op.id,
|
||||
name: op.operationName,
|
||||
name: `${op.serviceName}: ${op.operationName}`,
|
||||
searchValue: `${op.serviceName} ${op.operationName}`,
|
||||
icon: op.icon,
|
||||
bgColor: op.bgColor,
|
||||
|
||||
Reference in New Issue
Block a user