Widget:ChatBox: Unterschied zwischen den Versionen
Aus MediaWiki
Alex (Diskussion | Beiträge) Create ChatBox widget for multi-turn RAG chat |
Alex (Diskussion | Beiträge) fix: avoid && and · entities that MediaWiki HTML-encodes |
||
| Zeile 318: | Zeile 318: | ||
+ '<h5><a href="' + wikiUrl + '">' + escapeHtml(s.page_title || '') + '</a></h5>' | + '<h5><a href="' + wikiUrl + '">' + escapeHtml(s.page_title || '') + '</a></h5>' | ||
+ '<p class="chat-source-snippet">' + escapeHtml(truncate(s.content_text || '', 150)) + '</p>' | + '<p class="chat-source-snippet">' + escapeHtml(truncate(s.content_text || '', 150)) + '</p>' | ||
+ '<div class="chat-source-meta">Relevanz: ' + pct + '% | + '<div class="chat-source-meta">Relevanz: ' + pct + '% · ' + escapeHtml(s.source || '') + '</div>' | ||
+ '</div>'; | + '</div>'; | ||
}); | }); | ||
| Zeile 339: | Zeile 339: | ||
if (remaining > 0) { | if (remaining > 0) { | ||
statusEl.textContent = remaining + ' R\u00fcckfrage' + (remaining !== 1 ? 'n' : '') + ' verbleibend'; | statusEl.textContent = remaining + ' R\u00fcckfrage' + (remaining !== 1 ? 'n' : '') + ' verbleibend'; | ||
} else if (remaining === 0 | } else if (remaining === 0) { if (conversationId) { | ||
statusEl.textContent = 'Keine R\u00fcckfragen mehr m\u00f6glich'; | statusEl.textContent = 'Keine R\u00fcckfragen mehr m\u00f6glich'; | ||
input.disabled = true; | input.disabled = true; | ||
sendBtn.disabled = true; | sendBtn.disabled = true; | ||
input.placeholder = 'Starte eine neue Unterhaltung'; | input.placeholder = 'Starte eine neue Unterhaltung'; | ||
} | } } | ||
newBtn.className = conversationId ? 'visible' : ''; | newBtn.className = conversationId ? 'visible' : ''; | ||
} | } | ||