mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-30 19:36:25 +02:00
refactor: integrate sidebar document selections into chat functionality, enhancing document mention management and improving user experience in the Composer and DocumentsSidebar components
This commit is contained in:
parent
f0e4aa6539
commit
3be26429ca
5 changed files with 72 additions and 96 deletions
|
|
@ -16,11 +16,17 @@ export const mentionedDocumentIdsAtom = atom<{
|
|||
});
|
||||
|
||||
/**
|
||||
* Atom to store the full document objects mentioned in the current chat composer.
|
||||
* This persists across component remounts.
|
||||
* Atom to store the full document objects mentioned via @-mention chips
|
||||
* in the current chat composer. This persists across component remounts.
|
||||
*/
|
||||
export const mentionedDocumentsAtom = atom<Pick<Document, "id" | "title" | "document_type">[]>([]);
|
||||
|
||||
/**
|
||||
* Atom to store documents selected via the sidebar checkboxes / row clicks.
|
||||
* These are NOT inserted as chips – the composer shows a count badge instead.
|
||||
*/
|
||||
export const sidebarSelectedDocumentsAtom = atom<Pick<Document, "id" | "title" | "document_type">[]>([]);
|
||||
|
||||
/**
|
||||
* Simplified document info for display purposes
|
||||
*/
|
||||
|
|
@ -30,22 +36,6 @@ export interface MentionedDocumentInfo {
|
|||
document_type: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue atom for sidebar → composer communication (additions).
|
||||
* The sidebar writes documents here; the Composer picks them up,
|
||||
* inserts chips, and clears the queue.
|
||||
*/
|
||||
export const pendingDocumentMentionsAtom = atom<
|
||||
Pick<Document, "id" | "title" | "document_type">[]
|
||||
>([]);
|
||||
|
||||
/**
|
||||
* Queue atom for sidebar → composer communication (removals).
|
||||
* The sidebar writes { id, document_type } here; the Composer removes
|
||||
* the matching chips and clears the queue.
|
||||
*/
|
||||
export const pendingDocumentRemovalsAtom = atom<{ id: number; document_type?: string }[]>([]);
|
||||
|
||||
/**
|
||||
* Atom to store mentioned documents per message ID.
|
||||
* This allows displaying which documents were mentioned with each user message.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue