fix some chat sizing and placing
This commit is contained in:
@@ -61,6 +61,13 @@ async function sendMessage() {
|
||||
|
||||
// Editor ausblenden
|
||||
if (systemContainer) systemContainer.classList.add('locked');
|
||||
|
||||
const exportBtn = document.getElementById('export-btn');
|
||||
if (exportBtn) {
|
||||
exportBtn.style.setProperty('display', 'block', 'important');
|
||||
console.log("Export Button sollte jetzt sichtbar sein");
|
||||
}
|
||||
|
||||
isFirstMessage = false;
|
||||
}
|
||||
|
||||
@@ -275,4 +282,42 @@ if (systemInput) {
|
||||
// Delay, um dem Klick auf den Button Vorrang zu geben
|
||||
setTimeout(exitEditMode, 200);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Die Export-Funktion
|
||||
document.getElementById('export-btn')?.addEventListener('click', () => {
|
||||
if (messageHistory.length === 0) return;
|
||||
|
||||
// Wir erstellen ein Export-Objekt mit Metadaten
|
||||
const exportData = {
|
||||
timestamp: new Date().toISOString(),
|
||||
model: "trinity-test",
|
||||
history: messageHistory, // Das ist dein Array mit {role, content}
|
||||
stats: {
|
||||
messageCount: messageHistory.length,
|
||||
totalChars: getHistoryVolume()
|
||||
}
|
||||
};
|
||||
|
||||
// Umwandlung in einen JSON-String (mit 2 Leerzeichen Einrückung für Lesbarkeit)
|
||||
const jsonString = JSON.stringify(exportData, null, 2);
|
||||
|
||||
// Download-Logik
|
||||
const blob = new Blob([jsonString], { type: 'application/json' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
// Dateiname mit Datum und Uhrzeit
|
||||
const dateStr = new Date().toISOString().slice(0,19).replace(/:/g, '-');
|
||||
a.download = `chat-export-${dateStr}.json`;
|
||||
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
|
||||
// Aufräumen
|
||||
setTimeout(() => {
|
||||
document.body.removeChild(a);
|
||||
URL.revokeObjectURL(url);
|
||||
}, 0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user