mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-01 11:56:25 +02:00
refactor: enhance document mention functionality in chat by introducing pending mentions and removals atoms, and updating DocumentsSidebar and Composer components for improved document management
This commit is contained in:
parent
95a0e35393
commit
f0e4aa6539
7 changed files with 261 additions and 237 deletions
|
|
@ -1,7 +1,7 @@
|
|||
"use client";
|
||||
|
||||
import { atom } from "jotai";
|
||||
import type { Document, SurfsenseDocsDocument } from "@/contracts/types/document.types";
|
||||
import type { Document } from "@/contracts/types/document.types";
|
||||
|
||||
/**
|
||||
* Atom to store the IDs of documents mentioned in the current chat composer.
|
||||
|
|
@ -30,6 +30,22 @@ 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