Spaces:
Running
Running
Update index.html
Browse files- index.html +13 -2
index.html
CHANGED
|
@@ -1042,7 +1042,7 @@
|
|
| 1042 |
|
| 1043 |
updatePapersList();
|
| 1044 |
updateStatus();
|
| 1045 |
-
addBotMessage(`✅ Welcome back! Restored all
|
| 1046 |
} else if (userData.papers && userData.papers.length > 0) {
|
| 1047 |
// Fallback to old format for backward compatibility
|
| 1048 |
papers = userData.papers.map((title, index) => ({
|
|
@@ -1460,9 +1460,20 @@
|
|
| 1460 |
return;
|
| 1461 |
}
|
| 1462 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1463 |
setStatus('processing', 'Loading references...(might take longer)');
|
| 1464 |
const formData = new FormData();
|
| 1465 |
-
formData.append("index",
|
| 1466 |
|
| 1467 |
try {
|
| 1468 |
const res = await makeAuthenticatedRequest(`${API_BASE}/add_references/`, {
|
|
|
|
| 1042 |
|
| 1043 |
updatePapersList();
|
| 1044 |
updateStatus();
|
| 1045 |
+
addBotMessage(`✅ Welcome back! Restored all paper(s) from your previous session.`);
|
| 1046 |
} else if (userData.papers && userData.papers.length > 0) {
|
| 1047 |
// Fallback to old format for backward compatibility
|
| 1048 |
papers = userData.papers.map((title, index) => ({
|
|
|
|
| 1460 |
return;
|
| 1461 |
}
|
| 1462 |
|
| 1463 |
+
// Calculate the backend index by counting only main papers (not reference papers) before this one
|
| 1464 |
+
let backendIndex = 0;
|
| 1465 |
+
for (let i = 0; i < paperIndex; i++) {
|
| 1466 |
+
if (!papers[i].isReference) {
|
| 1467 |
+
backendIndex++;
|
| 1468 |
+
}
|
| 1469 |
+
}
|
| 1470 |
+
|
| 1471 |
+
console.log(`Frontend index: ${paperIndex}, Backend index: ${backendIndex}`);
|
| 1472 |
+
console.log(`Paper: "${papers[paperIndex].title}", Type: ${papers[paperIndex].type}`);
|
| 1473 |
+
|
| 1474 |
setStatus('processing', 'Loading references...(might take longer)');
|
| 1475 |
const formData = new FormData();
|
| 1476 |
+
formData.append("index", backendIndex.toString());
|
| 1477 |
|
| 1478 |
try {
|
| 1479 |
const res = await makeAuthenticatedRequest(`${API_BASE}/add_references/`, {
|