mirror of
https://github.com/vercel/chat.git
synced 2026-09-14 18:32:29 +08:00
03d274283f
Adds `examples/nuxt-chat`, a Nuxt 4 reference app for Chat SDK scoped to
the Slack and web adapters.
The Nitro server exposes `/api/webhooks/{platform}` for Slack events and
`/api/chat` for the browser UI, with H3-to-Fetch conversion that
preserves the raw request body for signature verification. Bot handlers
are ported from `nextjs-chat` — interactive cards, modals, slash
commands, transcripts, reactions, and AI streaming — without the
workflow demos.
The `/chat` page is a client-only Vue UI using `@chat-adapter/web/vue`
and the AI SDK. A Slack app manifest ships with the scopes and events
needed for pins, reactions, channel joins, and interactivity.
Monorepo plumbing covers changeset ignore, CI build exclusion,
`AGENTS.md`, knip entry paths for the Nuxt 4 `app/` directory, and biome
globals for Nitro auto-imports.
---------
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
31 lines
778 B
TypeScript
31 lines
778 B
TypeScript
import { createSlackAdapter, type SlackAdapter } from "@chat-adapter/slack";
|
|
import { createWebAdapter, type WebAdapter } from "@chat-adapter/web";
|
|
import { ConsoleLogger } from "chat";
|
|
|
|
const logger = new ConsoleLogger("info");
|
|
|
|
export interface Adapters {
|
|
slack?: SlackAdapter;
|
|
web: WebAdapter;
|
|
}
|
|
|
|
export function buildAdapters(): Adapters {
|
|
const adapters: Adapters = {
|
|
web: createWebAdapter({
|
|
userName: "Chat SDK Bot",
|
|
logger: logger.child("web"),
|
|
getUser: () => ({ id: "demo", name: "Demo User" }),
|
|
}),
|
|
};
|
|
|
|
if (process.env.SLACK_SIGNING_SECRET) {
|
|
adapters.slack = createSlackAdapter({
|
|
userName: "Chat SDK Bot",
|
|
logger: logger.child("slack"),
|
|
botToken: process.env.SLACK_BOT_TOKEN,
|
|
});
|
|
}
|
|
|
|
return adapters;
|
|
}
|