D Ф m i И i q ц e L Ф y e r commited on
Commit
6ffa86f
·
1 Parent(s): 36758c5

fix: restore full UI index.html with NER, EEAT, score circle from Production

Browse files
Files changed (1) hide show
  1. syscred/static/index.html +8 -31
syscred/static/index.html CHANGED
@@ -927,35 +927,12 @@
927
 
928
  <script>
929
  // Backend URLs
930
- // Empty string means relative path (same domain), which works for HF Space
931
- const REMOTE_API_URL = '';
932
  const LOCAL_API_URL = 'http://localhost:5001';
 
 
933
 
934
- // Detect if we are already on localhost
935
- const isLocalhost = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1';
936
- let API_URL = isLocalhost ? LOCAL_API_URL : REMOTE_API_URL;
937
-
938
- // Set initial toggle state based on environment
939
- document.addEventListener('DOMContentLoaded', () => {
940
- const toggle = document.getElementById('backendToggle');
941
- const status = document.getElementById('backendStatus');
942
- const labelLocal = document.getElementById('labelLocal');
943
- const labelRemote = document.getElementById('labelRemote');
944
-
945
- if (isLocalhost) {
946
- toggle.checked = false;
947
- status.textContent = 'Backend: localhost:5001 (léger, sans ML)';
948
- status.className = 'backend-status local';
949
- labelLocal.classList.add('active');
950
- labelRemote.classList.remove('active');
951
- } else {
952
- toggle.checked = true;
953
- status.textContent = 'Backend: HF Space (ML complet)';
954
- status.className = 'backend-status remote';
955
- labelLocal.classList.remove('active');
956
- labelRemote.classList.add('active');
957
- }
958
- });
959
 
960
  function toggleBackend() {
961
  const toggle = document.getElementById('backendToggle');
@@ -965,7 +942,7 @@
965
 
966
  if (toggle.checked) {
967
  API_URL = REMOTE_API_URL;
968
- status.textContent = 'Backend: HF Space (ML complet)';
969
  status.className = 'backend-status remote';
970
  labelLocal.classList.remove('active');
971
  labelRemote.classList.add('active');
@@ -976,7 +953,7 @@
976
  labelLocal.classList.add('active');
977
  labelRemote.classList.remove('active');
978
  }
979
- console.log('[SysCRED] Backend switched to:', API_URL || 'Relative Path (HF Space)');
980
  }
981
 
982
  async function analyzeUrl() {
@@ -1424,7 +1401,7 @@
1424
  // FIX: Map backend data (label) to frontend expectations (name)
1425
  if (data.nodes) {
1426
  data.nodes = data.nodes.map(n => {
1427
- n.name = n.name || n.label || 'Unknown';
1428
  if (!n.group) {
1429
  if (n.type === 'Source') n.group = 1;
1430
  else if (n.type === 'Entity') n.group = 1;
@@ -1888,4 +1865,4 @@
1888
  </script>
1889
  </body>
1890
 
1891
- </html>
 
927
 
928
  <script>
929
  // Backend URLs
 
 
930
  const LOCAL_API_URL = 'http://localhost:5001';
931
+ const REMOTE_API_URL = 'https://domloyer-syscred.hf.space';
932
+ let API_URL = '';
933
 
934
+ // API_URL est choisi plus tard par le toggle / la détection d’environnement
935
+ // API_URL = LOCAL_API_URL;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
936
 
937
  function toggleBackend() {
938
  const toggle = document.getElementById('backendToggle');
 
942
 
943
  if (toggle.checked) {
944
  API_URL = REMOTE_API_URL;
945
+ status.textContent = 'Backend: HF Space (ML complet, plus lent)';
946
  status.className = 'backend-status remote';
947
  labelLocal.classList.remove('active');
948
  labelRemote.classList.add('active');
 
953
  labelLocal.classList.add('active');
954
  labelRemote.classList.remove('active');
955
  }
956
+ console.log('[SysCRED] Backend switched to:', API_URL);
957
  }
958
 
959
  async function analyzeUrl() {
 
1401
  // FIX: Map backend data (label) to frontend expectations (name)
1402
  if (data.nodes) {
1403
  data.nodes = data.nodes.map(n => {
1404
+ n.name = n.label || n.name || 'Unknown';
1405
  if (!n.group) {
1406
  if (n.type === 'Source') n.group = 1;
1407
  else if (n.type === 'Entity') n.group = 1;
 
1865
  </script>
1866
  </body>
1867
 
1868
+ </html>