MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / renderChatSources

Function renderChatSources

deployments/desktop/static/desktop.js:4242–4259  ·  view source on GitHub ↗
(sources = DEMO_MODE ? demoSources : [])

Source from the content-addressed store, hash-verified

4240 }
4241
4242 function renderChatSources(sources = DEMO_MODE ? demoSources : []) {
4243 const items = Array.isArray(sources) ? sources.map((source, index) => normalizeCitationSource(source, index)) : [];
4244 state.chatSources = items;
4245 $("chatSources").className = items.length ? "source-list" : "source-list empty";
4246 $("chatSources").innerHTML = items.length ? items.map((source) => {
4247 const openControl = source.url
4248 ? `<a href="${escapeHtml(source.url)}" target="_blank" rel="noreferrer">${escapeHtml(ui().chat.openSource)}</a>`
4249 : `<button type="button" data-open-citation-source data-node-id="${escapeHtml(source.node_id)}" data-title="${escapeHtml(source.title)}">${escapeHtml(ui().chat.viewSource)}</button>`;
4250 return `
4251 <div class="source-card citation-card" tabindex="0" data-citation-index="${escapeHtml(source.index)}" data-node-id="${escapeHtml(source.node_id)}" data-title="${escapeHtml(source.title)}">
4252 <h3>[${escapeHtml(source.index)}] ${escapeHtml(source.title)}</h3>
4253 <p>${escapeHtml(source.meta)}</p>
4254 ${source.snippet ? `<p>${escapeHtml(source.snippet)}</p>` : ""}
4255 ${openControl}
4256 </div>
4257 `;
4258 }).join("") : ui().chat.sourcesEmpty;
4259 }
4260
4261 function chatIntroHtml() {
4262 return `

Callers 6

resetChatThreadFunction · 0.85
renderChatMessagesFunction · 0.85
clearChatHistoryFunction · 0.85
processFrameFunction · 0.85
askWikiFunction · 0.85
initFunction · 0.85

Calls 4

normalizeCitationSourceFunction · 0.85
uiFunction · 0.85
$Function · 0.70
escapeHtmlFunction · 0.70

Tested by

no test coverage detected