feat: ARIA kann Dateien an User zurueckgeben (PDFs, Bilder, Office-Docs, ...)
ARIA setzt im Antworttext einen Marker `[FILE: /shared/uploads/aria_xxx.ext]`. Bridge extrahiert ihn (Marker wird aus dem TTS-Text entfernt) und sendet ein neues file_from_aria-Event ueber RVS an App + Diagnostic. Diagnostic: - Eigene Bubble mit Datei-Icon + Klick-Handler - PDF/Bild → neuer Browser-Tab via /shared/* HTTP-Route - Andere → Download via download-Attribut App: - Neues FileOpenerModule (Kotlin) — Intent.ACTION_VIEW mit FileProvider, Android-Picker waehlt App nach MIME-Type - file_paths.xml erweitert (cache + files + external) - file_response liefert jetzt mimeType mit - Klick auf ARIA-Anhang: lokal vorhanden → direkt oeffnen, sonst file_request mit autoOpen-Flag → bei Empfang persistAttachment + open Stefan muss noch im aria-core/OpenClaw System-Prompt einen Hinweis einbauen: "Wenn du dem User eine Datei erstellt hast (Pfad in /shared/uploads/), haenge am Ende deiner Antwort einmalig [FILE: /shared/uploads/aria_<name>.<ext>] an. Der Marker wird aus dem sichtbaren Text entfernt und als Anhang in App und Diagnostic angezeigt." Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -996,6 +996,11 @@
|
||||
addChat('received', msg.text, 'chat:final');
|
||||
return;
|
||||
}
|
||||
if (msg.type === 'file_from_aria') {
|
||||
const p = msg.payload || {};
|
||||
addAriaFile(p);
|
||||
return;
|
||||
}
|
||||
if (msg.type === 'chat_delta') { return; }
|
||||
if (msg.type === 'chat_error') {
|
||||
addChat('error', msg.error, 'chat:error');
|
||||
@@ -1475,6 +1480,40 @@
|
||||
}
|
||||
}
|
||||
|
||||
/** ARIA hat eine Datei rausgegeben — als eigene Bubble mit Klick-Handler. */
|
||||
function addAriaFile(p) {
|
||||
const name = p.name || 'datei';
|
||||
const serverPath = p.serverPath || '';
|
||||
const mimeType = p.mimeType || '';
|
||||
const sizeKB = p.size ? Math.round(p.size / 1024) : 0;
|
||||
const isImage = mimeType.startsWith('image/');
|
||||
const isPdf = mimeType === 'application/pdf';
|
||||
const url = serverPath; // Diagnostic-Server liefert /shared/* aus
|
||||
const sizeStr = sizeKB > 1024 ? `${(sizeKB/1024).toFixed(1)}MB` : `${sizeKB}KB`;
|
||||
const icon = isImage ? '🖼️' : isPdf ? '📄' : '📎';
|
||||
// PDFs/Bilder: target=_blank → neuer Tab. Andere: download-Attribut.
|
||||
const linkAttrs = (isImage || isPdf)
|
||||
? `href="${url}" target="_blank" rel="noopener"`
|
||||
: `href="${url}" download="${escapeHtml(name)}"`;
|
||||
let preview = '';
|
||||
if (isImage) {
|
||||
preview = `<img src="${url}" class="chat-media" onclick="openLightbox('image','${url}')" onerror="this.style.display='none'" style="margin-top:6px;">`;
|
||||
}
|
||||
const html = `<div style="font-weight:bold;">${icon} ARIA hat eine Datei erstellt</div>` +
|
||||
`<a ${linkAttrs} style="color:#0096FF;text-decoration:underline;">${escapeHtml(name)}</a>` +
|
||||
` <span style="color:#888;font-size:11px;">(${escapeHtml(mimeType)}, ${sizeStr})</span>` +
|
||||
preview +
|
||||
`<div class="meta">ARIA-Datei — ${new Date().toLocaleTimeString('de-DE')}</div>`;
|
||||
for (const box of [chatBox, document.getElementById('chat-box-fs')]) {
|
||||
if (!box) continue;
|
||||
const el = document.createElement('div');
|
||||
el.className = 'chat-msg received';
|
||||
el.innerHTML = html;
|
||||
box.appendChild(el);
|
||||
box.scrollTop = box.scrollHeight;
|
||||
}
|
||||
}
|
||||
|
||||
let chatFullscreen = false;
|
||||
function toggleChatFullscreen() {
|
||||
const modal = document.getElementById('chat-fullscreen');
|
||||
|
||||
Reference in New Issue
Block a user