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
11 changes: 11 additions & 0 deletions apps/docs/adapters.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,17 @@
"author": "rama-adi",
"readme": "https://github.com/rama-adi/chat-adapter-baileys"
},
{
"name": "Liveblocks",
"slug": "liveblocks",
"type": "platform",
"community": true,
"description": "Liveblocks Comments adapter for building conversational bots on top of Liveblocks rooms, threads, and comments.",
"packageName": "@liveblocks/chat-sdk-adapter",
"author": "Liveblocks",
"readme": "https://github.com/liveblocks/liveblocks/tree/main/packages/liveblocks-chat-sdk-adapter",
"vendorOfficial": true
},
{
"name": "Instagram",
"slug": "instagram",
Expand Down
15 changes: 15 additions & 0 deletions apps/docs/app/[lang]/(home)/adapters/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import adapters from "@/adapters.json";
import { ReadmeContent } from "../components/readme-content";

const LOCAL_PACKAGE_PATTERN = /github\.com\/vercel\/chat\/tree\/[^/]+\/(.+)/;
const GITHUB_SUBPATH_PATTERN =
/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)\/(.+)/;
const GITHUB_REPO_PATTERN = /github\.com\/([^/]+)\/([^/]+)/;

const getAdapter = (slug: string) => adapters.find((a) => a.slug === slug);
Expand All @@ -23,6 +25,19 @@ const getReadme = async (repoUrl: string): Promise<string | undefined> => {
}
}

const subpathMatch = repoUrl.match(GITHUB_SUBPATH_PATTERN);
if (subpathMatch) {
const [, owner, repo, ref, path] = subpathMatch;
const url = `https://api.github.com/repos/${owner}/${repo}/readme/${path}?ref=${ref}`;
const response = await fetch(url, {
headers: { Accept: "application/vnd.github.raw+json" },
next: { revalidate: 3600 },
});
if (response.ok) {
return response.text();
}
}

const repoMatch = repoUrl.match(GITHUB_REPO_PATTERN);
if (repoMatch) {
const [, owner, repo] = repoMatch;
Expand Down
1 change: 1 addition & 0 deletions skills/chat/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ await thread.post(
- `@resend/chat-sdk-adapter`
- `@zernio/chat-sdk-adapter`
- `chat-adapter-baileys`
- `@liveblocks/chat-sdk-adapter`

### Coming-soon platform entries

Expand Down
Loading