Aichatbot12321 commited on
Commit
09b89f9
·
verified ·
1 Parent(s): a286eb1

Update history.html

Browse files
Files changed (1) hide show
  1. history.html +25 -12
history.html CHANGED
@@ -288,19 +288,32 @@
288
  };
289
 
290
  window.triggerSessionRestoreEngine = function(type, id) {
291
- const subRoutes = {
292
- 'math': 'maths.html',
293
- 'search': 'search.html',
294
- 'youtube': 'youtube.html',
295
- 'create': 'create.html',
296
- 'translation': 'translator.html',
297
- 'image_translation': 'image.html',
298
- 'qa': 'qa.html',
299
- 'quiz': 'quiz.html'
300
- };
301
- const destFile = subRoutes[type] || 'index.html';
302
- window.location.href = `${destFile}?restore=${id}`;
 
 
 
 
 
 
 
 
303
  };
 
 
 
 
 
304
 
305
  window.deleteSingleItemEngine = function(id) {
306
  if (confirm("Permanently wipe this message?")) {
 
288
  };
289
 
290
  window.triggerSessionRestoreEngine = function(type, id) {
291
+ // 1. Locate the item to check its internal structure
292
+ let item = localHistoryArray.find(i => String(i.id) === String(id));
293
+
294
+ // 2. Force 'search' type routing if it features an internal text interaction array list
295
+ let trueType = type;
296
+ if (!trueType || trueType === 'undefined' || trueType === 'Search Mode' || trueType === 'Cloudflare Image') {
297
+ if (item && item.interactions) {
298
+ trueType = 'search';
299
+ }
300
+ }
301
+
302
+ const subRoutes = {
303
+ 'math': 'maths.html',
304
+ 'search': 'search.html',
305
+ 'youtube': 'youtube.html',
306
+ 'create': 'create.html',
307
+ 'translation': 'translator.html',
308
+ 'image_translation': 'image.html',
309
+ 'qa': 'qa.html',
310
+ 'quiz': 'quiz.html'
311
  };
312
+
313
+ // 3. Fallback safely to search.html if unsure, instead of kicking to the dashboard index
314
+ const destFile = subRoutes[trueType] || 'search.html';
315
+ window.location.href = `${destFile}?restore=${id}`;
316
+ };
317
 
318
  window.deleteSingleItemEngine = function(id) {
319
  if (confirm("Permanently wipe this message?")) {