Next.js Giselle Engine Handler (src/next-giselle-engine.ts)

giselle · integration, Integration / API, nextjs, http, ai, handler, middleware

Provides a Next.js request handler that wraps the Giselle AI engine, parses JSON/form bodies, routes to configured endpoints, and optionally runs after‑function logic.

// Source: https://github.com/mperkins0155/giselle | License: Apache-2.0 | Copyright 2024 ROUTE06, Inc
// Provided via justclaw.it.com; keep this notice with the code.
import {
	GenerationId,
	Giselle,
	type GiselleConfig,
	type GiselleContext,
} from "@giselles-ai/giselle";
import {
	GitHubWebhookUnauthorizedError,
	verifyRequest as verifyRequestAsGitHubWebook,
} from "@giselles-ai/github-tool";
import {
	formDataRoutes,
	isFormDataRoutePath,
	isJsonRoutePath,
	jsonRoutes,
} from "@giselles-ai/http";
import { after } from "next/server";
import { ZodError } from "zod";
import { type RequestContext, requestContextStore } from "./context";

interface NextGiselleConfig extends Omit<GiselleConfig, "waitUntil"> {
	basePath: string;
	useAfterFunction?: boolean;
	onRequest?: (args: {
		request: R

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key