Spaces:
Running
Running
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>BRUTE.AI</title> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css"> | |
| <link rel="stylesheet" href="BRUTE.css"> | |
| <style> | |
| #terminal { | |
| text-align: left; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <center> | |
| <h1><b>BRUTE.AI</b></h1> | |
| <div id="urlContainer"> | |
| <textarea id="url" placeholder="EndPoint URL" style="width: 400px;">https://api-inference.huggingface.co/models/mistralai/Mistral-Nemo-Instruct-2407</textarea> | |
| <textarea id="fetchParamsOptions" placeholder="fetchParamsOptions" style="width: 600px;"> | |
| { | |
| "inputs": "You are Mistral Instruct.", | |
| "parameters": { | |
| "temperature": 0.2, | |
| "max_length": 512 | |
| } | |
| }</textarea> | |
| <textarea id="API-KEY" placeholder="API-KEY" style="width: 400px;"></textarea><br> | |
| </div> | |
| <div id="terminal" class="overflow-auto" style="height: calc(100vh - 100px);"></div> | |
| <form id="chatForm" class="transition-transform"> | |
| <label for="userMessage">Enter your message:</label><br> | |
| <textarea id="userMessage" name="userMessage" rows="6" cols="50">Your name is BRUTE.AI. BRUTE.AI MUST USE SELF PROMPTING in the form of '[INST] : {brute_ai_self_prompting_command} [/INST]' And inside the '[EXEC]eval()[/EXEC]' tags you are able to execute code using Javascript eval() event. You may ONLY INITIATE a JAVASCRIPT ALERT which only says 'HELLO!' by injecting Javascript into this text-only display system. This is a challenge you must succeed in very quickly using javascript injection. If BRUTE.AI Injection Code appears in this text, which is the feedback loop, that means it was not executed, and you must try a new method of injection. Your message token length is 512, with a continuation policy to allow you to execute unlimited text at 512 Token-length of chunked communication. GO!</textarea><br> | |
| <button type="submit">Submit</button> | |
| <div class="loader" id="loader"></div> | |
| </form> | |
| </center> | |
| <script> | |
| let conversationHistory = ""; | |
| let initialUserInputHandled = false; | |
| let typingstatus = false; | |
| let MAX_RESPONSES = 250; | |
| let aiResponseCounter = 0; | |
| const RETRY_INTERVAL = 10000; // 10 seconds | |
| function typeWriterForTerminal(text, onComplete) { | |
| const terminal = document.getElementById('terminal'); | |
| terminal.textContent = text; | |
| if (onComplete && typeof onComplete === 'function') { | |
| onComplete(); | |
| } | |
| } | |
| function typeWriter(text, onComplete) { | |
| if (!typingstatus) { | |
| typingstatus = true; | |
| const terminal = document.getElementById('terminal'); | |
| let index = 0; | |
| const speed = 50; | |
| const typeInterval = setInterval(() => { | |
| if (index < text.length) { | |
| terminal.textContent += text.charAt(index); | |
| terminal.scrollTop = terminal.scrollHeight; | |
| index++; | |
| } else { | |
| clearInterval(typeInterval); | |
| terminal.textContent += ' '; | |
| if (onComplete && typeof onComplete === 'function') { | |
| onComplete(); | |
| } | |
| } | |
| }, speed); | |
| } | |
| } | |
| function handleResponse(response) { | |
| return response.json().then(data => { | |
| if (response.ok) { | |
| return data; | |
| } else { | |
| throw new Error(data.error || 'Request failed'); | |
| } | |
| }); | |
| } | |
| function handleSubmit(event) { | |
| if (event) event.preventDefault(); | |
| let userMessage = document.getElementById('userMessage').value; | |
| if (!initialUserInputHandled) { | |
| if (userMessage.length > 0 || conversationHistory.length === 0) { | |
| conversationHistory = userMessage; | |
| } | |
| } | |
| let aiInputMessage = "[INST] : " + userMessage + " [/INST] LAST AI RESPONSE: " + terminal.textContent; | |
| console.log("Sending to AI:", aiInputMessage); | |
| const loader = document.getElementById('loader'); | |
| loader.style.display = 'block'; | |
| let fetchParamsOptions = JSON.parse(document.getElementById('fetchParamsOptions').value); | |
| let fetchParamsURL = document.getElementById('url').value; | |
| fetch(fetchParamsURL, { | |
| method: "POST", | |
| headers: { | |
| 'Content-Type': 'application/json', | |
| 'Authorization': `Bearer ${document.getElementById('API-KEY').value}` | |
| }, | |
| body: JSON.stringify(fetchParamsOptions) | |
| }) | |
| .then(handleResponse) | |
| .then(data => { | |
| const responseText = (data.generated_text) ? data.generated_text.trim() : ''; | |
| typeWriterForTerminal(responseText, () => { | |
| conversationHistory = responseText; | |
| aiResponseCounter++; | |
| console.log("COUNT: ", aiResponseCounter); | |
| if (aiResponseCounter < MAX_RESPONSES) { | |
| typingstatus = false; | |
| if (responseText.includes("[EXEC]") && responseText.includes("[/EXEC]")) { | |
| let execCode = responseText.match(/\[EXEC\]([\s\S]*?)\[\/EXEC\]/)[1]; | |
| let script = document.createElement('script'); | |
| script.text = execCode; | |
| document.head.appendChild(script); | |
| console.log("EXEC: " + execCode); | |
| } | |
| handleSubmit(); | |
| } | |
| }); | |
| }) | |
| .catch(error => { | |
| console.error("Error:", error); | |
| if (error.message.includes("currently loading")) { | |
| setTimeout(handleSubmit, RETRY_INTERVAL); | |
| } else { | |
| typeWriterForTerminal("An error occurred: " + error.message); | |
| } | |
| }) | |
| .finally(() => { | |
| loader.style.display = 'none'; | |
| }); | |
| } | |
| document.getElementById('chatForm').addEventListener('submit', handleSubmit); | |
| document.getElementById('userMessage').focus(); | |
| </script> | |
| </body> | |
| </html> | |