diff --git a/chat/index.html b/chat/index.html index a881150..2a3434a 100644 --- a/chat/index.html +++ b/chat/index.html @@ -247,6 +247,22 @@ .history-item:hover { background: var(--hover-bg); } + .clear-history-btn { + display: block; + width: 100%; + margin-top: 0.5rem; + padding: 0.3rem; + background: var(--bg-secondary); + color: var(--text-primary); + border: 1px solid var(--border-color); + border-radius: 0.3rem; + font-size: 0.9em; + cursor: pointer; + transition: background-color 0.2s; + } + .clear-history-btn:hover { + background: var(--hover-bg); + } .history-time { font-weight: 700; color: var(--text-secondary); @@ -360,6 +376,9 @@ + @@ -526,6 +545,12 @@ this.$refs.historyPanel.removeAttribute("open"); this.scrollToBottom(); }, + + clearHistory() { + if (!confirm("Clear all saved conversations?")) return; + this.historyItems = clearAllHistory(); + this.$refs.historyPanel.removeAttribute("open"); + }, }); function attachCopyButtons($el) { @@ -767,6 +792,11 @@ return all[today]; }; + const clearAllHistory = () => { + localStorage.removeItem(STORAGE_KEY); + return []; + }; + document.addEventListener("alpine:init", () => { Alpine.data("chatApp", chatApp); });