Files
gott/wwwroot/js/reply.js
T
Meleki 33934b2c4a refactor(frontend): dedupliziere JS-Code und fixe Bugs
- fix: _oldestLoadedMessageId → _oldestLoadedSortKey (chat.js, chat-page.js)
- move: formatTimestamp nach ui-helpers.js (war _formatTimestamp in msg-actions.js)
- move: _isReviewMessage nach ui-helpers.js (war in history.js)
- add: _getSubAgentMeta + _createSubAgentHeader in ui-helpers.js
- refactor: stream-ui.js + history.js nutzen _createSubAgentHeader
- refactor: flushText() Hilfsfunktion in _renderReviewGroup (history.js)
- refactor: shared-page.js nutzt _mergeConsecutiveAssistantTexts statt eigener Kopie
- refactor: _initCardMenu + _onCardMenuAction Helper in dashboard.js

-53 Zeilen netto
2026-03-09 07:17:54 +01:00

38 lines
1.1 KiB
JavaScript

// ── Reply / Quote ──
let pendingReply = null; // { index, role, text } - Zitierte Nachricht
function setReply(reply) {
pendingReply = reply;
renderReplyPreview();
document.getElementById('input')?.focus();
}
function clearReply() {
pendingReply = null;
renderReplyPreview();
}
function renderReplyPreview() {
const container = $('#replyPreview');
if (!container) return;
if (!pendingReply) {
container.innerHTML = '';
container.hidden = true;
return;
}
const roleLabel = pendingReply.role === 'user' ? 'User' : 'Assistant';
const timeLabel = formatTimestamp(pendingReply.timestamp) || 'Jetzt';
const preview = truncate(pendingReply.text, 150);
container.innerHTML = `<div class="reply-preview-item">
<span class="reply-icon"><i class="fa fa-reply"></i></span>
<span class="reply-meta">${esc(timeLabel)}, ${esc(roleLabel)}</span>
<span class="reply-text">${esc(preview)}</span>
<button class="file-remove" onclick="clearReply()"><i class="fa fa-times"></i></button>
</div>`;
container.hidden = false;
}