Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions openzero/skills/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ def _search_score(skill: Mapping[str, Any], query: str) -> int:
score += 12 * len(query_tokens & _tokens(f"{skill_id} {name}"))
score += 6 * len(query_tokens & _tokens(triggers))
score += 2 * len(query_tokens & _tokens(summary))
if (
skill_id == "browser-tabs"
and PUBLIC_WEB_TARGET_RE.search(query_clean)
and BROWSER_INSPECTION_RE.search(query_clean)
):
score += 50
return score


Expand Down
6 changes: 6 additions & 0 deletions openzero/skills/tests/test_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ def test_plain_conversation_does_not_bind_unrelated_skills(self):
["browser-tabs"],
)

def test_domain_inspection_search_ranks_browser_first(self):
self.assertEqual(
search_catalog("check talktoai.org what do you see?")[0]["id"],
"browser-tabs",
)

def test_domain_inspection_binds_browser_without_browser_keyword(self):
self.assertEqual(
select_skill_ids("check talktoai.org what do you see?"),
Expand Down
Loading