- Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathapi.js
More file actions
Latest commit
29 lines (23 loc) · 1.29 KB
/
Copy pathapi.js
File metadata and controls
29 lines (23 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
constaxios=require("axios")
constexpress=require("express");
constrouter=express.Router();
//===========================================================================>
router.get("/gpt4",(req,res)=>{
consttext=req.query.q||req.query.query;
// هنا تحط variable ل text,
// يعني بدل تكتب الجملة ذي كل مرة req.query.q || req.query.query
//تكتب text وفقط
if(!text)returnres.send({status: false,owner: '@إسمك',err: 'اكتب شيئا !'});
// if(!text) تعني في حالة ما كتب شي ترسل له السطر ذا الي تقول فيه اكتب شي
axios.get('https://api.bk9.site/ai/gpt4?q='+text)
.then((response)=>{
constresponseData=response.data;//هنا يأخذ المعلومات من الرابط فوق ويحطهم عندك
res.send({status: true,owner: '@إسمك',BK9: responseData});
})
.catch((err)=>{
console.log(err);
res.status(500).send({status: false,owner: '@إسمك',err: 'الخادم مشغول الآن. حاول مرة أخرى في وقت لاحق!'});
});
});
//===========================================================================>
module.exports=router;