mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-06-06 19:35:44 +02:00
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.
This commit is contained in:
parent
15bc85145f
commit
b3d041677c
1 changed files with 3 additions and 12 deletions
|
|
@ -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}`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue