remove ai plugin integration
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
import { NextRequest } from "next/server";
|
||||
import { CLOUD_BASE, FRONTEND_API_KEY } from "@/lib/cloud";
|
||||
|
||||
// Proxy the editor's AI chat requests to Frontend Cloud, injecting the API key
|
||||
// server-side so it is never exposed to the client. The cloud response is
|
||||
// streamed straight back to the caller.
|
||||
export async function POST(req: NextRequest) {
|
||||
const upstream = await fetch(`${CLOUD_BASE}/api/chat`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"content-type": req.headers.get("content-type") ?? "application/json",
|
||||
"x-api-key": FRONTEND_API_KEY,
|
||||
},
|
||||
body: req.body,
|
||||
// Required by undici when forwarding a streaming request body.
|
||||
// @ts-expect-error - duplex is valid but missing from the lib types.
|
||||
duplex: "half",
|
||||
});
|
||||
|
||||
return new Response(upstream.body, {
|
||||
status: upstream.status,
|
||||
headers: {
|
||||
"content-type":
|
||||
upstream.headers.get("content-type") ?? "application/octet-stream",
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import { useParams } from "next/navigation";
|
||||
import { Editor, blocksPlugin, outlinePlugin } from "@reacteditor/core";
|
||||
import createTailwindCdnPlugin from "@reacteditor/plugin-tailwind-cdn";
|
||||
import { createShopifyPlugin } from "@reacteditor/plugin-shopify";
|
||||
import { aiPlugin } from "@reacteditor/plugin-ai";
|
||||
import { mediaPlugin } from "@reacteditor/plugin-media";
|
||||
import { mediaAdapter } from "@/lib/adapters/media-adapter";
|
||||
import { appConfig } from "@/editor.config";
|
||||
@@ -22,10 +21,6 @@ export default function EditorPage() {
|
||||
|
||||
const plugins = useMemo(
|
||||
() => [
|
||||
aiPlugin({
|
||||
// Proxied through our server route so the API key stays server-side.
|
||||
api: "/api/chat",
|
||||
}),
|
||||
blocksPlugin(),
|
||||
outlinePlugin(),
|
||||
mediaPlugin({
|
||||
|
||||
Reference in New Issue
Block a user