diff --git a/index.js b/index.js index 8d79975..4ed4962 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,5 @@ +import { handleInteraction } from "./copilot/aiHandler.js"; + export default async function ({ req, res, log, error }) { try { // Log a message @@ -12,6 +14,11 @@ export default async function ({ req, res, log, error }) { if (req.method === "GET") { // Send a JSON response return res.json({ message: "Hello, World!" }); + } else if (req.method === "POST") { + // Handle POST request + const userMessage = req.body.message; + const aiResponse = await handleInteraction(userMessage); + return res.json({ response: aiResponse }); } else { // Handle other HTTP methods if necessary return res.send("Unsupported request method", 405);