Spaces:
Sleeping
Sleeping
replace emojis
Browse files- src/App.js +59 -25
src/App.js
CHANGED
|
@@ -600,28 +600,47 @@ function App() {
|
|
| 600 |
onClick={handleNewChat}
|
| 601 |
title="New Chat Session"
|
| 602 |
>
|
| 603 |
-
|
|
|
|
|
|
|
| 604 |
</button>
|
| 605 |
<button
|
| 606 |
className="strict-toggle-btn"
|
| 607 |
onClick={() => setStrictMode(!strictMode)}
|
| 608 |
title={strictMode ? "Strict KB Mode (click to disable)" : "Flexible Mode (click to enable strict mode)"}
|
| 609 |
>
|
| 610 |
-
{strictMode ?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 611 |
</button>
|
| 612 |
<button
|
| 613 |
className="btn-secondary"
|
| 614 |
onClick={() => setShowUpload(!showUpload)}
|
| 615 |
title="Upload KB"
|
| 616 |
>
|
| 617 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 618 |
</button>
|
| 619 |
<button
|
| 620 |
className="btn-secondary"
|
| 621 |
onClick={() => setShowQueryPanel(!showQueryPanel)}
|
| 622 |
title="Query KB"
|
| 623 |
>
|
| 624 |
-
|
|
|
|
|
|
|
|
|
|
| 625 |
</button>
|
| 626 |
<button
|
| 627 |
className="btn-secondary"
|
|
@@ -632,7 +651,11 @@ function App() {
|
|
| 632 |
}}
|
| 633 |
title="Session Memory"
|
| 634 |
>
|
| 635 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 636 |
</button>
|
| 637 |
{me && me.is_admin && (
|
| 638 |
<button
|
|
@@ -643,7 +666,10 @@ function App() {
|
|
| 643 |
}}
|
| 644 |
title="Register User"
|
| 645 |
>
|
| 646 |
-
|
|
|
|
|
|
|
|
|
|
| 647 |
</button>
|
| 648 |
)}
|
| 649 |
<button
|
|
@@ -659,7 +685,11 @@ function App() {
|
|
| 659 |
}}
|
| 660 |
title="Logout"
|
| 661 |
>
|
| 662 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 663 |
</button>
|
| 664 |
</div>
|
| 665 |
</header>
|
|
@@ -667,7 +697,7 @@ function App() {
|
|
| 667 |
{/* Left Sidebar - Upload Panel */}
|
| 668 |
{showUpload && (
|
| 669 |
<aside className="sidebar left-sidebar">
|
| 670 |
-
<h3>
|
| 671 |
<p style={{ fontSize: "0.9em", color: "#666" }}>
|
| 672 |
Upload a .pl Prolog file to load into the knowledge base
|
| 673 |
</p>
|
|
@@ -684,11 +714,11 @@ function App() {
|
|
| 684 |
onClick={handleLoadMetadata}
|
| 685 |
style={{ marginTop: "10px", width: "100%" }}
|
| 686 |
>
|
| 687 |
-
|
| 688 |
</button>
|
| 689 |
{kbMetadata && (
|
| 690 |
<div className="metadata-panel" style={{ marginTop: "15px" }}>
|
| 691 |
-
<h4>
|
| 692 |
<pre style={{ fontSize: "0.85em", overflowX: "auto" }}>
|
| 693 |
{kbMetadata}
|
| 694 |
</pre>
|
|
@@ -719,14 +749,18 @@ function App() {
|
|
| 719 |
rows="2"
|
| 720 |
/>
|
| 721 |
<button type="submit" disabled={loading || !input.trim()}>
|
| 722 |
-
{loading ?
|
|
|
|
|
|
|
|
|
|
|
|
|
| 723 |
</button>
|
| 724 |
</form>
|
| 725 |
</main>
|
| 726 |
{/* Right Sidebar - Direct Query Panel */}
|
| 727 |
{showQueryPanel && (
|
| 728 |
<aside className="sidebar right-sidebar">
|
| 729 |
-
<h3>
|
| 730 |
<p style={{ fontSize: "0.9em", color: "#666" }}>
|
| 731 |
Execute raw Prolog queries directly
|
| 732 |
</p>
|
|
@@ -747,7 +781,7 @@ function App() {
|
|
| 747 |
style={{ marginTop: "10px", width: "100%" }}
|
| 748 |
disabled={proofLoading}
|
| 749 |
>
|
| 750 |
-
{proofLoading ? "
|
| 751 |
</button>
|
| 752 |
</form>
|
| 753 |
{queryResults && (
|
|
@@ -776,7 +810,7 @@ function App() {
|
|
| 776 |
{/* Right Sidebar - Admin Register Panel */}
|
| 777 |
{showRegisterPanel && me && me.is_admin && (
|
| 778 |
<aside className="sidebar right-sidebar">
|
| 779 |
-
<h3>
|
| 780 |
<p style={{ fontSize: "0.9em", color: "#666" }}>
|
| 781 |
Create a new user account (admin only)
|
| 782 |
</p>
|
|
@@ -817,7 +851,7 @@ function App() {
|
|
| 817 |
{/* Right Sidebar - Session Memory Panel */}
|
| 818 |
{showSessionPanel && (
|
| 819 |
<aside className="sidebar right-sidebar">
|
| 820 |
-
<h3>
|
| 821 |
<p style={{ fontSize: "0.9em", color: "#666" }}>
|
| 822 |
Staged validated lemmas for this chat session.
|
| 823 |
</p>
|
|
@@ -838,7 +872,7 @@ function App() {
|
|
| 838 |
style={{ marginTop: "10px", width: "100%" }}
|
| 839 |
disabled={sessionPanelLoading}
|
| 840 |
>
|
| 841 |
-
|
| 842 |
</button>
|
| 843 |
<button
|
| 844 |
className="btn-secondary"
|
|
@@ -846,7 +880,7 @@ function App() {
|
|
| 846 |
style={{ marginTop: "10px", width: "100%" }}
|
| 847 |
disabled={sessionPanelLoading}
|
| 848 |
>
|
| 849 |
-
|
| 850 |
</button>
|
| 851 |
<button
|
| 852 |
className="btn-secondary"
|
|
@@ -854,7 +888,7 @@ function App() {
|
|
| 854 |
style={{ marginTop: "10px", width: "100%" }}
|
| 855 |
disabled={sessionPanelLoading}
|
| 856 |
>
|
| 857 |
-
|
| 858 |
</button>
|
| 859 |
<button
|
| 860 |
className="btn-secondary"
|
|
@@ -862,7 +896,7 @@ function App() {
|
|
| 862 |
style={{ marginTop: "10px", width: "100%" }}
|
| 863 |
disabled={sessionPanelLoading}
|
| 864 |
>
|
| 865 |
-
|
| 866 |
</button>
|
| 867 |
<button
|
| 868 |
className="btn-secondary"
|
|
@@ -870,10 +904,10 @@ function App() {
|
|
| 870 |
style={{ marginTop: "10px", width: "100%" }}
|
| 871 |
disabled={sessionPanelLoading}
|
| 872 |
>
|
| 873 |
-
|
| 874 |
</button>
|
| 875 |
<div style={{ marginTop: "15px" }}>
|
| 876 |
-
<h4>
|
| 877 |
<input
|
| 878 |
type="text"
|
| 879 |
placeholder="arXiv id or URL (e.g., 1706.03762)"
|
|
@@ -887,7 +921,7 @@ function App() {
|
|
| 887 |
style={{ marginTop: "10px", width: "100%" }}
|
| 888 |
disabled={sessionPanelLoading}
|
| 889 |
>
|
| 890 |
-
|
| 891 |
</button>
|
| 892 |
<input
|
| 893 |
type="text"
|
|
@@ -902,7 +936,7 @@ function App() {
|
|
| 902 |
style={{ marginTop: "10px", width: "100%" }}
|
| 903 |
disabled={sessionPanelLoading}
|
| 904 |
>
|
| 905 |
-
|
| 906 |
</button>
|
| 907 |
</div>
|
| 908 |
{sessionPanelStatus && (
|
|
@@ -988,7 +1022,7 @@ function Message({ message }) {
|
|
| 988 |
cursor: "pointer"
|
| 989 |
}}
|
| 990 |
>
|
| 991 |
-
{showDebug ? "
|
| 992 |
</button>
|
| 993 |
{showDebug && (
|
| 994 |
<div className="debug-panel" style={{
|
|
@@ -1000,7 +1034,7 @@ function Message({ message }) {
|
|
| 1000 |
fontSize: "0.9em",
|
| 1001 |
color: "#1a1a1a"
|
| 1002 |
}}>
|
| 1003 |
-
<h4 style={{ marginTop: 0, marginBottom: "10px", color: "#1a1a1a" }}>
|
| 1004 |
{message.debug.llm_analysis && (
|
| 1005 |
<div style={{ marginBottom: "15px" }}>
|
| 1006 |
<strong style={{ color: "#1a1a1a" }}>Generated Queries:</strong>
|
|
|
|
| 600 |
onClick={handleNewChat}
|
| 601 |
title="New Chat Session"
|
| 602 |
>
|
| 603 |
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
| 604 |
+
<path d="M12 5v14M5 12h14"/>
|
| 605 |
+
</svg>
|
| 606 |
</button>
|
| 607 |
<button
|
| 608 |
className="strict-toggle-btn"
|
| 609 |
onClick={() => setStrictMode(!strictMode)}
|
| 610 |
title={strictMode ? "Strict KB Mode (click to disable)" : "Flexible Mode (click to enable strict mode)"}
|
| 611 |
>
|
| 612 |
+
{strictMode ? (
|
| 613 |
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
| 614 |
+
<rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
|
| 615 |
+
<path d="M7 11V7a5 5 0 0 1 10 0v4"/>
|
| 616 |
+
</svg>
|
| 617 |
+
) : (
|
| 618 |
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
| 619 |
+
<rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
|
| 620 |
+
<path d="M7 11V7a5 5 0 0 1 9.9-1"/>
|
| 621 |
+
</svg>
|
| 622 |
+
)}
|
| 623 |
</button>
|
| 624 |
<button
|
| 625 |
className="btn-secondary"
|
| 626 |
onClick={() => setShowUpload(!showUpload)}
|
| 627 |
title="Upload KB"
|
| 628 |
>
|
| 629 |
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
| 630 |
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
| 631 |
+
<polyline points="17 8 12 3 7 8"/>
|
| 632 |
+
<line x1="12" y1="3" x2="12" y2="15"/>
|
| 633 |
+
</svg>
|
| 634 |
</button>
|
| 635 |
<button
|
| 636 |
className="btn-secondary"
|
| 637 |
onClick={() => setShowQueryPanel(!showQueryPanel)}
|
| 638 |
title="Query KB"
|
| 639 |
>
|
| 640 |
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
| 641 |
+
<circle cx="11" cy="11" r="8"/>
|
| 642 |
+
<path d="m21 21-4.35-4.35"/>
|
| 643 |
+
</svg>
|
| 644 |
</button>
|
| 645 |
<button
|
| 646 |
className="btn-secondary"
|
|
|
|
| 651 |
}}
|
| 652 |
title="Session Memory"
|
| 653 |
>
|
| 654 |
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
| 655 |
+
<ellipse cx="12" cy="5" rx="9" ry="3"/>
|
| 656 |
+
<path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/>
|
| 657 |
+
<path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/>
|
| 658 |
+
</svg>
|
| 659 |
</button>
|
| 660 |
{me && me.is_admin && (
|
| 661 |
<button
|
|
|
|
| 666 |
}}
|
| 667 |
title="Register User"
|
| 668 |
>
|
| 669 |
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
| 670 |
+
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/>
|
| 671 |
+
<circle cx="12" cy="7" r="4"/>
|
| 672 |
+
</svg>
|
| 673 |
</button>
|
| 674 |
)}
|
| 675 |
<button
|
|
|
|
| 685 |
}}
|
| 686 |
title="Logout"
|
| 687 |
>
|
| 688 |
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
| 689 |
+
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/>
|
| 690 |
+
<polyline points="16 17 21 12 16 7"/>
|
| 691 |
+
<line x1="21" y1="12" x2="9" y2="12"/>
|
| 692 |
+
</svg>
|
| 693 |
</button>
|
| 694 |
</div>
|
| 695 |
</header>
|
|
|
|
| 697 |
{/* Left Sidebar - Upload Panel */}
|
| 698 |
{showUpload && (
|
| 699 |
<aside className="sidebar left-sidebar">
|
| 700 |
+
<h3>Upload Knowledge Base</h3>
|
| 701 |
<p style={{ fontSize: "0.9em", color: "#666" }}>
|
| 702 |
Upload a .pl Prolog file to load into the knowledge base
|
| 703 |
</p>
|
|
|
|
| 714 |
onClick={handleLoadMetadata}
|
| 715 |
style={{ marginTop: "10px", width: "100%" }}
|
| 716 |
>
|
| 717 |
+
Refresh Metadata
|
| 718 |
</button>
|
| 719 |
{kbMetadata && (
|
| 720 |
<div className="metadata-panel" style={{ marginTop: "15px" }}>
|
| 721 |
+
<h4>KB Metadata</h4>
|
| 722 |
<pre style={{ fontSize: "0.85em", overflowX: "auto" }}>
|
| 723 |
{kbMetadata}
|
| 724 |
</pre>
|
|
|
|
| 749 |
rows="2"
|
| 750 |
/>
|
| 751 |
<button type="submit" disabled={loading || !input.trim()}>
|
| 752 |
+
{loading ? (
|
| 753 |
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" style={{ animation: "spin 1s linear infinite" }}>
|
| 754 |
+
<path d="M21 12a9 9 0 1 1-6.219-8.56"/>
|
| 755 |
+
</svg>
|
| 756 |
+
) : "Send"}
|
| 757 |
</button>
|
| 758 |
</form>
|
| 759 |
</main>
|
| 760 |
{/* Right Sidebar - Direct Query Panel */}
|
| 761 |
{showQueryPanel && (
|
| 762 |
<aside className="sidebar right-sidebar">
|
| 763 |
+
<h3>Direct Prolog Query</h3>
|
| 764 |
<p style={{ fontSize: "0.9em", color: "#666" }}>
|
| 765 |
Execute raw Prolog queries directly
|
| 766 |
</p>
|
|
|
|
| 781 |
style={{ marginTop: "10px", width: "100%" }}
|
| 782 |
disabled={proofLoading}
|
| 783 |
>
|
| 784 |
+
{proofLoading ? "Proving..." : "Prove Goal (Trace)"}
|
| 785 |
</button>
|
| 786 |
</form>
|
| 787 |
{queryResults && (
|
|
|
|
| 810 |
{/* Right Sidebar - Admin Register Panel */}
|
| 811 |
{showRegisterPanel && me && me.is_admin && (
|
| 812 |
<aside className="sidebar right-sidebar">
|
| 813 |
+
<h3>Register User</h3>
|
| 814 |
<p style={{ fontSize: "0.9em", color: "#666" }}>
|
| 815 |
Create a new user account (admin only)
|
| 816 |
</p>
|
|
|
|
| 851 |
{/* Right Sidebar - Session Memory Panel */}
|
| 852 |
{showSessionPanel && (
|
| 853 |
<aside className="sidebar right-sidebar">
|
| 854 |
+
<h3>Session Memory</h3>
|
| 855 |
<p style={{ fontSize: "0.9em", color: "#666" }}>
|
| 856 |
Staged validated lemmas for this chat session.
|
| 857 |
</p>
|
|
|
|
| 872 |
style={{ marginTop: "10px", width: "100%" }}
|
| 873 |
disabled={sessionPanelLoading}
|
| 874 |
>
|
| 875 |
+
Discover (Math) & Stage
|
| 876 |
</button>
|
| 877 |
<button
|
| 878 |
className="btn-secondary"
|
|
|
|
| 880 |
style={{ marginTop: "10px", width: "100%" }}
|
| 881 |
disabled={sessionPanelLoading}
|
| 882 |
>
|
| 883 |
+
Clear Session
|
| 884 |
</button>
|
| 885 |
<button
|
| 886 |
className="btn-secondary"
|
|
|
|
| 888 |
style={{ marginTop: "10px", width: "100%" }}
|
| 889 |
disabled={sessionPanelLoading}
|
| 890 |
>
|
| 891 |
+
Export Learned Lemmas
|
| 892 |
</button>
|
| 893 |
<button
|
| 894 |
className="btn-secondary"
|
|
|
|
| 896 |
style={{ marginTop: "10px", width: "100%" }}
|
| 897 |
disabled={sessionPanelLoading}
|
| 898 |
>
|
| 899 |
+
Promote (Bench-Gated)
|
| 900 |
</button>
|
| 901 |
<button
|
| 902 |
className="btn-secondary"
|
|
|
|
| 904 |
style={{ marginTop: "10px", width: "100%" }}
|
| 905 |
disabled={sessionPanelLoading}
|
| 906 |
>
|
| 907 |
+
Rollback Last Promotion
|
| 908 |
</button>
|
| 909 |
<div style={{ marginTop: "15px" }}>
|
| 910 |
+
<h4>Ingest (Stage into session)</h4>
|
| 911 |
<input
|
| 912 |
type="text"
|
| 913 |
placeholder="arXiv id or URL (e.g., 1706.03762)"
|
|
|
|
| 921 |
style={{ marginTop: "10px", width: "100%" }}
|
| 922 |
disabled={sessionPanelLoading}
|
| 923 |
>
|
| 924 |
+
Ingest arXiv → Stage
|
| 925 |
</button>
|
| 926 |
<input
|
| 927 |
type="text"
|
|
|
|
| 936 |
style={{ marginTop: "10px", width: "100%" }}
|
| 937 |
disabled={sessionPanelLoading}
|
| 938 |
>
|
| 939 |
+
Ingest Story → Stage
|
| 940 |
</button>
|
| 941 |
</div>
|
| 942 |
{sessionPanelStatus && (
|
|
|
|
| 1022 |
cursor: "pointer"
|
| 1023 |
}}
|
| 1024 |
>
|
| 1025 |
+
{showDebug ? "Hide Prolog Queries" : "Show Prolog Queries"}
|
| 1026 |
</button>
|
| 1027 |
{showDebug && (
|
| 1028 |
<div className="debug-panel" style={{
|
|
|
|
| 1034 |
fontSize: "0.9em",
|
| 1035 |
color: "#1a1a1a"
|
| 1036 |
}}>
|
| 1037 |
+
<h4 style={{ marginTop: 0, marginBottom: "10px", color: "#1a1a1a" }}>Prolog Query Analysis</h4>
|
| 1038 |
{message.debug.llm_analysis && (
|
| 1039 |
<div style={{ marginBottom: "15px" }}>
|
| 1040 |
<strong style={{ color: "#1a1a1a" }}>Generated Queries:</strong>
|