@askdock/server
The Askdock route handler. A plain Request → Response function, so it runs anywhere with fetch.
// app/api/askdock/route.ts
import { createAskdockHandler } from "@askdock/server";
import corpus from "../../../.askdock/corpus.json";
export const POST = createAskdockHandler({
model: { model: "google/gemini-3.1-flash-lite" },
corpus,
persona: { name: "Acme AI", fallbackHref: "/contact" },
});
Next.js, Hono, Bun, Deno — same line. Ships a per-IP rate limit, closed CORS, and an authorize hook.
persona says who the assistant is; messages says what it says when it can't answer — an outage, a quota, an empty question — so a site that isn't in English never apologises in English.
This file is where your API key lives. It is read from the server environment and never reaches the browser.
Part of Askdock — a chat widget that only knows your site. Full documentation, configuration reference and recipes are in the main README.
MIT.