File size: 1,006 Bytes
21cef57
 
 
 
 
 
 
 
 
 
 
02b71a7
21cef57
 
02b71a7
 
 
 
 
21cef57
 
 
 
 
 
 
 
 
02b71a7
 
 
 
 
 
21cef57
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
30
31
32
33
34
35
36
import streamlit as st
from retrieve_kb import get_current_knowledge_bases
from app import client, show_sidebar
from utils import get_chroma_client


st.title("Delete knowledge Base ☠️")
show_sidebar()


kbs = get_current_knowledge_bases(client=client)
kbs = sorted(kb.name for kb in kbs)
collection_name = st.selectbox("Select knowledge box to delete", kbs)
if st.button("Delete Forever"):
    try:
        client.delete_collection(collection_name)
        st.success("Deleted")
    except Exception as e:
        st.error(f"{str(e)}")
    st.experimental_rerun()


# Title of the app
st.title("Create a knowledge box")
show_sidebar()

collection_name = st.text_input(label="empy collection name")
if st.button("create empty knowledge box"):
    try:
        client = get_chroma_client()
        collection = client.create_collection(name=collection_name)
        st.success(f"collection {collection_name} created")
    except Exception as e:
        st.error(f"{str(e)}")
    st.experimental_rerun()