Skip to content

Commit

Permalink
test sync
Browse files Browse the repository at this point in the history
  • Loading branch information
lqhl committed Jan 15, 2024
1 parent 19ae25e commit 6099eab
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
9 changes: 6 additions & 3 deletions app/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand Down
15 changes: 9 additions & 6 deletions app/login.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import json
import time
import pandas as pd
from os import environ
import streamlit as st
Expand All @@ -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():
Expand All @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 6099eab

Please sign in to comment.