Update index.js
Browse files
index.js
CHANGED
|
@@ -142,6 +142,21 @@ app.use((req, res, next) => {
|
|
| 142 |
next();
|
| 143 |
});
|
| 144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
app.post('/', async (req, res) => {
|
| 146 |
const { content, user, prompt, webSearchMode } = req.body;
|
| 147 |
if (!content) {
|
|
|
|
| 142 |
next();
|
| 143 |
});
|
| 144 |
|
| 145 |
+
app.get('/q', async (req,res) => {
|
| 146 |
+
const { q } = req.body;
|
| 147 |
+
if (!q) {
|
| 148 |
+
return res.status(400).json({ error: "Content is required" });
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
try {
|
| 152 |
+
const result = await blackboxChat(q);
|
| 153 |
+
res.json({ result });
|
| 154 |
+
} catch (error) {
|
| 155 |
+
console.error("Error:", error.message);
|
| 156 |
+
res.status(500).json({ error: "Internal server error" });
|
| 157 |
+
}
|
| 158 |
+
})
|
| 159 |
+
|
| 160 |
app.post('/', async (req, res) => {
|
| 161 |
const { content, user, prompt, webSearchMode } = req.body;
|
| 162 |
if (!content) {
|