Spaces:
Sleeping
Sleeping
added expanders for debug info
Browse files- src/App.js +84 -34
src/App.js
CHANGED
|
@@ -170,6 +170,55 @@ function normalizeLatex(text) {
|
|
| 170 |
return normalized;
|
| 171 |
}
|
| 172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
function App() {
|
| 174 |
// ---------------------------
|
| 175 |
// Random Logic Saying
|
|
@@ -1237,32 +1286,33 @@ function Message({ message }) {
|
|
| 1237 |
color: "#1a1a1a"
|
| 1238 |
}}>
|
| 1239 |
<h4 style={{ marginTop: 0, marginBottom: "10px", color: "#1a1a1a" }}>Prolog Query Analysis</h4>
|
|
|
|
| 1240 |
{message.debug.llm_analysis && (
|
| 1241 |
-
<
|
| 1242 |
-
<strong style={{ color: "#1a1a1a" }}>Generated Queries:</strong>
|
| 1243 |
<pre style={{
|
| 1244 |
background: "#fff",
|
| 1245 |
padding: "8px",
|
| 1246 |
borderRadius: "4px",
|
| 1247 |
fontSize: "0.9em",
|
| 1248 |
overflowX: "auto",
|
| 1249 |
-
color: "#1a1a1a"
|
|
|
|
| 1250 |
}}>
|
| 1251 |
{stripMarkdownFences(message.debug.llm_analysis)}
|
| 1252 |
</pre>
|
| 1253 |
-
</
|
| 1254 |
)}
|
|
|
|
| 1255 |
{message.debug.predicates_queried && message.debug.predicates_queried.length > 0 && (
|
| 1256 |
-
<
|
| 1257 |
-
<strong style={{ color: "#1a1a1a" }}>Predicates Queried:</strong>{" "}
|
| 1258 |
<span style={{ color: "#0066cc", fontWeight: "500" }}>
|
| 1259 |
{message.debug.predicates_queried.join(", ")}
|
| 1260 |
</span>
|
| 1261 |
-
</
|
| 1262 |
)}
|
|
|
|
| 1263 |
{Array.isArray(message.debug.dropped_calls) && message.debug.dropped_calls.length > 0 && (
|
| 1264 |
-
<
|
| 1265 |
-
<strong style={{ color: "#1a1a1a" }}>Dropped Tool Calls:</strong>
|
| 1266 |
<pre style={{
|
| 1267 |
background: "#fff",
|
| 1268 |
padding: "8px",
|
|
@@ -1270,15 +1320,16 @@ function Message({ message }) {
|
|
| 1270 |
fontSize: "0.85em",
|
| 1271 |
overflowX: "auto",
|
| 1272 |
color: "#1a1a1a",
|
| 1273 |
-
border: "1px solid #e2e2e2"
|
|
|
|
| 1274 |
}}>
|
| 1275 |
{JSON.stringify(message.debug.dropped_calls, null, 2)}
|
| 1276 |
</pre>
|
| 1277 |
-
</
|
| 1278 |
)}
|
|
|
|
| 1279 |
{Array.isArray(message.debug.tool_calls_proof_retry) && message.debug.tool_calls_proof_retry.length > 0 && (
|
| 1280 |
-
<
|
| 1281 |
-
<strong style={{ color: "#1a1a1a" }}>Proof Retry Tool Calls:</strong>
|
| 1282 |
<pre style={{
|
| 1283 |
background: "#fff",
|
| 1284 |
padding: "8px",
|
|
@@ -1286,16 +1337,17 @@ function Message({ message }) {
|
|
| 1286 |
fontSize: "0.85em",
|
| 1287 |
overflowX: "auto",
|
| 1288 |
color: "#1a1a1a",
|
| 1289 |
-
border: "1px solid #e2e2e2"
|
|
|
|
| 1290 |
}}>
|
| 1291 |
{JSON.stringify(message.debug.tool_calls_proof_retry, null, 2)}
|
| 1292 |
</pre>
|
| 1293 |
-
</
|
| 1294 |
)}
|
|
|
|
| 1295 |
{message.debug.predicate_docs && message.debug.predicate_docs.length > 0 && (
|
| 1296 |
-
<
|
| 1297 |
-
<
|
| 1298 |
-
<ul style={{ marginTop: "8px", paddingLeft: "20px", color: "#1a1a1a" }}>
|
| 1299 |
{message.debug.predicate_docs.map((p, idx) => {
|
| 1300 |
const sig = p && (p.signature || p.predicate) ? String(p.signature || p.predicate) : "";
|
| 1301 |
const doc = p && p.doc ? String(p.doc) : "";
|
|
@@ -1323,12 +1375,12 @@ function Message({ message }) {
|
|
| 1323 |
);
|
| 1324 |
})}
|
| 1325 |
</ul>
|
| 1326 |
-
</
|
| 1327 |
)}
|
|
|
|
| 1328 |
{message.debug.queries_executed && message.debug.queries_executed.length > 0 && (
|
| 1329 |
-
<
|
| 1330 |
-
<
|
| 1331 |
-
<ul style={{ marginTop: "5px", paddingLeft: "20px", color: "#1a1a1a" }}>
|
| 1332 |
{message.debug.queries_executed.map((q, idx) => (
|
| 1333 |
<li key={idx} style={{ marginBottom: "5px" }}>
|
| 1334 |
<code style={{
|
|
@@ -1346,18 +1398,15 @@ function Message({ message }) {
|
|
| 1346 |
</li>
|
| 1347 |
))}
|
| 1348 |
</ul>
|
| 1349 |
-
</
|
| 1350 |
)}
|
|
|
|
| 1351 |
{message.debug.evidence && (
|
| 1352 |
-
<
|
| 1353 |
-
<
|
| 1354 |
-
<div style={{ marginTop: "6px", color: "#1a1a1a" }}>
|
| 1355 |
-
<div>
|
| 1356 |
-
Facts: <span style={{ fontWeight: "bold" }}>{(message.debug.evidence.facts || []).length}</span>
|
| 1357 |
-
</div>
|
| 1358 |
{message.debug.evidence.fact_bindings && (
|
| 1359 |
-
<div style={{
|
| 1360 |
-
Structured bindings:{" "}
|
| 1361 |
<span style={{ fontWeight: "bold" }}>
|
| 1362 |
{(message.debug.evidence.fact_bindings || []).length}
|
| 1363 |
</span>
|
|
@@ -1378,7 +1427,7 @@ function Message({ message }) {
|
|
| 1378 |
)}
|
| 1379 |
{message.debug.evidence.citations && message.debug.evidence.citations.length > 0 && (
|
| 1380 |
<div style={{ marginTop: "8px" }}>
|
| 1381 |
-
<div style={{ fontWeight: "600" }}>Citations:</div>
|
| 1382 |
<ul style={{ marginTop: "5px", paddingLeft: "20px" }}>
|
| 1383 |
{message.debug.evidence.citations.map((c, idx) => (
|
| 1384 |
<li key={idx} style={{ marginBottom: "4px" }}>
|
|
@@ -1417,9 +1466,10 @@ function Message({ message }) {
|
|
| 1417 |
</div>
|
| 1418 |
)}
|
| 1419 |
</div>
|
| 1420 |
-
</
|
| 1421 |
)}
|
| 1422 |
-
|
|
|
|
| 1423 |
<strong style={{ color: "#1a1a1a" }}>Total Results:</strong>{" "}
|
| 1424 |
<span style={{ color: "#00aa00", fontWeight: "bold" }}>
|
| 1425 |
{message.debug.total_results || 0}
|
|
|
|
| 170 |
return normalized;
|
| 171 |
}
|
| 172 |
|
| 173 |
+
// DebugExpander component for collapsible debug sections
|
| 174 |
+
function DebugExpander({ title, defaultOpen = false, children }) {
|
| 175 |
+
const [isOpen, setIsOpen] = useState(defaultOpen);
|
| 176 |
+
|
| 177 |
+
return (
|
| 178 |
+
<div style={{ marginBottom: "12px" }}>
|
| 179 |
+
<button
|
| 180 |
+
onClick={() => setIsOpen(!isOpen)}
|
| 181 |
+
style={{
|
| 182 |
+
width: "100%",
|
| 183 |
+
textAlign: "left",
|
| 184 |
+
padding: "8px 12px",
|
| 185 |
+
background: isOpen ? "#e8f4f8" : "#fff",
|
| 186 |
+
border: "1px solid #ccc",
|
| 187 |
+
borderRadius: "4px",
|
| 188 |
+
cursor: "pointer",
|
| 189 |
+
display: "flex",
|
| 190 |
+
alignItems: "center",
|
| 191 |
+
justifyContent: "space-between",
|
| 192 |
+
fontWeight: "600",
|
| 193 |
+
color: "#1a1a1a",
|
| 194 |
+
fontSize: "0.9em"
|
| 195 |
+
}}
|
| 196 |
+
>
|
| 197 |
+
<span>{title}</span>
|
| 198 |
+
<span style={{
|
| 199 |
+
fontSize: "1.2em",
|
| 200 |
+
transform: isOpen ? "rotate(90deg)" : "rotate(0deg)",
|
| 201 |
+
transition: "transform 0.2s",
|
| 202 |
+
display: "inline-block"
|
| 203 |
+
}}>
|
| 204 |
+
▶
|
| 205 |
+
</span>
|
| 206 |
+
</button>
|
| 207 |
+
{isOpen && (
|
| 208 |
+
<div style={{
|
| 209 |
+
marginTop: "8px",
|
| 210 |
+
padding: "10px",
|
| 211 |
+
background: "#fff",
|
| 212 |
+
border: "1px solid #e2e2e2",
|
| 213 |
+
borderRadius: "4px"
|
| 214 |
+
}}>
|
| 215 |
+
{children}
|
| 216 |
+
</div>
|
| 217 |
+
)}
|
| 218 |
+
</div>
|
| 219 |
+
);
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
function App() {
|
| 223 |
// ---------------------------
|
| 224 |
// Random Logic Saying
|
|
|
|
| 1286 |
color: "#1a1a1a"
|
| 1287 |
}}>
|
| 1288 |
<h4 style={{ marginTop: 0, marginBottom: "10px", color: "#1a1a1a" }}>Prolog Query Analysis</h4>
|
| 1289 |
+
|
| 1290 |
{message.debug.llm_analysis && (
|
| 1291 |
+
<DebugExpander title="Generated Queries" defaultOpen={false}>
|
|
|
|
| 1292 |
<pre style={{
|
| 1293 |
background: "#fff",
|
| 1294 |
padding: "8px",
|
| 1295 |
borderRadius: "4px",
|
| 1296 |
fontSize: "0.9em",
|
| 1297 |
overflowX: "auto",
|
| 1298 |
+
color: "#1a1a1a",
|
| 1299 |
+
margin: 0
|
| 1300 |
}}>
|
| 1301 |
{stripMarkdownFences(message.debug.llm_analysis)}
|
| 1302 |
</pre>
|
| 1303 |
+
</DebugExpander>
|
| 1304 |
)}
|
| 1305 |
+
|
| 1306 |
{message.debug.predicates_queried && message.debug.predicates_queried.length > 0 && (
|
| 1307 |
+
<DebugExpander title={`Predicates Queried (${message.debug.predicates_queried.length})`} defaultOpen={false}>
|
|
|
|
| 1308 |
<span style={{ color: "#0066cc", fontWeight: "500" }}>
|
| 1309 |
{message.debug.predicates_queried.join(", ")}
|
| 1310 |
</span>
|
| 1311 |
+
</DebugExpander>
|
| 1312 |
)}
|
| 1313 |
+
|
| 1314 |
{Array.isArray(message.debug.dropped_calls) && message.debug.dropped_calls.length > 0 && (
|
| 1315 |
+
<DebugExpander title={`Dropped Tool Calls (${message.debug.dropped_calls.length})`} defaultOpen={false}>
|
|
|
|
| 1316 |
<pre style={{
|
| 1317 |
background: "#fff",
|
| 1318 |
padding: "8px",
|
|
|
|
| 1320 |
fontSize: "0.85em",
|
| 1321 |
overflowX: "auto",
|
| 1322 |
color: "#1a1a1a",
|
| 1323 |
+
border: "1px solid #e2e2e2",
|
| 1324 |
+
margin: 0
|
| 1325 |
}}>
|
| 1326 |
{JSON.stringify(message.debug.dropped_calls, null, 2)}
|
| 1327 |
</pre>
|
| 1328 |
+
</DebugExpander>
|
| 1329 |
)}
|
| 1330 |
+
|
| 1331 |
{Array.isArray(message.debug.tool_calls_proof_retry) && message.debug.tool_calls_proof_retry.length > 0 && (
|
| 1332 |
+
<DebugExpander title={`Proof Retry Tool Calls (${message.debug.tool_calls_proof_retry.length})`} defaultOpen={false}>
|
|
|
|
| 1333 |
<pre style={{
|
| 1334 |
background: "#fff",
|
| 1335 |
padding: "8px",
|
|
|
|
| 1337 |
fontSize: "0.85em",
|
| 1338 |
overflowX: "auto",
|
| 1339 |
color: "#1a1a1a",
|
| 1340 |
+
border: "1px solid #e2e2e2",
|
| 1341 |
+
margin: 0
|
| 1342 |
}}>
|
| 1343 |
{JSON.stringify(message.debug.tool_calls_proof_retry, null, 2)}
|
| 1344 |
</pre>
|
| 1345 |
+
</DebugExpander>
|
| 1346 |
)}
|
| 1347 |
+
|
| 1348 |
{message.debug.predicate_docs && message.debug.predicate_docs.length > 0 && (
|
| 1349 |
+
<DebugExpander title={`Predicate Descriptions (${message.debug.predicate_docs.length})`} defaultOpen={false}>
|
| 1350 |
+
<ul style={{ marginTop: "8px", paddingLeft: "20px", color: "#1a1a1a", marginBottom: 0 }}>
|
|
|
|
| 1351 |
{message.debug.predicate_docs.map((p, idx) => {
|
| 1352 |
const sig = p && (p.signature || p.predicate) ? String(p.signature || p.predicate) : "";
|
| 1353 |
const doc = p && p.doc ? String(p.doc) : "";
|
|
|
|
| 1375 |
);
|
| 1376 |
})}
|
| 1377 |
</ul>
|
| 1378 |
+
</DebugExpander>
|
| 1379 |
)}
|
| 1380 |
+
|
| 1381 |
{message.debug.queries_executed && message.debug.queries_executed.length > 0 && (
|
| 1382 |
+
<DebugExpander title={`Executed Queries (${message.debug.queries_executed.length})`} defaultOpen={false}>
|
| 1383 |
+
<ul style={{ marginTop: "5px", paddingLeft: "20px", color: "#1a1a1a", marginBottom: 0 }}>
|
|
|
|
| 1384 |
{message.debug.queries_executed.map((q, idx) => (
|
| 1385 |
<li key={idx} style={{ marginBottom: "5px" }}>
|
| 1386 |
<code style={{
|
|
|
|
| 1398 |
</li>
|
| 1399 |
))}
|
| 1400 |
</ul>
|
| 1401 |
+
</DebugExpander>
|
| 1402 |
)}
|
| 1403 |
+
|
| 1404 |
{message.debug.evidence && (
|
| 1405 |
+
<DebugExpander title={`Evidence (${(message.debug.evidence.facts || []).length} facts)`} defaultOpen={false}>
|
| 1406 |
+
<div style={{ color: "#1a1a1a" }}>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1407 |
{message.debug.evidence.fact_bindings && (
|
| 1408 |
+
<div style={{ marginBottom: "10px" }}>
|
| 1409 |
+
<strong>Structured bindings:</strong>{" "}
|
| 1410 |
<span style={{ fontWeight: "bold" }}>
|
| 1411 |
{(message.debug.evidence.fact_bindings || []).length}
|
| 1412 |
</span>
|
|
|
|
| 1427 |
)}
|
| 1428 |
{message.debug.evidence.citations && message.debug.evidence.citations.length > 0 && (
|
| 1429 |
<div style={{ marginTop: "8px" }}>
|
| 1430 |
+
<div style={{ fontWeight: "600" }}>Citations ({message.debug.evidence.citations.length}):</div>
|
| 1431 |
<ul style={{ marginTop: "5px", paddingLeft: "20px" }}>
|
| 1432 |
{message.debug.evidence.citations.map((c, idx) => (
|
| 1433 |
<li key={idx} style={{ marginBottom: "4px" }}>
|
|
|
|
| 1466 |
</div>
|
| 1467 |
)}
|
| 1468 |
</div>
|
| 1469 |
+
</DebugExpander>
|
| 1470 |
)}
|
| 1471 |
+
|
| 1472 |
+
<div style={{ marginTop: "10px", paddingTop: "10px", borderTop: "1px solid #ddd" }}>
|
| 1473 |
<strong style={{ color: "#1a1a1a" }}>Total Results:</strong>{" "}
|
| 1474 |
<span style={{ color: "#00aa00", fontWeight: "bold" }}>
|
| 1475 |
{message.debug.total_results || 0}
|