MCPcopy Create free account
hub / github.com/Alphanimble/htmlstream / loadServerSession

Function loadServerSession

demo/chat/session.ts:88–102  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86}
87
88export async function loadServerSession(): Promise<ChatSession | null> {
89 try {
90 const res = await fetch("/api/session");
91 if (!res.ok) {
92 return null;
93 }
94 const parsed = (await res.json()) as ChatSession | null;
95 if (!parsed?.id || !Array.isArray(parsed.messages)) {
96 return null;
97 }
98 return repairSession(parsed);
99 } catch {
100 return null;
101 }
102}
103
104export async function saveServerSession(session: ChatSession): Promise<void> {
105 try {

Callers 1

ChatAppFunction · 0.90

Calls 1

repairSessionFunction · 0.85

Tested by

no test coverage detected