| # components/document_store.py | |
| import streamlit as st | |
| from typing import Dict, List, Optional | |
| from utils.database import ( | |
| get_all_documents, | |
| get_collections, | |
| get_collection_documents, | |
| create_collection, | |
| add_document_to_collection, | |
| remove_from_collection, | |
| search_documents | |
| ) | |
| def display_documents_tab(): | |
| col1, col2 = st.columns([1, 2]) | |
| with col1: | |
| st.header("Collections") | |
| # Create new collection | |
| st.subheader("Create New Collection") | |
| col_name = st.text_input("Collection Name", key="doc_store_collection_name") | |
| col_desc = st.text_area("Description", height=100, key="doc_store_collection_desc") | |
| if st.button("Create Collection", use_container_width=True, key="doc_store_create_btn"): | |
| if col_name: | |
| if create_collection(st.session_state.db_conn, col_name, col_desc): | |
| st.success(f"Collection '{col_name}' created!") | |
| st.rerun() |