mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-06-25 03:08:53 +00:00
Initial commit
This commit is contained in:
22
src/routes/images.ts
Normal file
22
src/routes/images.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import express from 'express';
|
||||
import imageSearchChain from '../agents/imageSearchAgent';
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
router.post('/', async (req, res) => {
|
||||
try {
|
||||
const { query, chat_history } = req.body;
|
||||
|
||||
const images = await imageSearchChain.invoke({
|
||||
query,
|
||||
chat_history,
|
||||
});
|
||||
|
||||
res.status(200).json({ images });
|
||||
} catch (err) {
|
||||
res.status(500).json({ message: 'An error has occurred.' });
|
||||
console.log(err.message);
|
||||
}
|
||||
});
|
||||
|
||||
export default router;
|
Reference in New Issue
Block a user