feat(explorer): beta

This commit is contained in:
Stan Girard 2023-05-16 17:04:45 +02:00
parent 79b8c55ce9
commit adfb2c75cb
2 changed files with 17 additions and 1 deletions

12
explorer.py Normal file
View File

@ -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

View File

@ -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")