(frame)
| 4540 | data.pull_warning ? `${labels.warning}: ${data.pull_warning}` : "", |
| 4541 | llm.summary ? `${labels.llmReview}: ${llm.summary}` : "" |
| 4542 | ].filter(Boolean).join("\n"); |
| 4543 | $("wikiStats").textContent = `${summary} · GitHub`; |
| 4544 | setWikiEntry(labels.resultTitle, detail, "", { renderRelations: false }); |
| 4545 | showFeedbackToast("success", labels.successTitle, summary); |
| 4546 | } catch (error) { |
| 4547 | const message = error.message || String(error); |
| 4548 | $("wikiStats").textContent = ui().wiki.githubSync.failureTitle; |
| 4549 | showFeedbackToast("error", ui().wiki.githubSync.failureTitle, message); |
| 4550 | error.paperflowToastShown = true; |
| 4551 | throw error; |
| 4552 | } |
| 4553 | } |
| 4554 | |
| 4555 | async function searchWiki() { |
| 4556 | const rawQuery = $("wikiQuery").value.trim(); |
| 4557 | if (!rawQuery) { |
| 4558 | await loadWiki(); |
| 4559 | return; |
| 4560 | } |
| 4561 | const data = await api(`/api/wiki/search?user_id=${encodeURIComponent(currentUser())}&q=${encodeURIComponent(rawQuery)}&limit=20`); |
| 4562 | const nodes = data.nodes || []; |
| 4563 | state.wikiNodes = nodes; |
| 4564 | try { |
| 4565 | const graph = await api(`/api/wiki/graph?user_id=${encodeURIComponent(currentUser())}&q=${encodeURIComponent(rawQuery)}&limit=120`); |
| 4566 | if (graph.nodes?.length) state.wikiGraph = graph; |
| 4567 | } catch (error) { |
| 4568 | console.warn("Wiki search graph unavailable.", error); |
| 4569 | } |
| 4570 | renderWikiResultNodes(nodes, ui().wiki.resultsCount(nodes.length)); |
| 4571 | if (nodes[0]) setWikiEntry(rawGraphTitle(nodes[0]), rawGraphBody(nodes[0]), nodes[0].node_id || graphId(nodes[0]), { renderRelations: false }); |
| 4572 | if (state.wikiView === "graph") renderWikiGraph(); |
| 4573 | if (state.wikiView === "list") renderWikiList(); |
| 4574 | } |
| 4575 | |
| 4576 | function normalizeCitationSource(source, index = 0) { |
| 4577 | const metadata = source?.metadata || {}; |
no test coverage detected