From b3d041677c97075e3b70b6d9baec2243042bcd10 Mon Sep 17 00:00:00 2001 From: tusharmagar Date: Wed, 8 Oct 2025 17:21:26 +0800 Subject: [PATCH] refactor: Simplify trigger filtering in Copilot - Removed unnecessary filtering logic for triggers based on user queries, streamlining the search process. - Updated response messages to clarify the context of displayed triggers, enhancing user understanding. This update improves the efficiency of the trigger search functionality within the Copilot interface. --- .../src/application/lib/copilot/copilot.ts | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/apps/rowboat/src/application/lib/copilot/copilot.ts b/apps/rowboat/src/application/lib/copilot/copilot.ts index 6c540396..76c5a963 100644 --- a/apps/rowboat/src/application/lib/copilot/copilot.ts +++ b/apps/rowboat/src/application/lib/copilot/copilot.ts @@ -293,16 +293,7 @@ async function searchRelevantTriggers( return `No triggers are currently available for toolkit "${trimmedSlug}".`; } - let filteredTriggers = triggers; - if (trimmedQuery) { - const queryLc = trimmedQuery.toLowerCase(); - filteredTriggers = triggers.filter(trigger => { - const baseText = `${trigger.name} ${trigger.slug} ${trigger.description}`.toLowerCase(); - const propertyNames = Object.keys(trigger.config?.properties || {}).join(' ').toLowerCase(); - return baseText.includes(queryLc) || propertyNames.includes(queryLc); - }); - logger.log(`filtered triggers to ${filteredTriggers.length} results using query`); - } + const filteredTriggers = triggers; if (!filteredTriggers.length) { return `No triggers found for toolkit "${trimmedSlug}"${trimmedQuery ? ` matching "${trimmedQuery}"` : ''}.`; @@ -321,11 +312,11 @@ async function searchRelevantTriggers( }).join('\n\n'); const header = trimmedQuery - ? `The following triggers match "${trimmedQuery}" in toolkit "${trimmedSlug}":` + ? `Showing triggers for toolkit "${trimmedSlug}" (you searched for "${trimmedQuery}"):\n` : `Available triggers for toolkit "${trimmedSlug}":`; const note = truncated - ? `\n\nOnly showing the first ${MAX_RESULTS} results out of ${filteredTriggers.length}. Refine your query for more specific results.` + ? `\n\nOnly showing the first ${MAX_RESULTS} results out of ${filteredTriggers.length}.` : ''; const response = `${header}\n\n${formattedTriggers}${note}`;