Skip to content

Your lightweight open-source personal agent.

fix(webui): correct SkillHub skill detail links

Xubin Ren3865bde3feab
diff --git a/nanobot/webui/skills_marketplace.py b/nanobot/webui/skills_marketplace.py
index 95e37dc1a..6498e2ed2 100644
--- a/nanobot/webui/skills_marketplace.py
+++ b/nanobot/webui/skills_marketplace.py
@@ -821,7 +821,7 @@ def _skillhub_skill(
"provider": _PROVIDER_SKILLHUB,
"installs": installs if isinstance(installs, int) and installs >= 0 else 0,
"downloads": downloads if isinstance(downloads, int) and downloads >= 0 else 0,
- "url": f"{_SKILLHUB_PAGE_BASE_URL}/{quote(handle.strip(), safe='')}/"
+ "url": f"{_SKILLHUB_PAGE_BASE_URL}/skills/{quote(handle.strip(), safe='')}/"
f"{quote(skill_id, safe='')}",
"installed": skill_id in installed,
"install_supported": True,
diff --git a/tests/webui/test_skills_marketplace.py b/tests/webui/test_skills_marketplace.py
index edee85a99..cb549f17e 100644
--- a/tests/webui/test_skills_marketplace.py
+++ b/tests/webui/test_skills_marketplace.py
@@ -160,7 +160,7 @@ async def test_search_skillhub_skills_normalizes_provider_metadata(
"provider": "skillhub",
"installs": 11831,
"downloads": 142525,
- "url": "https://skillhub.cn/tencent-adm/ima-skills",
+ "url": "https://skillhub.cn/skills/tencent-adm/ima-skills",
"installed": False,
"install_supported": True,
"metric": "installs_total",
@@ -171,6 +171,46 @@ async def test_search_skillhub_skills_normalizes_provider_metadata(
]
[email protected]("listing", ["search", "trending"])
+async def test_skillhub_listings_link_to_public_skill_details(
+ tmp_path: Path,
+ monkeypatch: pytest.MonkeyPatch,
+ listing: str,
+) -> None:
+ row = {
+ "slug": "mail-agent-goose",
+ "displayName": "邮件管理器",
+ "namespace": {"handle": "user_a3ed06bc"},
+ "version": "2.2.0",
+ "homepage": "https://api.skillhub.cn/user_a3ed06bc/mail-agent-goose",
+ }
+
+ def respond(request: httpx.Request) -> httpx.Response:
+ if listing == "search":
+ assert request.url.path == "/api/v1/search"
+ return httpx.Response(200, json={"results": [row]})
+ assert request.url.path == "/api/v1/showcase/trending"
+ return httpx.Response(200, json={"skills": [row]})
+
+ monkeypatch.setattr(
+ "nanobot.webui.skills_marketplace._skillhub_client",
+ lambda: httpx.AsyncClient(transport=httpx.MockTransport(respond)),
+ )
+
+ if listing == "search":
+ payload = await search_marketplace_skills(
+ "@user_a3ed06bc/mail-agent-goose", tmp_path, provider="skillhub",
+ )
+ else:
+ payload = await trending_marketplace_skills(tmp_path, provider="skillhub")
+
+ assert len(payload["skills"]) == 1
+ assert payload["skills"][0]["url"] == (
+ "https://skillhub.cn/skills/user_a3ed06bc/mail-agent-goose"
+ )
+
+
@pytest.mark.asyncio
async def test_trending_marketplace_skills_diversifies_sources_and_keeps_rank(
tmp_path: Path,
diff --git a/webui/src/tests/app-layout.test.tsx b/webui/src/tests/app-layout.test.tsx
index 9fc39cff6..829bc65d6 100644
--- a/webui/src/tests/app-layout.test.tsx
+++ b/webui/src/tests/app-layout.test.tsx
@@ -1549,7 +1549,7 @@ describe("App layout", () => {
provider: "skillhub",
installs: 11_831,
downloads: 142_525,
- url: "https://skillhub.cn/tencent-adm/ima-skills",
+ url: "https://skillhub.cn/skills/tencent-adm/ima-skills",
installed: false,
install_supported: true,
metric: "installs_total",
@@ -1589,7 +1589,7 @@ describe("App layout", () => {
provider: "skillhub",
installs: 693,
downloads: 7_718,
- url: "https://skillhub.cn/ivangdavila/react",
+ url: "https://skillhub.cn/skills/ivangdavila/react",
installed: false,
install_supported: true,
metric: "installs_total",
@@ -1619,6 +1619,9 @@ describe("App layout", () => {
).not.toBeInTheDocument();
expect(screen.getByText("find-skills")).toBeInTheDocument();
expect(screen.getByText("ima-skills")).toBeInTheDocument();
+ expect(screen.getByRole("link", { name: "Open ima-skills on SkillHub" })).toHaveAttribute(
+ "href", "https://skillhub.cn/skills/tencent-adm/ima-skills",
+ );
expect(screen.getAllByText("SkillHub")).toHaveLength(2);
expect(screen.getAllByText("skills.sh")).toHaveLength(2);
expect(screen.getByText(/14,481 installs \/ 24h/)).toBeInTheDocument();
@@ -1643,6 +1646,9 @@ describe("App layout", () => {
});
expect(await screen.findByText("React Testing")).toBeInTheDocument();
+ expect(screen.getByRole("link", { name: "Open React on SkillHub" })).toHaveAttribute(
+ "href", "https://skillhub.cn/skills/ivangdavila/react",
+ );
fireEvent.click(screen.getByRole("button", { name: "Install React Testing" }));
expect(
await screen.findByRole("heading", { name: "Install React Testing?" }),
diff --git a/webui/src/tests/skills-marketplace.test.tsx b/webui/src/tests/skills-marketplace.test.tsx
index ed3358386..88a38f239 100644
--- a/webui/src/tests/skills-marketplace.test.tsx
+++ b/webui/src/tests/skills-marketplace.test.tsx
@@ -268,7 +268,7 @@ describe("SkillsMarketplace", () => {
const skill = {
id: "skillhub:react-testing", skill_id: "react-testing", name: "React Testing",
source: "react-testing", provider: "skillhub" as const, installs: 42,
- url: "https://skillhub.cn/react-testing", installed: false, install_supported: true,
+ url: "https://skillhub.cn/skills/react-testing", installed: false, install_supported: true,
metric: "installs_total" as const, rank: 1,
};
let resolveTrending!: (value: Awaited<ReturnType<typeof fetchTrendingMarketplaceSkills>>) => void;