ryu-js / plugins /copilot.js
randydev's picture
Update plugins/copilot.js
ba7e9e1 verified
raw
history blame
776 Bytes
import express from 'express';
import { Copilot2Trip } from '../lib/scrapper.js';
const CopilotRoutes = express.Router();
/**
* @swagger
* /api/v1/ai/copilot2-trip:
* get:
* summary: copilot2 Trip
* tags: [AI]
* parameters:
* - in: query
* name: q
* required: true
* description: The query to be processed.
* schema:
* type: string
* responses:
* 200:
* description: Success
*/
CopilotRoutes.get("/api/v1/ai/copilot2-trip", async (req, res) => {
try {
const q = req.query.q;
const results = await Copilot2Trip(q);
res.json({ results });
} catch (error) {
res.status(401).json({ error: error.message });
}
});
export { CopilotRoutes };