From 1b5f29afccc499ae990c49cb39a002c926c7babd Mon Sep 17 00:00:00 2001 From: CREDO23 Date: Tue, 13 Jan 2026 02:52:56 +0200 Subject: [PATCH] add mentionedSurfsenseDoc atoms --- .../chat/mentioned-surfsense-docs.atom.ts | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 surfsense_web/atoms/chat/mentioned-surfsense-docs.atom.ts diff --git a/surfsense_web/atoms/chat/mentioned-surfsense-docs.atom.ts b/surfsense_web/atoms/chat/mentioned-surfsense-docs.atom.ts new file mode 100644 index 000000000..aa4a84e05 --- /dev/null +++ b/surfsense_web/atoms/chat/mentioned-surfsense-docs.atom.ts @@ -0,0 +1,32 @@ +"use client"; + +import { atom } from "jotai"; +import type { SurfsenseDocsDocument } from "@/contracts/types/document.types"; + +/** + * Atom to store the IDs of SurfSense docs mentioned in the current chat composer. + * This is used to pass documentation context to the backend when sending a message. + */ +export const mentionedSurfsenseDocIdsAtom = atom([]); + +/** + * Atom to store the full SurfSense doc objects mentioned in the current chat composer. + * This persists across component remounts. + */ +export const mentionedSurfsenseDocsAtom = atom([]); + +/** + * Simplified SurfSense doc info for display purposes + */ +export interface MentionedSurfsenseDocInfo { + id: number; + title: string; + source: string; +} + +/** + * Atom to store mentioned SurfSense docs per message ID. + * This allows displaying which docs were mentioned with each user message. + */ +export const messageSurfsenseDocsMapAtom = atom>({}); +