fraudTech commited on
Commit
1ce3ec0
·
1 Parent(s): 3391a18

move arXiv and story to upload kb

Browse files
Files changed (1) hide show
  1. src/App.js +120 -98
src/App.js CHANGED
@@ -815,17 +815,6 @@ function App() {
815
  </svg>
816
  )}
817
  </button>
818
- <button
819
- className="btn-secondary"
820
- onClick={() => setShowUpload(!showUpload)}
821
- title="Upload KB"
822
- >
823
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
824
- <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
825
- <polyline points="17 8 12 3 7 8"/>
826
- <line x1="12" y1="3" x2="12" y2="15"/>
827
- </svg>
828
- </button>
829
  <button
830
  className="btn-secondary"
831
  onClick={() => setShowQueryPanel(!showQueryPanel)}
@@ -914,38 +903,7 @@ function App() {
914
  </button>
915
  </aside>
916
  )}
917
- {/* Left Sidebar - Upload Panel */}
918
- {showUpload && (
919
- <aside className="sidebar left-sidebar">
920
- <h3>Upload Knowledge Base</h3>
921
- <p style={{ fontSize: "0.9em", color: "#666" }}>
922
- Upload a .pl Prolog file to load into the knowledge base
923
- </p>
924
- <input
925
- type="file"
926
- accept=".pl"
927
- onChange={handleFileUpload}
928
- style={{ marginTop: "10px", marginBottom: "10px" }}
929
- />
930
- {uploadStatus && (
931
- <div className="status-message">{uploadStatus}</div>
932
- )}
933
- <button
934
- onClick={handleLoadMetadata}
935
- style={{ marginTop: "10px", width: "100%" }}
936
- >
937
- Refresh Metadata
938
- </button>
939
- {kbMetadata && (
940
- <div className="metadata-panel" style={{ marginTop: "15px" }}>
941
- <h4>KB Metadata</h4>
942
- <pre style={{ fontSize: "0.85em", overflowX: "auto" }}>
943
- {kbMetadata}
944
- </pre>
945
- </div>
946
- )}
947
- </aside>
948
- )}
949
  {/* Main Chat Area */}
950
  <main className="main">
951
  <div className="messages">
@@ -1076,66 +1034,37 @@ function App() {
1076
  )}
1077
  </aside>
1078
  )}
1079
- {/* Right Sidebar - Session Memory Panel */}
1080
  {showSessionPanel && (
1081
  <aside className="sidebar right-sidebar">
1082
- <h3>Session Memory</h3>
1083
  <p style={{ fontSize: "0.9em", color: "#666" }}>
1084
- Staged validated lemmas for this chat session.
1085
  </p>
1086
  <div style={{ fontSize: "0.85em", color: "#666", wordBreak: "break-all" }}>
1087
  Session ID: {sessionId}
1088
  </div>
1089
- <button
1090
- className="btn-secondary"
1091
- onClick={refreshSessionMemory}
1092
- style={{ marginTop: "10px", width: "100%" }}
1093
- disabled={sessionPanelLoading}
1094
- >
1095
- 🔄 Refresh
1096
- </button>
1097
- <button
1098
- className="btn-secondary"
1099
- onClick={handleDiscoverAndStage}
1100
- style={{ marginTop: "10px", width: "100%" }}
1101
- disabled={sessionPanelLoading}
1102
- >
1103
- Discover (Math) & Stage
1104
- </button>
1105
- <button
1106
- className="btn-secondary"
1107
- onClick={handleClearSessionMemory}
1108
- style={{ marginTop: "10px", width: "100%" }}
1109
- disabled={sessionPanelLoading}
1110
- >
1111
- Clear Session
1112
- </button>
1113
- <button
1114
- className="btn-secondary"
1115
- onClick={handleExportSessionMemory}
1116
- style={{ marginTop: "10px", width: "100%" }}
1117
- disabled={sessionPanelLoading}
1118
- >
1119
- Export Learned Lemmas
1120
- </button>
1121
- <button
1122
- className="btn-secondary"
1123
- onClick={handlePromoteSessionMemory}
1124
- style={{ marginTop: "10px", width: "100%" }}
1125
- disabled={sessionPanelLoading}
1126
- >
1127
- Promote (Bench-Gated)
1128
- </button>
1129
- <button
1130
- className="btn-secondary"
1131
- onClick={handleRollbackPromotion}
1132
- style={{ marginTop: "10px", width: "100%" }}
1133
- disabled={sessionPanelLoading}
1134
- >
1135
- Rollback Last Promotion
1136
- </button>
1137
- <div style={{ marginTop: "15px" }}>
1138
- <h4>Ingest (Stage into session)</h4>
1139
  <input
1140
  type="text"
1141
  placeholder="arXiv id or URL (e.g., 1706.03762)"
@@ -1149,7 +1078,7 @@ function App() {
1149
  style={{ marginTop: "10px", width: "100%" }}
1150
  disabled={sessionPanelLoading}
1151
  >
1152
- Ingest arXiv → Stage
1153
  </button>
1154
  <input
1155
  type="text"
@@ -1164,9 +1093,102 @@ function App() {
1164
  style={{ marginTop: "10px", width: "100%" }}
1165
  disabled={sessionPanelLoading}
1166
  >
1167
- Ingest Story → Stage
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1168
  </button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1169
  </div>
 
1170
  {sessionPanelStatus && (
1171
  <div className="status-message" style={{ marginTop: "10px" }}>
1172
  {sessionPanelStatus}
 
815
  </svg>
816
  )}
817
  </button>
 
 
 
 
 
 
 
 
 
 
 
818
  <button
819
  className="btn-secondary"
820
  onClick={() => setShowQueryPanel(!showQueryPanel)}
 
903
  </button>
904
  </aside>
905
  )}
906
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
907
  {/* Main Chat Area */}
908
  <main className="main">
909
  <div className="messages">
 
1034
  )}
1035
  </aside>
1036
  )}
1037
+ {/* Right Sidebar - Session Data Panel */}
1038
  {showSessionPanel && (
1039
  <aside className="sidebar right-sidebar">
1040
+ <h3>Session Data</h3>
1041
  <p style={{ fontSize: "0.9em", color: "#666" }}>
1042
+ Import data sources for this session (cleared when session ends).
1043
  </p>
1044
  <div style={{ fontSize: "0.85em", color: "#666", wordBreak: "break-all" }}>
1045
  Session ID: {sessionId}
1046
  </div>
1047
+
1048
+ {/* Upload Knowledge Base Section */}
1049
+ <div style={{ marginTop: "15px", paddingTop: "15px", borderTop: "1px solid #333" }}>
1050
+ <h4>Upload Knowledge Base</h4>
1051
+ <p style={{ fontSize: "0.85em", color: "#888" }}>
1052
+ Upload a .pl Prolog file (session-scoped)
1053
+ </p>
1054
+ <input
1055
+ type="file"
1056
+ accept=".pl"
1057
+ onChange={handleFileUpload}
1058
+ style={{ marginTop: "10px", marginBottom: "10px", width: "100%" }}
1059
+ />
1060
+ {uploadStatus && (
1061
+ <div className="status-message">{uploadStatus}</div>
1062
+ )}
1063
+ </div>
1064
+
1065
+ {/* Ingest Documents Section */}
1066
+ <div style={{ marginTop: "15px", paddingTop: "15px", borderTop: "1px solid #333" }}>
1067
+ <h4>Ingest Documents</h4>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1068
  <input
1069
  type="text"
1070
  placeholder="arXiv id or URL (e.g., 1706.03762)"
 
1078
  style={{ marginTop: "10px", width: "100%" }}
1079
  disabled={sessionPanelLoading}
1080
  >
1081
+ Ingest arXiv Paper
1082
  </button>
1083
  <input
1084
  type="text"
 
1093
  style={{ marginTop: "10px", width: "100%" }}
1094
  disabled={sessionPanelLoading}
1095
  >
1096
+ Ingest Story
1097
+ </button>
1098
+ </div>
1099
+
1100
+ {/* Session Actions */}
1101
+ <div style={{ marginTop: "15px", paddingTop: "15px", borderTop: "1px solid #333" }}>
1102
+ <h4>Session Actions</h4>
1103
+ <button
1104
+ className="btn-secondary"
1105
+ onClick={refreshSessionMemory}
1106
+ style={{ marginTop: "10px", width: "100%" }}
1107
+ disabled={sessionPanelLoading}
1108
+ >
1109
+ 🔄 Refresh
1110
+ </button>
1111
+ <button
1112
+ className="btn-secondary"
1113
+ onClick={handleLoadMetadata}
1114
+ style={{ marginTop: "10px", width: "100%" }}
1115
+ >
1116
+ Refresh KB Metadata
1117
+ </button>
1118
+ <button
1119
+ className="btn-secondary"
1120
+ onClick={handleDiscoverAndStage}
1121
+ style={{ marginTop: "10px", width: "100%" }}
1122
+ disabled={sessionPanelLoading}
1123
+ >
1124
+ Discover (Math) & Stage
1125
+ </button>
1126
+ <button
1127
+ className="btn-secondary"
1128
+ onClick={handleClearSessionMemory}
1129
+ style={{ marginTop: "10px", width: "100%" }}
1130
+ disabled={sessionPanelLoading}
1131
+ >
1132
+ Clear Session
1133
+ </button>
1134
+ <button
1135
+ className="btn-secondary"
1136
+ onClick={handleExportSessionMemory}
1137
+ style={{ marginTop: "10px", width: "100%" }}
1138
+ disabled={sessionPanelLoading}
1139
+ >
1140
+ Export Learned Lemmas
1141
  </button>
1142
+ <button
1143
+ className="btn-secondary"
1144
+ onClick={handlePromoteSessionMemory}
1145
+ style={{ marginTop: "10px", width: "100%" }}
1146
+ disabled={sessionPanelLoading}
1147
+ >
1148
+ Promote (Bench-Gated)
1149
+ </button>
1150
+ <button
1151
+ className="btn-secondary"
1152
+ onClick={handleRollbackPromotion}
1153
+ style={{ marginTop: "10px", width: "100%" }}
1154
+ disabled={sessionPanelLoading}
1155
+ >
1156
+ Rollback Last Promotion
1157
+ </button>
1158
+ </div>
1159
+
1160
+ {/* Display Areas */}
1161
+ <div style={{ marginTop: "15px", paddingTop: "15px", borderTop: "1px solid #333" }}>
1162
+ <h4>KB Metadata</h4>
1163
+ {kbMetadata && (
1164
+ <div className="metadata-panel">
1165
+ <div>
1166
+ <strong>Domain:</strong> {kbMetadata.domain_name || "Unknown"}
1167
+ </div>
1168
+ <div>
1169
+ <strong>Domains:</strong> {(kbMetadata.domains || []).length}
1170
+ </div>
1171
+ <div>
1172
+ <strong>Predicates:</strong> {(kbMetadata.predicates || []).length}
1173
+ </div>
1174
+ <div>
1175
+ <strong>Relations:</strong> {(kbMetadata.relations || []).length}
1176
+ </div>
1177
+ <div>
1178
+ <strong>Queryable:</strong> {(kbMetadata.queryable_predicates || []).length}
1179
+ </div>
1180
+ <details style={{ marginTop: "10px" }}>
1181
+ <summary style={{ cursor: "pointer", fontWeight: "bold" }}>
1182
+ Full Metadata
1183
+ </summary>
1184
+ <pre style={{ fontSize: "0.75em", overflowX: "auto", marginTop: "5px" }}>
1185
+ {JSON.stringify(kbMetadata, null, 2)}
1186
+ </pre>
1187
+ </details>
1188
+ </div>
1189
+ )}
1190
  </div>
1191
+
1192
  {sessionPanelStatus && (
1193
  <div className="status-message" style={{ marginTop: "10px" }}>
1194
  {sessionPanelStatus}