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

Function loadChatSessions

deployments/desktop/static/desktop.js:4395–4416  ·  view source on GitHub ↗
(options = {})

Source from the content-addressed store, hash-verified

4393 }
4394
4395 async function loadChatSessions(options = {}) {
4396 let data;
4397 try {
4398 data = await api(`/api/chat/sessions?user_id=${encodeURIComponent(currentUser())}&days=90&limit=120`);
4399 } catch (error) {
4400 if (isUnknownApiRoute(error, "/api/chat/sessions")) {
4401 renderChatHistoryUnavailable();
4402 return;
4403 }
4404 throw error;
4405 }
4406 state.chatHistoryLoaded = true;
4407 renderChatHistory(data);
4408 if (options.openLatest && !state.chatSessionId) {
4409 const latest = state.chatHistory[0];
4410 if (latest?.session_id) {
4411 await loadChatSession(latest.session_id);
4412 } else {
4413 resetChatThread();
4414 }
4415 }
4416 }
4417
4418 async function loadChatSession(sessionId) {
4419 const normalizedSessionId = String(sessionId || "").trim();

Callers 3

setViewFunction · 0.85
askWikiFunction · 0.85
bindEventsFunction · 0.85

Calls 7

currentUserFunction · 0.85
isUnknownApiRouteFunction · 0.85
renderChatHistoryFunction · 0.85
loadChatSessionFunction · 0.85
resetChatThreadFunction · 0.85
apiFunction · 0.70

Tested by

no test coverage detected