fivetech commited on
Commit
d3f34a8
·
verified ·
1 Parent(s): 24f6ea0

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +4 -2
index.html CHANGED
@@ -491,8 +491,9 @@ function renderHistory() {
491
  d.appendChild(t); d.appendChild(m);
492
  d.addEventListener('click', () => {
493
  if (running) return;
494
- if (Array.isArray(item.msgs) && item.msgs.length) restoreConversation(item);
495
- else { topicEl.value = item.topic; topicEl.focus(); }
 
496
  });
497
  histListEl.appendChild(d);
498
  });
@@ -525,6 +526,7 @@ function saveTranscriptToHistory() {
525
  if (webContext) it.ctx = webContext; else delete it.ctx;
526
  if (webSources.length) it.sources = webSources; else delete it.sources;
527
  saveHistory(h);
 
528
  }
529
  window.addEventListener('beforeunload', saveTranscriptToHistory);
530
 
 
491
  d.appendChild(t); d.appendChild(m);
492
  d.addEventListener('click', () => {
493
  if (running) return;
494
+ const fresh = loadHistory().find(x => x.ts === item.ts) || item;
495
+ if (Array.isArray(fresh.msgs) && fresh.msgs.length) restoreConversation(fresh);
496
+ else { topicEl.value = fresh.topic; topicEl.focus(); }
497
  });
498
  histListEl.appendChild(d);
499
  });
 
526
  if (webContext) it.ctx = webContext; else delete it.ctx;
527
  if (webSources.length) it.sources = webSources; else delete it.sources;
528
  saveHistory(h);
529
+ renderHistory();
530
  }
531
  window.addEventListener('beforeunload', saveTranscriptToHistory);
532