Update index.js
Browse files
index.js
CHANGED
@@ -15,27 +15,29 @@ app.get('/api/test', async (req, res) => {
|
|
15 |
}
|
16 |
})
|
17 |
|
18 |
-
const
|
19 |
-
try {
|
20 |
const payload = {
|
21 |
-
|
22 |
-
|
23 |
};
|
24 |
-
const type_urls = "openai-gpt";
|
25 |
const url = "https://bot-management-4tozrh7z2a-ue.a.run.app/chat/web";
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
33 |
};
|
34 |
|
35 |
-
app.
|
36 |
try {
|
37 |
const query = req.params.query;
|
38 |
-
const output = await
|
39 |
res.json({ message: output });
|
40 |
} catch (error) {
|
41 |
res.status(401).json({ error: error.message });
|
|
|
15 |
}
|
16 |
})
|
17 |
|
18 |
+
const akenoaiModeWeb = async (prompt) => {
|
|
|
19 |
const payload = {
|
20 |
+
prompt: prompt,
|
21 |
+
bid: "040d0481"
|
22 |
};
|
|
|
23 |
const url = "https://bot-management-4tozrh7z2a-ue.a.run.app/chat/web";
|
24 |
+
try {
|
25 |
+
const response = await axios.post(url, payload);
|
26 |
+
return response.data.answer;
|
27 |
+
} catch (error) {
|
28 |
+
if (error.response) {
|
29 |
+
console.error("Response Error:", error.response.status, error.response.data);
|
30 |
+
} else {
|
31 |
+
console.error("Error Message:", error.message);
|
32 |
+
}
|
33 |
+
return "Error occurred!";
|
34 |
+
}
|
35 |
};
|
36 |
|
37 |
+
app.get('/api/akenoweb', async (req, res) => {
|
38 |
try {
|
39 |
const query = req.params.query;
|
40 |
+
const output = await akenoaiModeWeb(query);
|
41 |
res.json({ message: output });
|
42 |
} catch (error) {
|
43 |
res.status(401).json({ error: error.message });
|