Luca448 commited on
Commit
a17ebcb
·
1 Parent(s): c9de332

UI: Clean raw markdown and AI internal tags from chat history previews (BUILD 1.5.32)

Browse files
Files changed (3) hide show
  1. index.html +1 -1
  2. src/db/database.js +9 -1
  3. src/views/chat/chat-view.js +1 -1
index.html CHANGED
@@ -51,7 +51,7 @@
51
  </head>
52
  <body class="dark-theme in-chat-view">
53
 
54
- <div id="live-version-badge" style="position: fixed; top: 50px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--text-secondary); opacity: 0.6; z-index: 99999; pointer-events: none; font-weight: 500; font-family: monospace; letter-spacing: 1px; background: rgba(0,0,0,0.2); padding: 2px 8px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.05);">BUILD 1.5.31</div>
55
 
56
  <!-- SVG Filters for Liquid Glass Refraction -->
57
  <svg width="0" height="0" style="position: absolute; pointer-events: none;">
 
51
  </head>
52
  <body class="dark-theme in-chat-view">
53
 
54
+ <div id="live-version-badge" style="position: fixed; top: 50px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--text-secondary); opacity: 0.6; z-index: 99999; pointer-events: none; font-weight: 500; font-family: monospace; letter-spacing: 1px; background: rgba(0,0,0,0.2); padding: 2px 8px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.05);">BUILD 1.5.32</div>
55
 
56
  <!-- SVG Filters for Liquid Glass Refraction -->
57
  <svg width="0" height="0" style="position: absolute; pointer-events: none;">
src/db/database.js CHANGED
@@ -257,7 +257,15 @@ class Database {
257
  [id, conversation_id, role, content, model_used, style_used, now]
258
  );
259
  // Update conversation preview. Remove base64 image markdown first
260
- const cleanContent = content.replace(/!\[.*?\]\((data:image\/[^)]+)\)/g, '[Bild] ');
 
 
 
 
 
 
 
 
261
  const preview = cleanContent.length > 40 ? cleanContent.substring(0, 40) + '...' : cleanContent;
262
  this.exec("UPDATE conversations SET preview = ?, updated_at = ? WHERE id = ?", [preview, now, conversation_id]);
263
  }
 
257
  [id, conversation_id, role, content, model_used, style_used, now]
258
  );
259
  // Update conversation preview. Remove base64 image markdown first
260
+ let cleanContent = content.replace(/!\[.*?\]\((data:image\/[^)]+)\)/g, '[Bild] ');
261
+
262
+ // Remove specific AI components like SiriHero and KnowledgeCard
263
+ cleanContent = cleanContent.replace(/!\[(?:SiriHero|KnowledgeCard)[^\]]*\]\([^)]*\)/gi, '');
264
+ cleanContent = cleanContent.replace(/!(?:SiriHero|KnowledgeCard):[^\n]+/gi, '');
265
+
266
+ // Strip common markdown
267
+ cleanContent = cleanContent.replace(/[*_#`\\[\\]]/g, '').replace(/\\n/g, ' ').replace(/\\s+/g, ' ').trim();
268
+
269
  const preview = cleanContent.length > 40 ? cleanContent.substring(0, 40) + '...' : cleanContent;
270
  this.exec("UPDATE conversations SET preview = ?, updated_at = ? WHERE id = ?", [preview, now, conversation_id]);
271
  }
src/views/chat/chat-view.js CHANGED
@@ -2753,7 +2753,7 @@ body { margin: 0; padding: 0; background: #000; overflow: hidden; display: flex;
2753
  <span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-grow: 1;">${conv.title}</span>
2754
  </div>
2755
  </div>
2756
- <div class="history-preview">${conv.preview || 'Keine Nachrichten'}</div>
2757
  </div>
2758
  <div class="history-dropdown-wrapper">
2759
  <div class="history-dropdown">
 
2753
  <span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-grow: 1;">${conv.title}</span>
2754
  </div>
2755
  </div>
2756
+ <div class="history-preview">${(conv.preview || 'Keine Nachrichten').replace(/!\\[(?:SiriHero|KnowledgeCard)[^\\]]*\\]\\([^)]*\\)/gi, '').replace(/!(?:SiriHero|KnowledgeCard):[^\\n]+/gi, '').replace(/[*_#`\\[\\]]/g, '').trim()}</div>
2757
  </div>
2758
  <div class="history-dropdown-wrapper">
2759
  <div class="history-dropdown">