diff --git a/app/chat.py b/app/chat.py index f2afbeb..20c3844 100644 --- a/app/chat.py +++ b/app/chat.py @@ -313,7 +313,8 @@ def chat_page(): key="b_tool_files", format_func=lambda x: x["file_name"], ) - st.text_input("Tool Name", "get_relevant_documents", key="b_tool_name") + st.text_input( + "Tool Name", "get_relevant_documents", key="b_tool_name") st.text_input( "Tool Description", "Searches among user's private files and returns related documents", @@ -359,14 +360,16 @@ def chat_page(): ) st.markdown("### Uploaded Files") st.dataframe( - st.session_state.private_kb.list_files(st.session_state.user_name), + st.session_state.private_kb.list_files( + st.session_state.user_name), use_container_width=True, ) col_1, col_2 = st.columns(2) with col_1: st.button("Add Files", on_click=add_file) with col_2: - st.button("Clear Files and All Tools", on_click=clear_files) + st.button("Clear Files and All Tools", + on_click=clear_files) st.button("Clear Chat History", on_click=clear_history) st.button("Logout", on_click=back_to_main) diff --git a/app/login.py b/app/login.py index 937e8a8..a406f58 100644 --- a/app/login.py +++ b/app/login.py @@ -1,5 +1,3 @@ -import json -import time import pandas as pd from os import environ import streamlit as st @@ -8,14 +6,18 @@ AUTH0_CLIENT_ID = st.secrets['AUTH0_CLIENT_ID'] AUTH0_DOMAIN = st.secrets['AUTH0_DOMAIN'] + def login(): if "user_name" in st.session_state or ("jump_query_ask" in st.session_state and st.session_state.jump_query_ask): return True - st.subheader("🤗 Welcom to [MyScale](https://myscale.com)'s [ChatData](https://github.com/myscale/ChatData)! 🤗 ") + st.subheader( + "🤗 Welcom to [MyScale](https://myscale.com)'s [ChatData](https://github.com/myscale/ChatData)! 🤗 ") st.write("You can now chat with ArXiv and Wikipedia! 🌟\n") st.write("Built purely with streamlit 👑 , LangChain 🦜🔗 and love ❤️ for AI!") - st.write("Follow us on [Twitter](https://x.com/myscaledb) and [Discord](https://discord.gg/D2qpkqc4Jq)!") - st.write("For more details, please refer to [our repository on GitHub](https://github.com/myscale/ChatData)!") + st.write( + "Follow us on [Twitter](https://x.com/myscaledb) and [Discord](https://discord.gg/D2qpkqc4Jq)!") + st.write( + "For more details, please refer to [our repository on GitHub](https://github.com/myscale/ChatData)!") st.divider() col1, col2 = st.columns(2, gap='large') with col1.container(): @@ -33,7 +35,7 @@ def login(): st.write("- [Privacy Policy](https://myscale.com/privacy/)\n" "- [Terms of Sevice](https://myscale.com/terms/)") if st.session_state.auth0 is not None: - st.session_state.user_info = dict(st.session_state.auth0) + st.session_state.user_info = dict(st.session_state.auth0) if 'email' in st.session_state.user_info: email = st.session_state.user_info["email"] else: @@ -44,6 +46,7 @@ def login(): if st.session_state.jump_query_ask: st.experimental_rerun() + def back_to_main(): if "user_info" in st.session_state: del st.session_state.user_info