okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221apps/host: the owner's UI and the Node App Host0b3299a01

main
675 B14 linesraw
1import type { Session } from './types';
2
3export function sessionLog(session: Session) {
4  return JSON.stringify({ schema: 'strata.session-log/1', exportedAt: new Date().toISOString(), session }, null, 2);
5}
6
7export function downloadSessionLog(session: Session) {
8  const url = URL.createObjectURL(new Blob([sessionLog(session)], { type: 'application/json' }));
9  const link = document.createElement('a');
10  const name = session.title.replace(/[^\p{L}\p{N}._-]+/gu, '-').slice(0, 80) || 'chat';
11  link.href = url; link.download = `${name}-session-log.json`;
12  document.body.appendChild(link); link.click(); link.remove();
13  setTimeout(() => URL.revokeObjectURL(url), 1000);
14}