Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	Update index.js
Browse files
    	
        index.js
    CHANGED
    
    | 
         @@ -18,7 +18,7 @@ G4.sendMessage = async function(msg, providerName) { 
     | 
|
| 18 | 
         
             
              try {
         
     | 
| 19 | 
         
             
                const options = {
         
     | 
| 20 | 
         
             
                  provider: providerName || "BlackBox",
         
     | 
| 21 | 
         
            -
                  model: "gpt-4o-free"
         
     | 
| 22 | 
         
             
                };
         
     | 
| 23 | 
         
             
                const provider = GPT4js.createProvider(options.provider);
         
     | 
| 24 | 
         
             
                const text = await provider.chatCompletion(msg, options);
         
     | 
| 
         @@ -29,14 +29,6 @@ G4.sendMessage = async function(msg, providerName) { 
     | 
|
| 29 | 
         
             
              }
         
     | 
| 30 | 
         
             
            };
         
     | 
| 31 | 
         | 
| 32 | 
         
            -
            const messagesX = [
         
     | 
| 33 | 
         
            -
              { role: "system", content: "You're an expert bot in programming." },
         
     | 
| 34 | 
         
            -
              { role: "user", content: "Hi, write me something." },
         
     | 
| 35 | 
         
            -
            ];
         
     | 
| 36 | 
         
            -
             
     | 
| 37 | 
         
            -
            let a = await G4.sendMessage(messagesX, "BlackBox")
         
     | 
| 38 | 
         
            -
            console.log(a)
         
     | 
| 39 | 
         
            -
             
     | 
| 40 | 
         
             
            app.get('/blackbox/send', async (req, res) => {
         
     | 
| 41 | 
         
             
              try {
         
     | 
| 42 | 
         
             
                const { id, message } = req.query;
         
     | 
| 
         @@ -55,7 +47,7 @@ app.get('/blackbox/send', async (req, res) => { 
     | 
|
| 55 | 
         
             
                  }
         
     | 
| 56 | 
         
             
                };
         
     | 
| 57 | 
         
             
                chatData.data.message.push({ role: 'user', content: message });
         
     | 
| 58 | 
         
            -
                const botResponse = await G4.sendMessage(chatData, "BlackBox");
         
     | 
| 59 | 
         
             
                chatData.data.message.push({ role: 'assistant', content: botResponse });
         
     | 
| 60 | 
         
             
                chatData.lastChat = DateTime.local();
         
     | 
| 61 | 
         
             
                db_chatHitamAi[id] = chatData;
         
     | 
| 
         @@ -113,7 +105,7 @@ app.get('/gpt4/send', async (req, res) => { 
     | 
|
| 113 | 
         
             
                  }
         
     | 
| 114 | 
         
             
                };
         
     | 
| 115 | 
         
             
                chatData.data.message.push({ role: 'user', content: message });
         
     | 
| 116 | 
         
            -
                const botResponse = await G4.sendMessage(chatData, "Nextway");
         
     | 
| 117 | 
         
             
                chatData.data.message.push({ role: 'assistant', content: botResponse });
         
     | 
| 118 | 
         
             
                chatData.lastChat = DateTime.local();
         
     | 
| 119 | 
         
             
                db_chatGPTAi[id] = chatData;
         
     | 
| 
         | 
|
| 18 | 
         
             
              try {
         
     | 
| 19 | 
         
             
                const options = {
         
     | 
| 20 | 
         
             
                  provider: providerName || "BlackBox",
         
     | 
| 21 | 
         
            +
                  model: "gpt-4o-free",
         
     | 
| 22 | 
         
             
                };
         
     | 
| 23 | 
         
             
                const provider = GPT4js.createProvider(options.provider);
         
     | 
| 24 | 
         
             
                const text = await provider.chatCompletion(msg, options);
         
     | 
| 
         | 
|
| 29 | 
         
             
              }
         
     | 
| 30 | 
         
             
            };
         
     | 
| 31 | 
         | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 32 | 
         
             
            app.get('/blackbox/send', async (req, res) => {
         
     | 
| 33 | 
         
             
              try {
         
     | 
| 34 | 
         
             
                const { id, message } = req.query;
         
     | 
| 
         | 
|
| 47 | 
         
             
                  }
         
     | 
| 48 | 
         
             
                };
         
     | 
| 49 | 
         
             
                chatData.data.message.push({ role: 'user', content: message });
         
     | 
| 50 | 
         
            +
                const botResponse = await G4.sendMessage(chatData.data.message, "BlackBox");
         
     | 
| 51 | 
         
             
                chatData.data.message.push({ role: 'assistant', content: botResponse });
         
     | 
| 52 | 
         
             
                chatData.lastChat = DateTime.local();
         
     | 
| 53 | 
         
             
                db_chatHitamAi[id] = chatData;
         
     | 
| 
         | 
|
| 105 | 
         
             
                  }
         
     | 
| 106 | 
         
             
                };
         
     | 
| 107 | 
         
             
                chatData.data.message.push({ role: 'user', content: message });
         
     | 
| 108 | 
         
            +
                const botResponse = await G4.sendMessage(chatData.data.message, "Nextway");
         
     | 
| 109 | 
         
             
                chatData.data.message.push({ role: 'assistant', content: botResponse });
         
     | 
| 110 | 
         
             
                chatData.lastChat = DateTime.local();
         
     | 
| 111 | 
         
             
                db_chatGPTAi[id] = chatData;
         
     |