MCPcopy Create free account
hub / github.com/CreminiAI/skillpack / appendMessage

Function appendMessage

web/js/chat.js:740–765  ·  view source on GitHub ↗
(role, text, toolCalls = [])

Source from the content-addressed store, hash-verified

738}
739
740function appendMessage(role, text, toolCalls = []) {
741 const messages = document.getElementById("messages");
742 const div = document.createElement("div");
743 div.className = "message " + role;
744
745 if (role === "user") {
746 div.innerHTML = '<div class="content">' + escapeHtml(text) + "</div>";
747 } else if (text) {
748 const tb = document.createElement("div");
749 tb.className = "content text-block markdown-body";
750 tb.dataset.mdContent = text;
751 tb.innerHTML = renderMarkdown(text);
752 div.appendChild(tb);
753 }
754
755 if (role === "assistant") {
756 const sendFileCalls = getVisibleSendFileToolCalls(toolCalls);
757 sendFileCalls.forEach((toolCall) => {
758 appendFileCard(div, toolCall.arguments.filePath, toolCall.arguments.caption);
759 });
760 }
761
762 messages.appendChild(div);
763 scrollToBottom();
764 return div;
765}
766
767function escapeHtml(text) {
768 const div = document.createElement("div");

Callers 5

sendMessageFunction · 0.85
sendBotCommandFunction · 0.85
loadConversationHistoryFunction · 0.85
handleErrorFunction · 0.85

Calls 5

renderMarkdownFunction · 0.85
appendFileCardFunction · 0.85
scrollToBottomFunction · 0.85
escapeHtmlFunction · 0.70

Tested by

no test coverage detected