diff --git a/explorer.py b/explorer.py new file mode 100644 index 000000000..54612e845 --- /dev/null +++ b/explorer.py @@ -0,0 +1,12 @@ +import streamlit as st + + +def view_document(supabase): + # Get the document from the database + response = supabase.table("documents").select("content").execute() + st.write("**This feature is in active development**") + # Display a list of elements from the documents + # If the user clicks on an element, display the content of the document + for document in response.data: + if st.button(document['content'][:50].replace("\n", " ")): + continue diff --git a/main.py b/main.py index ab7ff48ba..3e2f256db 100644 --- a/main.py +++ b/main.py @@ -9,6 +9,7 @@ from brain import brain from langchain.embeddings.openai import OpenAIEmbeddings from langchain.vectorstores import SupabaseVectorStore from supabase import Client, create_client +from explorer import view_document supabase_url = st.secrets.supabase_url supabase_key = st.secrets.supabase_service_key @@ -50,7 +51,7 @@ if 'max_tokens' not in st.session_state: # Create a radio button for user to choose between adding knowledge or asking a question user_choice = st.radio( - "Choose an action", ('Add Knowledge', 'Chat with your Brain', 'Forget')) + "Choose an action", ('Add Knowledge', 'Chat with your Brain', 'Forget', "Explore")) st.markdown("---\n\n") @@ -87,5 +88,8 @@ elif user_choice == 'Forget': st.sidebar.title("Configuration") brain(supabase) +elif user_choice == 'Explore': + st.sidebar.title("Configuration") + view_document(supabase) st.markdown("---\n\n")