use postMessage
This commit is contained in:
@@ -10,7 +10,6 @@ import {
|
||||
reactEditorTools,
|
||||
getEditorContext,
|
||||
} from "@reacteditor/plugin-ai/server";
|
||||
import { patchRoute, readSchema } from "@/lib/schema.server";
|
||||
import { shopifyFetch } from "@/editor/services/shopify/client";
|
||||
import {
|
||||
GET_PRODUCTS_QUERY,
|
||||
@@ -31,20 +30,7 @@ type Body = {
|
||||
};
|
||||
|
||||
export async function POST(req: Request) {
|
||||
const { messages, editorContext, route } = (await req.json()) as Body;
|
||||
|
||||
const updatePage = tool({
|
||||
description:
|
||||
"Persist the page schema (root + content) for a given route to app.schema.json.",
|
||||
inputSchema: z.object({
|
||||
data: z.object({ root: z.any(), content: z.any() }),
|
||||
}),
|
||||
execute: async ({ data }) => {
|
||||
const target = route || "/";
|
||||
await patchRoute(target, data);
|
||||
return { ok: true, route: target };
|
||||
},
|
||||
});
|
||||
const { messages, editorContext } = (await req.json()) as Body;
|
||||
|
||||
const generateImage = tool({
|
||||
description: "Generate an image from a prompt and return its URL.",
|
||||
@@ -230,7 +216,6 @@ export async function POST(req: Request) {
|
||||
messages: await convertToModelMessages(messages),
|
||||
tools: {
|
||||
...reactEditorTools,
|
||||
updatePage,
|
||||
generateImage,
|
||||
searchProducts,
|
||||
getProductByHandle,
|
||||
|
||||
Reference in New Issue
Block a user