File size: 991 Bytes
40dbd2c
 
 
17ff205
40dbd2c
 
 
 
 
 
17ff205
 
40dbd2c
 
 
 
 
 
 
 
4a2b28d
746f752
4a2b28d
 
 
746f752
 
 
4a2b28d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# 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()