I am building a Chat with Pdf app. I have three schema.
Users schema:
chat_sessions: This collection is to create chat sessions that user can come back to after they have successfully upserted PDFs or website into the knowledge base. This saves users from having to upsert again if they want to ask more questions about a PDF that they have previously upserted and chatted with. The most important fields are: linked_user (to control access), query_namespace(as a filter when querying for information), upserted_date (to sort previous chat sessions).
flowise_messages: This is to remember what questions are asked and responses are generated during a chat session. I named it “flowise_message” because “message” is already in user for another use case in my Firebase, you can simply name it “message” if you want to. The most important fields are: linked_user (to control access), linked_session (control what messages to appear for each chat sessions), is_user (to identify if this is question sent by user or a response from Flowise).
I want to delete the a chat_session and all the flowise_messages related to it when I click the delete icon.
Note: I am Query collection (chat_sessions) on the list of saved chats. I am also referencing flowise_messages collection but FlutterFlow is not allowing me to set the variable i.e. linked_session Docment Reference (chat_session) in flowise_messages with the sessionRef.