Luca448 commited on
Commit
f7728c0
·
1 Parent(s): 8012343

UI/DB: Increase history preview length to 150 characters to utilize full card space (BUILD 1.5.34)

Browse files
Files changed (2) hide show
  1. index.html +1 -1
  2. src/db/database.js +19 -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.32</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.34</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
@@ -191,6 +191,24 @@ class Database {
191
  // Seed default settings
192
  this.db.run("INSERT OR IGNORE INTO settings (key, value) VALUES ('model', 'gemini-3.5-flash')");
193
  this.db.run("INSERT OR IGNORE INTO settings (key, value) VALUES ('style_profile', ?)", [DEFAULT_STYLE_PROFILE]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  this.saveToStorage();
195
  }
196
 
@@ -266,7 +284,7 @@ class Database {
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
  }
272
 
 
191
  // Seed default settings
192
  this.db.run("INSERT OR IGNORE INTO settings (key, value) VALUES ('model', 'gemini-3.5-flash')");
193
  this.db.run("INSERT OR IGNORE INTO settings (key, value) VALUES ('style_profile', ?)", [DEFAULT_STYLE_PROFILE]);
194
+
195
+ // Migration: Rebuild previews to new 150 character limit and clean out SiriHero tags
196
+ try {
197
+ const convos = this.exec("SELECT id FROM conversations");
198
+ for (const row of convos) {
199
+ const cid = row.id;
200
+ const lastMsg = this.exec("SELECT content FROM messages WHERE conversation_id = ? ORDER BY created_at DESC LIMIT 1", [cid]);
201
+ if (lastMsg.length > 0) {
202
+ let cleanContent = lastMsg[0].content.replace(/!\[.*?\]\((data:image\/[^)]+)\)/g, '[Bild] ');
203
+ cleanContent = cleanContent.replace(/!\[(?:SiriHero|KnowledgeCard)[^\]]*\]\([^)]*\)/gi, '');
204
+ cleanContent = cleanContent.replace(/!(?:SiriHero|KnowledgeCard):[^\n]+/gi, '');
205
+ cleanContent = cleanContent.replace(/[*_#`\[\]]/g, '').replace(/\n/g, ' ').replace(/\s+/g, ' ').trim();
206
+ const preview = cleanContent.length > 150 ? cleanContent.substring(0, 150) + '...' : cleanContent;
207
+ this.exec("UPDATE conversations SET preview = ? WHERE id = ?", [preview, cid]);
208
+ }
209
+ }
210
+ } catch(e) { console.error('Preview Migration failed', e); }
211
+
212
  this.saveToStorage();
213
  }
214
 
 
284
  // Strip common markdown
285
  cleanContent = cleanContent.replace(/[*_#`\\[\\]]/g, '').replace(/\\n/g, ' ').replace(/\\s+/g, ' ').trim();
286
 
287
+ const preview = cleanContent.length > 150 ? cleanContent.substring(0, 150) + '...' : cleanContent;
288
  this.exec("UPDATE conversations SET preview = ?, updated_at = ? WHERE id = ?", [preview, now, conversation_id]);
289
  }
290