fraudTech commited on
Commit
dc294b2
Β·
verified Β·
1 Parent(s): ade5e34

Upload 10 files

Browse files
Files changed (1) hide show
  1. src/App.js +26 -18
src/App.js CHANGED
@@ -1,5 +1,4 @@
1
  // src/App.js
2
- // https://deepthoughtai-prolog-backend.hf.space
3
 
4
  import React, { useState } from "react";
5
  import { sendChat, login, streamChat, uploadPrologFile, getKBMetadata, queryProlog } from "./api";
@@ -227,15 +226,21 @@ function App() {
227
  return (
228
  <div className="app-root">
229
  <header className="header">
230
- <h1>Prolog AI</h1>
231
-
232
- <label className="strict-toggle">
 
 
 
 
 
 
233
  <input
234
  type="checkbox"
235
  checked={strictMode}
236
  onChange={(e) => setStrictMode(e.target.checked)}
237
  />{" "}
238
- Strict KB Mode
239
  </label>
240
 
241
  <button
@@ -351,7 +356,7 @@ function App() {
351
 
352
  {queryResults && (
353
  <div className="query-results" style={{ marginTop: "15px" }}>
354
- <h4>Results</h4>
355
  <pre style={{ fontSize: "0.85em", overflowX: "auto" }}>
356
  {JSON.stringify(queryResults, null, 2)}
357
  </pre>
@@ -400,7 +405,7 @@ function Message({ message }) {
400
  cursor: "pointer"
401
  }}
402
  >
403
- {showDebug ? "πŸ”½ Prolog" : "πŸ”Ό Prolog"}
404
  </button>
405
 
406
  {showDebug && (
@@ -410,19 +415,21 @@ function Message({ message }) {
410
  background: "#f8f8f8",
411
  border: "1px solid #ddd",
412
  borderRadius: "6px",
413
- fontSize: "0.9em"
 
414
  }}>
415
- <h4 style={{ marginTop: 0, marginBottom: "10px" }}>πŸ” Prolog Query Analysis</h4>
416
 
417
  {message.debug.llm_analysis && (
418
  <div style={{ marginBottom: "15px" }}>
419
- <strong>Generated Queries:</strong>
420
  <pre style={{
421
  background: "#fff",
422
  padding: "8px",
423
  borderRadius: "4px",
424
  fontSize: "0.9em",
425
- overflowX: "auto"
 
426
  }}>
427
  {message.debug.llm_analysis}
428
  </pre>
@@ -431,8 +438,8 @@ function Message({ message }) {
431
 
432
  {message.debug.predicates_queried && message.debug.predicates_queried.length > 0 && (
433
  <div style={{ marginBottom: "15px" }}>
434
- <strong>Predicates Queried:</strong>{" "}
435
- <span style={{ color: "#0066cc" }}>
436
  {message.debug.predicates_queried.join(", ")}
437
  </span>
438
  </div>
@@ -440,19 +447,20 @@ function Message({ message }) {
440
 
441
  {message.debug.queries_executed && message.debug.queries_executed.length > 0 && (
442
  <div style={{ marginBottom: "15px" }}>
443
- <strong>Executed Queries ({message.debug.queries_executed.length}):</strong>
444
- <ul style={{ marginTop: "5px", paddingLeft: "20px" }}>
445
  {message.debug.queries_executed.map((q, idx) => (
446
  <li key={idx} style={{ marginBottom: "5px" }}>
447
  <code style={{
448
  background: "#e8f4f8",
449
  padding: "2px 6px",
450
  borderRadius: "3px",
451
- fontSize: "0.9em"
 
452
  }}>
453
  {q.query}
454
  </code>{" "}
455
- <span style={{ color: "#666" }}>
456
  β†’ {q.results_count} result{q.results_count !== 1 ? "s" : ""}
457
  </span>
458
  </li>
@@ -462,7 +470,7 @@ function Message({ message }) {
462
  )}
463
 
464
  <div>
465
- <strong>Total Results:</strong>{" "}
466
  <span style={{ color: "#00aa00", fontWeight: "bold" }}>
467
  {message.debug.total_results || 0}
468
  </span>
 
1
  // src/App.js
 
2
 
3
  import React, { useState } from "react";
4
  import { sendChat, login, streamChat, uploadPrologFile, getKBMetadata, queryProlog } from "./api";
 
226
  return (
227
  <div className="app-root">
228
  <header className="header">
229
+ <h1>🧠 Prolog AI</h1>
230
+
231
+ <label className="strict-toggle" style={{
232
+ padding: "0.5rem 1rem",
233
+ background: strictMode ? "rgba(220, 38, 38, 0.2)" : "rgba(34, 197, 94, 0.2)",
234
+ border: `1px solid ${strictMode ? "rgba(220, 38, 38, 0.5)" : "rgba(34, 197, 94, 0.5)"}`,
235
+ borderRadius: "6px",
236
+ cursor: "pointer"
237
+ }}>
238
  <input
239
  type="checkbox"
240
  checked={strictMode}
241
  onChange={(e) => setStrictMode(e.target.checked)}
242
  />{" "}
243
+ {strictMode ? "πŸ”’ Strict KB Mode" : "πŸ”“ Flexible Mode"}
244
  </label>
245
 
246
  <button
 
356
 
357
  {queryResults && (
358
  <div className="query-results" style={{ marginTop: "15px" }}>
359
+ <h4>πŸ“Š Results</h4>
360
  <pre style={{ fontSize: "0.85em", overflowX: "auto" }}>
361
  {JSON.stringify(queryResults, null, 2)}
362
  </pre>
 
405
  cursor: "pointer"
406
  }}
407
  >
408
+ {showDebug ? "πŸ”½ Hide Prolog Queries" : "πŸ”Ό Show Prolog Queries"}
409
  </button>
410
 
411
  {showDebug && (
 
415
  background: "#f8f8f8",
416
  border: "1px solid #ddd",
417
  borderRadius: "6px",
418
+ fontSize: "0.9em",
419
+ color: "#1a1a1a"
420
  }}>
421
+ <h4 style={{ marginTop: 0, marginBottom: "10px", color: "#1a1a1a" }}>πŸ” Prolog Query Analysis</h4>
422
 
423
  {message.debug.llm_analysis && (
424
  <div style={{ marginBottom: "15px" }}>
425
+ <strong style={{ color: "#1a1a1a" }}>Generated Queries:</strong>
426
  <pre style={{
427
  background: "#fff",
428
  padding: "8px",
429
  borderRadius: "4px",
430
  fontSize: "0.9em",
431
+ overflowX: "auto",
432
+ color: "#1a1a1a"
433
  }}>
434
  {message.debug.llm_analysis}
435
  </pre>
 
438
 
439
  {message.debug.predicates_queried && message.debug.predicates_queried.length > 0 && (
440
  <div style={{ marginBottom: "15px" }}>
441
+ <strong style={{ color: "#1a1a1a" }}>Predicates Queried:</strong>{" "}
442
+ <span style={{ color: "#0066cc", fontWeight: "500" }}>
443
  {message.debug.predicates_queried.join(", ")}
444
  </span>
445
  </div>
 
447
 
448
  {message.debug.queries_executed && message.debug.queries_executed.length > 0 && (
449
  <div style={{ marginBottom: "15px" }}>
450
+ <strong style={{ color: "#1a1a1a" }}>Executed Queries ({message.debug.queries_executed.length}):</strong>
451
+ <ul style={{ marginTop: "5px", paddingLeft: "20px", color: "#1a1a1a" }}>
452
  {message.debug.queries_executed.map((q, idx) => (
453
  <li key={idx} style={{ marginBottom: "5px" }}>
454
  <code style={{
455
  background: "#e8f4f8",
456
  padding: "2px 6px",
457
  borderRadius: "3px",
458
+ fontSize: "0.9em",
459
+ color: "#1a1a1a"
460
  }}>
461
  {q.query}
462
  </code>{" "}
463
+ <span style={{ color: "#333" }}>
464
  β†’ {q.results_count} result{q.results_count !== 1 ? "s" : ""}
465
  </span>
466
  </li>
 
470
  )}
471
 
472
  <div>
473
+ <strong style={{ color: "#1a1a1a" }}>Total Results:</strong>{" "}
474
  <span style={{ color: "#00aa00", fontWeight: "bold" }}>
475
  {message.debug.total_results || 0}
476
  </span>