diff --git a/templates/index.html b/templates/index.html index 5b8c8ba..e73487a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -209,6 +209,8 @@ body { font-family: var(--font-body); background: var(--bg-primary); color: var( .input-row textarea { flex:1; background:var(--bg-tertiary); border:1px solid var(--border); color:var(--text-primary); font-family:var(--font-body); font-size:14px; padding:12px 14px; border-radius:var(--radius); resize:none; min-height:44px; max-height:200px; line-height:1.5; } .input-row textarea:focus { outline:none; border-color:var(--accent-dim); } .input-row textarea::placeholder { color:var(--text-muted); } +.user-copy-btn { display:inline; cursor:pointer; font-size:13px; margin-left:6px; opacity:0.4; transition:opacity 0.15s; user-select:none; } +.user-copy-btn:hover { opacity:1; } .paperclip-btn { padding:12px 12px; background:var(--bg-tertiary); border:1px solid var(--border); border-radius:var(--radius); color:var(--text-secondary); font-size:18px; cursor:pointer; transition:all 0.2s; line-height:1; } .paperclip-btn:hover { background:var(--bg-hover); color:var(--accent); border-color:var(--accent-dim); } .send-btn { padding:12px 20px; background:var(--accent-dim); border:none; border-radius:var(--radius); color:#fff; font-family:var(--font-mono); font-size:13px; font-weight:600; cursor:pointer; white-space:nowrap; } @@ -1433,7 +1435,9 @@ function appendMessage(role, content, animate, isSearch = false, afterEl = null) const months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; const ms = now.getMilliseconds(); const timeStr = months[now.getMonth()] + ' ' + String(now.getDate()).padStart(2,'0') + ', ' + now.getFullYear() + ' ' + String(now.getHours()).padStart(2,'0') + ':' + String(now.getMinutes()).padStart(2,'0') + ':' + String(now.getSeconds()).padStart(2,'0') + '.' + String(Math.floor(ms / 10)).padStart(2,'0'); - div.innerHTML = `
${role === 'user' ? 'YOU' : 'AI'}
${role}${role === 'user' ? ' ' + timeStr + '' : ''}
${content ? renderMarkdown(content) : ''}
`; + const textHtml = content ? renderMarkdown(content) : ''; + const copyIcon = role === 'user' && content ? `📋` : ''; + div.innerHTML = `
${role === 'user' ? 'YOU' : 'AI'}
${role}${role === 'user' ? ' ' + timeStr + '' : ''}
${textHtml}${copyIcon}
${role === 'assistant' ? '
' : ''}
`; if (role === 'user') { const pair = document.createElement('div'); pair.className = 'msg-pair' + (isSearch ? ' search-pair' : ''); @@ -1449,7 +1453,7 @@ function appendMessage(role, content, animate, isSearch = false, afterEl = null) } else { container.prepend(div); } - if (content) { addCopyButtons(div); addMessageToolbar(div); } + if (content && role === 'assistant') { addCopyButtons(div); addMessageToolbar(div); } scrollToTop(); return div; }