Spaces:
Paused
Paused
Savestate: UX polish, fix PDF fallback modal, gap analysis resilience, cinematic zoom out
Browse files- .agents/PROJECT_CONTEXT.md +1 -1
- index.html +1 -1
- src/ai/research-agent.js +12 -10
- src/styles/global.css +15 -0
- src/views/chat/chat-view.js +14 -3
.agents/PROJECT_CONTEXT.md
CHANGED
|
@@ -33,7 +33,7 @@ Das Projekt nutzt einen eigenen, leichtgewichtigen Client-Side-Router:
|
|
| 33 |
3. **Dynamische Skeleton-Loader:** Wenn die KI nachdenkt oder etwas generiert, wird ein iOS-kompatibler, wachsender Ladebalken (von links nach rechts) mit Gemini-Farb-Schimmer angezeigt (`skel-type-in`).
|
| 34 |
4. **Chat UI & "+"-Menü:** Besitzt eine Siri-ähnliche Eingabekapsel mit einem "+"-Popover-Menü für Zusatzfeatures (Bilder hochladen, Sprachstil, Deep Research, Vault durchsuchen, Erweitertes Denken).
|
| 35 |
5. **Erweitertes Denken (Reasoning Mode):** Die App unterstützt nativ "Extended Thinking" (wie Gemini/DeepSeek). Bei Aktivierung wird die Backend-Routingschicht (`ai-router.js`) automatisch auf ein natives Reasoning-Modell umgeleitet (z.B. Gemini 2.0 Thinking, DeepSeek R1). Für Modelle ohne native `<think>`-Architektur fungiert ein extremer Chain-of-Thought Prompt als Fallback. Der ausgegebene Gedankengang wird im Frontend sauber aus dem Markdown extrahiert und in einem eleganten Glassmorphism-Accordion (`.ai-thought-process`) mit geschätzter "Denkzeit" vor der Antwort präsentiert.
|
| 36 |
-
6. **Deep Research Agent & Article Modal:** Ein autonomer Agent (`research-agent.js`), der komplexe Themen mithilfe der
|
| 37 |
7. **In-App Vault (Document Manager):** Ein lokales Obsidian-ähnliches Dateisystem auf dem Endgerät (iOS/Android) via Capacitor (`file-system.js`). Nutzt ein ultra-premium „Glass Vault" Design: 3-schichtige 3D-Ordner (Back Panel mit Lasche, physische Papiere im Inneren, leicht aufklappbare Glas-Front mit SVG-Wasserzeichen). Interaktionen: Tap → schneller Übergang; Long-Press → Haptic Feedback + Cinematic Open (Ordner fliegt nach unten links, öffnet sich in 3D, innere Papiere fliegen animiert heraus und werden nahtlos zu den echten Dokument-Dateien, die sich in einem überlappenden Zick-Zack-Muster absolut positionieren). Papierkorb-System und KI-Ordner-Kategorisierung sind implementiert.
|
| 38 |
8. **Discover Feed 2.0:** Ein Zero-Cost, On-Demand Entdecken-Feed, der Google Trends RSS und Google News RSS anzapft. Es wird eine hybride Pipeline mit Jina Reader genutzt, um kostenlos volle Artikeltexte zu scrapen, aus denen Gemini dann hochqualitative, strukturierte Artikel (inkl. Duplikat-Schutz via Jaccard-Similarity und Kategorie-Tabs) generiert.
|
| 39 |
9. **Local TTS Engine (Piper):** Eine selbst gehostete, kostenlose und lokal ausgeführte Text-to-Speech Engine via Piper (Modell: de_DE-thorsten-high). Die Architektur nutzt eine "/dev/shm" RAM-Disk zum Preloading des 140MB ONNX-Modells für 0-Sekunden Startzeiten, intelligentes Vorausschau-Chunking für unendliche Wiedergabe ohne Unterbrechungen (auch bei 2x Speed) und eine proportionale Zeit-Schätz-Methode für **Live-Wort-Markierungen (Closed Captions)** im Text inkl. Auto-Scrolling.
|
|
|
|
| 33 |
3. **Dynamische Skeleton-Loader:** Wenn die KI nachdenkt oder etwas generiert, wird ein iOS-kompatibler, wachsender Ladebalken (von links nach rechts) mit Gemini-Farb-Schimmer angezeigt (`skel-type-in`).
|
| 34 |
4. **Chat UI & "+"-Menü:** Besitzt eine Siri-ähnliche Eingabekapsel mit einem "+"-Popover-Menü für Zusatzfeatures (Bilder hochladen, Sprachstil, Deep Research, Vault durchsuchen, Erweitertes Denken).
|
| 35 |
5. **Erweitertes Denken (Reasoning Mode):** Die App unterstützt nativ "Extended Thinking" (wie Gemini/DeepSeek). Bei Aktivierung wird die Backend-Routingschicht (`ai-router.js`) automatisch auf ein natives Reasoning-Modell umgeleitet (z.B. Gemini 2.0 Thinking, DeepSeek R1). Für Modelle ohne native `<think>`-Architektur fungiert ein extremer Chain-of-Thought Prompt als Fallback. Der ausgegebene Gedankengang wird im Frontend sauber aus dem Markdown extrahiert und in einem eleganten Glassmorphism-Accordion (`.ai-thought-process`) mit geschätzter "Denkzeit" vor der Antwort präsentiert.
|
| 36 |
+
6. **Deep Research Agent & Article Modal:** Ein autonomer Agent (`research-agent.js`), der komplexe Themen mithilfe der DuckDuckGo & Jina Reader APIs tiefgründig analysiert. Er nutzt einen zeitbasierten, iterativen Gap-Analysis Loop, um durch mehrfache Recherche-Durchläufe fehlende Informationen gezielt zu ergänzen und die Qualität zu maximieren. Während der Recherche wird ein **Fullscreen 3-Phasen-Ladebildschirm** (`deep-research-loader.js/.css`) angezeigt. Zusätzlich kann über den 'Detective Board' Toggle ein interaktiver vis-network Node-Graph (`research-canvas.js`) eingeblendet werden, der den Verlauf der Suchanfragen und Quellen in Echtzeit als Mindmap visualisiert. Berichte werden in einem hochwertigen "Article Modal" (Zeitungs-Look) mit Inline-Quellen (Wikipedia-Stil) geöffnet.
|
| 37 |
7. **In-App Vault (Document Manager):** Ein lokales Obsidian-ähnliches Dateisystem auf dem Endgerät (iOS/Android) via Capacitor (`file-system.js`). Nutzt ein ultra-premium „Glass Vault" Design: 3-schichtige 3D-Ordner (Back Panel mit Lasche, physische Papiere im Inneren, leicht aufklappbare Glas-Front mit SVG-Wasserzeichen). Interaktionen: Tap → schneller Übergang; Long-Press → Haptic Feedback + Cinematic Open (Ordner fliegt nach unten links, öffnet sich in 3D, innere Papiere fliegen animiert heraus und werden nahtlos zu den echten Dokument-Dateien, die sich in einem überlappenden Zick-Zack-Muster absolut positionieren). Papierkorb-System und KI-Ordner-Kategorisierung sind implementiert.
|
| 38 |
8. **Discover Feed 2.0:** Ein Zero-Cost, On-Demand Entdecken-Feed, der Google Trends RSS und Google News RSS anzapft. Es wird eine hybride Pipeline mit Jina Reader genutzt, um kostenlos volle Artikeltexte zu scrapen, aus denen Gemini dann hochqualitative, strukturierte Artikel (inkl. Duplikat-Schutz via Jaccard-Similarity und Kategorie-Tabs) generiert.
|
| 39 |
9. **Local TTS Engine (Piper):** Eine selbst gehostete, kostenlose und lokal ausgeführte Text-to-Speech Engine via Piper (Modell: de_DE-thorsten-high). Die Architektur nutzt eine "/dev/shm" RAM-Disk zum Preloading des 140MB ONNX-Modells für 0-Sekunden Startzeiten, intelligentes Vorausschau-Chunking für unendliche Wiedergabe ohne Unterbrechungen (auch bei 2x Speed) und eine proportionale Zeit-Schätz-Methode für **Live-Wort-Markierungen (Closed Captions)** im Text inkl. Auto-Scrolling.
|
index.html
CHANGED
|
@@ -64,7 +64,7 @@
|
|
| 64 |
</head>
|
| 65 |
<body class="dark-theme in-chat-view" data-bg-style="fluid-dark">
|
| 66 |
|
| 67 |
-
<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.8.
|
| 68 |
|
| 69 |
<!-- SVG Filters for Liquid Glass Refraction -->
|
| 70 |
<svg width="0" height="0" style="position: absolute; pointer-events: none;">
|
|
|
|
| 64 |
</head>
|
| 65 |
<body class="dark-theme in-chat-view" data-bg-style="fluid-dark">
|
| 66 |
|
| 67 |
+
<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.8.163</div>
|
| 68 |
|
| 69 |
<!-- SVG Filters for Liquid Glass Refraction -->
|
| 70 |
<svg width="0" height="0" style="position: absolute; pointer-events: none;">
|
src/ai/research-agent.js
CHANGED
|
@@ -104,16 +104,18 @@ export class ResearchAgent {
|
|
| 104 |
const gapStr = await gemini.generateContent(gapPrompt, model, geminiKey);
|
| 105 |
const jsonMatch = gapStr.match(/\[.*\]/s);
|
| 106 |
if (jsonMatch) queries = JSON.parse(jsonMatch[0]).slice(0, 2);
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
}
|
|
|
|
|
|
|
| 117 |
}
|
| 118 |
|
| 119 |
if (queries.length === 0 || !keepSearching) break;
|
|
|
|
| 104 |
const gapStr = await gemini.generateContent(gapPrompt, model, geminiKey);
|
| 105 |
const jsonMatch = gapStr.match(/\[.*\]/s);
|
| 106 |
if (jsonMatch) queries = JSON.parse(jsonMatch[0]).slice(0, 2);
|
| 107 |
+
} catch(e) {
|
| 108 |
+
console.warn('Gap analysis failed or returned invalid JSON', e);
|
| 109 |
+
queries = [];
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
let plan = queries.length === 0 ? 'none' : 'active';
|
| 113 |
+
const elapsedMinutes = (Date.now() - startTimeMs) / 60000;
|
| 114 |
+
if (elapsedMinutes < maxTimeMinutes * 0.8 && (!plan || plan === 'none')) {
|
| 115 |
+
queries = [`${topic} tiefergehende Analyse`, `${topic} detaillierte Fakten`];
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
if (queries.length === 0) keepSearching = false;
|
| 119 |
}
|
| 120 |
|
| 121 |
if (queries.length === 0 || !keepSearching) break;
|
src/styles/global.css
CHANGED
|
@@ -4024,4 +4024,19 @@ body.in-chat-view .tts-player-container {
|
|
| 4024 |
opacity: 1;
|
| 4025 |
transform: scale(1);
|
| 4026 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4027 |
}
|
|
|
|
| 4024 |
opacity: 1;
|
| 4025 |
transform: scale(1);
|
| 4026 |
}
|
| 4027 |
+
}
|
| 4028 |
+
|
| 4029 |
+
/* =========================================
|
| 4030 |
+
Detective Board Cinematic Zoom Out
|
| 4031 |
+
========================================= */
|
| 4032 |
+
.detective-zoom-out {
|
| 4033 |
+
transform: scale(0.9) translateY(20px) !important;
|
| 4034 |
+
opacity: 0.5 !important;
|
| 4035 |
+
filter: blur(2px) !important;
|
| 4036 |
+
pointer-events: none !important;
|
| 4037 |
+
}
|
| 4038 |
+
|
| 4039 |
+
.chat-layout {
|
| 4040 |
+
transition: transform 1.2s cubic-bezier(0.19, 1, 0.22, 1), opacity 1.2s ease, filter 1.2s ease;
|
| 4041 |
+
transform-origin: center top;
|
| 4042 |
}
|
src/views/chat/chat-view.js
CHANGED
|
@@ -872,7 +872,7 @@ export class ChatView {
|
|
| 872 |
}
|
| 873 |
|
| 874 |
async openArticleModal(rawText) {
|
| 875 |
-
const modal = document.getElementById('article-modal');
|
| 876 |
if (!modal) {
|
| 877 |
console.warn('Article modal not found in DOM, falling back to PDF modal. Please hard refresh.');
|
| 878 |
return this.openPdfModal(rawText);
|
|
@@ -4827,7 +4827,10 @@ body { margin: 0; padding: 0; background: #000; overflow: hidden; display: flex;
|
|
| 4827 |
if (isDeepResearch) {
|
| 4828 |
deepResearchLoader.show();
|
| 4829 |
if (isDetectiveBoard && overlay) {
|
|
|
|
| 4830 |
overlay.style.display = 'block';
|
|
|
|
|
|
|
| 4831 |
await initCanvas(overlay);
|
| 4832 |
addNode('root', 'Research Topic', 'root');
|
| 4833 |
}
|
|
@@ -4861,7 +4864,11 @@ body { margin: 0; padding: 0; background: #000; overflow: hidden; display: flex;
|
|
| 4861 |
this.hideToolStatus();
|
| 4862 |
if (isDeepResearch) {
|
| 4863 |
deepResearchLoader.hide();
|
| 4864 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4865 |
}
|
| 4866 |
|
| 4867 |
// Process Flashcard Commands (Regex)
|
|
@@ -4985,7 +4992,11 @@ body { margin: 0; padding: 0; background: #000; overflow: hidden; display: flex;
|
|
| 4985 |
await this.hideTypingIndicator();
|
| 4986 |
if (isDeepResearch) {
|
| 4987 |
deepResearchLoader.hide();
|
| 4988 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4989 |
}
|
| 4990 |
|
| 4991 |
if (e.name === 'AbortError') {
|
|
|
|
| 872 |
}
|
| 873 |
|
| 874 |
async openArticleModal(rawText) {
|
| 875 |
+
const modal = document.getElementById('article-view-modal');
|
| 876 |
if (!modal) {
|
| 877 |
console.warn('Article modal not found in DOM, falling back to PDF modal. Please hard refresh.');
|
| 878 |
return this.openPdfModal(rawText);
|
|
|
|
| 4827 |
if (isDeepResearch) {
|
| 4828 |
deepResearchLoader.show();
|
| 4829 |
if (isDetectiveBoard && overlay) {
|
| 4830 |
+
document.querySelector('.chat-layout')?.classList.add('detective-zoom-out');
|
| 4831 |
overlay.style.display = 'block';
|
| 4832 |
+
overlay.style.opacity = '0';
|
| 4833 |
+
setTimeout(() => overlay.style.opacity = '1', 50);
|
| 4834 |
await initCanvas(overlay);
|
| 4835 |
addNode('root', 'Research Topic', 'root');
|
| 4836 |
}
|
|
|
|
| 4864 |
this.hideToolStatus();
|
| 4865 |
if (isDeepResearch) {
|
| 4866 |
deepResearchLoader.hide();
|
| 4867 |
+
document.querySelector('.chat-layout')?.classList.remove('detective-zoom-out');
|
| 4868 |
+
if (isDetectiveBoard && overlay) {
|
| 4869 |
+
overlay.style.opacity = '0';
|
| 4870 |
+
setTimeout(() => overlay.style.display = 'none', 1000);
|
| 4871 |
+
}
|
| 4872 |
}
|
| 4873 |
|
| 4874 |
// Process Flashcard Commands (Regex)
|
|
|
|
| 4992 |
await this.hideTypingIndicator();
|
| 4993 |
if (isDeepResearch) {
|
| 4994 |
deepResearchLoader.hide();
|
| 4995 |
+
document.querySelector('.chat-layout')?.classList.remove('detective-zoom-out');
|
| 4996 |
+
if (isDetectiveBoard && overlay) {
|
| 4997 |
+
overlay.style.opacity = '0';
|
| 4998 |
+
setTimeout(() => overlay.style.display = 'none', 1000);
|
| 4999 |
+
}
|
| 5000 |
}
|
| 5001 |
|
| 5002 |
if (e.name === 'AbortError') {
|