okami.mom/strata

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

Niko1221Merge f-0243-guifix into f-0243-rel9caf39495

main
483 B8 linesraw
1import type { Session, Workspace } from './types';
2
3/** The workspace a chat was made in: the sidebar groups chats by this same rule (the saved path, or an earlier folder of the workspace). */
4export function workspaceIdForSession(workspaces: Workspace[], session: Pick<Session, 'workspace'> | null | undefined): string | null {
5  const path = session?.workspace;
6  if (!path) return null;
7  return workspaces.find(w => w.path === path || !!w.aliases?.includes(path))?.id ?? null;
8}