File-Upload: Attachments-Tabelle, Base64-Speicherung, Frontend mit Drag&Drop/Paste/Preview, Error-Handling Fix
This commit is contained in:
1 parent
680f1d6fe2
commit
1271c9c651
11 files changed
+513
-11
No files matched your search
@@ -43,6 +43,42 @@ registerPage('chat', {
|
||||
});
|
||||
}
|
||||
|
||||
// File Upload
|
||||
const fileBtn = document.getElementById('fileBtn');
|
||||
const fileInput = document.getElementById('fileInput');
|
||||
if (fileBtn && fileInput) {
|
||||
fileBtn.addEventListener('click', () => fileInput.click());
|
||||
fileInput.addEventListener('change', (e) => {
|
||||
if (e.target.files[0]) handleFileSelect(e.target.files[0]);
|
||||
});
|
||||
}
|
||||
|
||||
// Drag & Drop
|
||||
const chatContainer = document.querySelector('.chat-page');
|
||||
if (chatContainer) {
|
||||
chatContainer.addEventListener('dragover', (e) => { e.preventDefault(); e.stopPropagation(); });
|
||||
chatContainer.addEventListener('drop', (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (e.dataTransfer.files[0]) handleFileSelect(e.dataTransfer.files[0]);
|
||||
});
|
||||
}
|
||||
|
||||
// Paste
|
||||
if (inputEl) {
|
||||
inputEl.addEventListener('paste', (e) => {
|
||||
const items = e.clipboardData?.items;
|
||||
if (!items) return;
|
||||
for (const item of items) {
|
||||
if (item.kind === 'file') {
|
||||
e.preventDefault();
|
||||
handleFileSelect(item.getAsFile());
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Archivieren
|
||||
const archiveBtn = document.getElementById('archiveBtn');
|
||||
if (archiveBtn) archiveBtn.addEventListener('click', clearChat);
|
||||
@@ -62,5 +98,6 @@ registerPage('chat', {
|
||||
lastKnownMessageId = 0;
|
||||
loadedArchiveCount = 0;
|
||||
isStreaming = false;
|
||||
clearPendingFile();
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user