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

Function loadChatSession

deployments/desktop/static/desktop.js:4418–4440  ·  view source on GitHub ↗
(sessionId)

Source from the content-addressed store, hash-verified

4416 }
4417
4418 async function loadChatSession(sessionId) {
4419 const normalizedSessionId = String(sessionId || "").trim();
4420 if (!normalizedSessionId) {
4421 startNewChat({ silent: true });
4422 return;
4423 }
4424 const token = ++state.chatLoadToken;
4425 let data;
4426 try {
4427 data = await api(`/api/chat/session?user_id=${encodeURIComponent(currentUser())}&session_id=${encodeURIComponent(normalizedSessionId)}`);
4428 } catch (error) {
4429 if (isUnknownApiRoute(error, "/api/chat/session")) {
4430 renderChatHistoryUnavailable();
4431 return;
4432 }
4433 throw error;
4434 }
4435 if (token !== state.chatLoadToken) return;
4436 if (!data.session) throw new Error(ui().chat.missingSession);
4437 state.chatSessionId = data.session.session_id || normalizedSessionId;
4438 renderChatMessages(data.messages || []);
4439 renderChatHistory({ sessions: state.chatHistory, groups: state.chatHistoryGroups });
4440 }
4441
4442 async function clearChatHistory() {
4443 const count = state.chatHistory.length;

Callers 2

loadChatSessionsFunction · 0.85
bindEventsFunction · 0.85

Calls 8

startNewChatFunction · 0.85
currentUserFunction · 0.85
isUnknownApiRouteFunction · 0.85
uiFunction · 0.85
renderChatMessagesFunction · 0.85
renderChatHistoryFunction · 0.85
apiFunction · 0.70

Tested by

no test coverage detected