add mentionedSurfsenseDoc atoms

This commit is contained in:
CREDO23 2026-01-13 02:52:56 +02:00
parent 5ecdfae8a9
commit 1b5f29afcc

View file

@ -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<number[]>([]);
/**
* Atom to store the full SurfSense doc objects mentioned in the current chat composer.
* This persists across component remounts.
*/
export const mentionedSurfsenseDocsAtom = atom<SurfsenseDocsDocument[]>([]);
/**
* 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<Record<string, MentionedSurfsenseDocInfo[]>>({});