JoshAbrahams21 commited on
Commit
f29ca65
·
verified ·
1 Parent(s): 129f783

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +86 -1
index.html CHANGED
@@ -328,4 +328,89 @@
328
  });
329
  </script>
330
  <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=JoshAbrahams21/loopbreakers" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
331
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
  });
329
  </script>
330
  <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=JoshAbrahams21/loopbreakers" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
331
+ </html>
332
+
333
+
334
+ <script>
335
+ document.addEventListener('DOMContentLoaded', function() {
336
+ const solveBtn = document.getElementById('solve-btn');
337
+ const solutionSection = document.getElementById('solution-section');
338
+ const loading = document.getElementById('loading');
339
+ const solutionContent = document.getElementById('solution-content');
340
+ const mathProblemInput = document.getElementById('math-problem');
341
+ const stepsContainer = document.getElementById('steps-container');
342
+ const finalAnswer = document.getElementById('final-answer');
343
+ const alignmentReasoning = document.getElementById('alignment-reasoning');
344
+ const correctBtn = document.getElementById('correct-btn');
345
+ const incorrectBtn = document.getElementById('incorrect-btn');
346
+ const feedbackThanks = document.getElementById('feedback-thanks');
347
+
348
+ solveBtn.addEventListener('click', function() {
349
+ const problem = mathProblemInput.value.trim();
350
+ if (!problem) {
351
+ alert('Please enter a math problem to solve.');
352
+ return;
353
+ }
354
+
355
+ // Show loading
356
+ solutionSection.classList.add('show');
357
+ loading.classList.remove('hidden');
358
+ solutionContent.classList.add('hidden');
359
+ stepsContainer.innerHTML = '';
360
+ finalAnswer.textContent = '';
361
+ alignmentReasoning.textContent = '';
362
+
363
+ // Send to backend
364
+ fetch("/solve", {
365
+ method: "POST",
366
+ headers: {
367
+ "Content-Type": "application/json"
368
+ },
369
+ body: JSON.stringify({ question: problem })
370
+ })
371
+ .then(res => res.json())
372
+ .then(data => {
373
+ loading.classList.add('hidden');
374
+ solutionContent.classList.remove('hidden');
375
+
376
+ const steps = data.steps.split('\n').filter(line => line.trim() !== "");
377
+ steps.forEach((step, index) => {
378
+ const stepElement = document.createElement('div');
379
+ stepElement.className = 'step-highlight p-4 rounded-lg';
380
+ stepElement.innerHTML = `
381
+ <div class="flex">
382
+ <span class="flex-shrink-0 bg-purple-600 text-white rounded-full w-6 h-6 flex items-center justify-center mr-3">${index + 1}</span>
383
+ <p>${step}</p>
384
+ </div>
385
+ `;
386
+ stepsContainer.appendChild(stepElement);
387
+ });
388
+
389
+ finalAnswer.textContent = data.final_answer;
390
+ alignmentReasoning.textContent = "Reasoning is generated with reward-hacking resistance in mind. The model uses prompting strategies to ensure it avoids shortcuts or incorrect logic patterns.";
391
+ })
392
+ .catch(err => {
393
+ loading.classList.add('hidden');
394
+ alert("❌ Error fetching solution. Please try again.");
395
+ console.error(err);
396
+ });
397
+ });
398
+
399
+ correctBtn.addEventListener('click', function() {
400
+ feedbackThanks.classList.remove('hidden');
401
+ setTimeout(() => feedbackThanks.classList.add('hidden'), 3000);
402
+ });
403
+
404
+ incorrectBtn.addEventListener('click', function() {
405
+ feedbackThanks.textContent = "We'll review this solution to improve our AI. Thank you!";
406
+ feedbackThanks.className = "hidden mt-3 text-center text-purple-600 font-medium";
407
+ feedbackThanks.classList.remove('hidden');
408
+ setTimeout(() => feedbackThanks.classList.add('hidden'), 3000);
409
+ });
410
+
411
+ mathProblemInput.addEventListener('input', function() {
412
+ this.style.height = 'auto';
413
+ this.style.height = (this.scrollHeight) + 'px';
414
+ });
415
+ });
416
+ </script>