Luca448 commited on
Commit
87a68f4
·
1 Parent(s): 2c34edb

Savestate: Extract publisher from Google News RSS and display it in sources badge (BUILD 1.6.5)

Browse files
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.6.4</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.6.5</div>
55
 
56
  <!-- SVG Filters for Liquid Glass Refraction -->
57
  <svg width="0" height="0" style="position: absolute; pointer-events: none;">
server/news-service.js CHANGED
@@ -311,12 +311,14 @@ async function researchTopic(decomposedTopic) {
311
  const link = $(el).find('link').text();
312
  const pubDate = $(el).find('pubDate').text();
313
  const description = $(el).find('description').text().replace(/<[^>]+>/g, '');
 
314
 
315
  if (!allResults.some(r => r.url === link) && !isUrlUsed(link, pubDate)) {
316
  allResults.push({
317
  title: title.replace(/\s*-\s*[^-]+$/, ''),
318
  url: link,
319
  snippet: description,
 
320
  fullContent: null,
321
  pubDate, query
322
  });
@@ -365,6 +367,7 @@ async function researchTopic(decomposedTopic) {
365
  title: `Wikipedia: ${result.title}`,
366
  url: `https://de.wikipedia.org/wiki/${encodeURIComponent(result.title)}`,
367
  snippet: page.extract.substring(0, 500),
 
368
  fullContent: page.extract.substring(0, 2000),
369
  pubDate: null, query: 'wikipedia_context'
370
  });
@@ -433,7 +436,7 @@ ARTIKEL:
433
  ${rawArticle}
434
 
435
  QUELLEN:
436
- ${searchResults.map((s, i) => `[${i+1}] "${s.title}" | ${s.url}`).join('\n')}
437
 
438
  BILDER: ${images.join(', ') || 'Keine'}
439
  TOPIC: "${topic}"
@@ -446,7 +449,7 @@ Antworte EXAKT als JSON:
446
  "content": "Vollständiger Artikel in Markdown (übernehme den Input, korrigiere Formatierung)",
447
  "category": "Technologie|Wissenschaft|Politik|Wirtschaft|Bildung|Gesellschaft|Sport|Kultur|Gesundheit",
448
  "imageUrl": "Beste Bild-URL oder null",
449
- "sources": [{ "title": "domain.de", "url": "https://...", "snippet": "Kurz" }]
450
  }`;
451
 
452
  const rawResponse = await callGemini(prompt, apiKey, {
 
311
  const link = $(el).find('link').text();
312
  const pubDate = $(el).find('pubDate').text();
313
  const description = $(el).find('description').text().replace(/<[^>]+>/g, '');
314
+ const publisher = $(el).find('source').text() || 'Nachrichten';
315
 
316
  if (!allResults.some(r => r.url === link) && !isUrlUsed(link, pubDate)) {
317
  allResults.push({
318
  title: title.replace(/\s*-\s*[^-]+$/, ''),
319
  url: link,
320
  snippet: description,
321
+ publisher: publisher,
322
  fullContent: null,
323
  pubDate, query
324
  });
 
367
  title: `Wikipedia: ${result.title}`,
368
  url: `https://de.wikipedia.org/wiki/${encodeURIComponent(result.title)}`,
369
  snippet: page.extract.substring(0, 500),
370
+ publisher: 'Wikipedia',
371
  fullContent: page.extract.substring(0, 2000),
372
  pubDate: null, query: 'wikipedia_context'
373
  });
 
436
  ${rawArticle}
437
 
438
  QUELLEN:
439
+ ${searchResults.map((s, i) => `[${i+1}] "${s.title}" | Publisher: ${s.publisher} | URL: ${s.url}`).join('\n')}
440
 
441
  BILDER: ${images.join(', ') || 'Keine'}
442
  TOPIC: "${topic}"
 
449
  "content": "Vollständiger Artikel in Markdown (übernehme den Input, korrigiere Formatierung)",
450
  "category": "Technologie|Wissenschaft|Politik|Wirtschaft|Bildung|Gesellschaft|Sport|Kultur|Gesundheit",
451
  "imageUrl": "Beste Bild-URL oder null",
452
+ "sources": [{ "publisher": "ZDFheute", "url": "https://...", "snippet": "Kurz" }]
453
  }`;
454
 
455
  const rawResponse = await callGemini(prompt, apiKey, {
src/views/news/news-view.js CHANGED
@@ -324,12 +324,14 @@ export class NewsView {
324
  if (!this.activeArticle) return '';
325
 
326
  // Format sources
327
- const sourcesHtml = this.activeArticle.sources ? this.activeArticle.sources.map((s, i) => `
 
 
328
  <a href="${s.url}" target="_blank" style="display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,0.05); padding: 6px 12px; border-radius: 16px; color: var(--text-secondary); text-decoration: none; font-size: 12px; margin-right: 8px; margin-bottom: 8px; border: 1px solid rgba(255,255,255,0.1);">
329
  <span style="background: rgba(255,255,255,0.1); width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px;">${i+1}</span>
330
- ${new URL(s.url).hostname.replace('www.', '')}
331
  </a>
332
- `).join('') : '';
333
 
334
  return `
335
  <div id="article-modal" style="position: fixed; inset: 0; background: #0b0d10; z-index: 2000; display: flex; flex-direction: column; animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);">
 
324
  if (!this.activeArticle) return '';
325
 
326
  // Format sources
327
+ const sourcesHtml = this.activeArticle.sources ? this.activeArticle.sources.map((s, i) => {
328
+ const displayName = s.publisher || s.title || new URL(s.url).hostname.replace('www.', '');
329
+ return `
330
  <a href="${s.url}" target="_blank" style="display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,0.05); padding: 6px 12px; border-radius: 16px; color: var(--text-secondary); text-decoration: none; font-size: 12px; margin-right: 8px; margin-bottom: 8px; border: 1px solid rgba(255,255,255,0.1);">
331
  <span style="background: rgba(255,255,255,0.1); width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px;">${i+1}</span>
332
+ ${displayName}
333
  </a>
334
+ `}).join('') : '';
335
 
336
  return `
337
  <div id="article-modal" style="position: fixed; inset: 0; background: #0b0d10; z-index: 2000; display: flex; flex-direction: column; animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);">