mirror of
https://github.com/StanGirard/quivr.git
synced 2025-01-05 10:08:28 +03:00
feat(explorer): beta
This commit is contained in:
parent
79b8c55ce9
commit
adfb2c75cb
12
explorer.py
Normal file
12
explorer.py
Normal 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
|
6
main.py
6
main.py
@ -9,6 +9,7 @@ from brain import brain
|
|||||||
from langchain.embeddings.openai import OpenAIEmbeddings
|
from langchain.embeddings.openai import OpenAIEmbeddings
|
||||||
from langchain.vectorstores import SupabaseVectorStore
|
from langchain.vectorstores import SupabaseVectorStore
|
||||||
from supabase import Client, create_client
|
from supabase import Client, create_client
|
||||||
|
from explorer import view_document
|
||||||
|
|
||||||
supabase_url = st.secrets.supabase_url
|
supabase_url = st.secrets.supabase_url
|
||||||
supabase_key = st.secrets.supabase_service_key
|
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
|
# Create a radio button for user to choose between adding knowledge or asking a question
|
||||||
user_choice = st.radio(
|
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")
|
st.markdown("---\n\n")
|
||||||
|
|
||||||
@ -87,5 +88,8 @@ elif user_choice == 'Forget':
|
|||||||
st.sidebar.title("Configuration")
|
st.sidebar.title("Configuration")
|
||||||
|
|
||||||
brain(supabase)
|
brain(supabase)
|
||||||
|
elif user_choice == 'Explore':
|
||||||
|
st.sidebar.title("Configuration")
|
||||||
|
view_document(supabase)
|
||||||
|
|
||||||
st.markdown("---\n\n")
|
st.markdown("---\n\n")
|
||||||
|
Loading…
Reference in New Issue
Block a user