lqhl commited on
Commit
ff7aa95
β€’
1 Parent(s): 6fdfcee

Synced repo using 'sync_with_huggingface' Github Action

Browse files
Files changed (3) hide show
  1. .streamlit/secrets.example.toml +6 -0
  2. chat.py +3 -6
  3. login.py +6 -9
.streamlit/secrets.example.toml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ MYSCALE_HOST = "msc-4a9e710a.us-east-1.aws.staging.myscale.cloud"
2
+ MYSCALE_PORT = 443
3
+ MYSCALE_USER = "chatdata"
4
+ MYSCALE_PASSWORD = "myscale_rocks"
5
+ OPENAI_API_BASE = "https://api.openai.com/v1"
6
+ OPENAI_API_KEY = "<your-openai-key>"
chat.py CHANGED
@@ -313,8 +313,7 @@ def chat_page():
313
  key="b_tool_files",
314
  format_func=lambda x: x["file_name"],
315
  )
316
- st.text_input(
317
- "Tool Name", "get_relevant_documents", key="b_tool_name")
318
  st.text_input(
319
  "Tool Description",
320
  "Searches among user's private files and returns related documents",
@@ -360,16 +359,14 @@ def chat_page():
360
  )
361
  st.markdown("### Uploaded Files")
362
  st.dataframe(
363
- st.session_state.private_kb.list_files(
364
- st.session_state.user_name),
365
  use_container_width=True,
366
  )
367
  col_1, col_2 = st.columns(2)
368
  with col_1:
369
  st.button("Add Files", on_click=add_file)
370
  with col_2:
371
- st.button("Clear Files and All Tools",
372
- on_click=clear_files)
373
 
374
  st.button("Clear Chat History", on_click=clear_history)
375
  st.button("Logout", on_click=back_to_main)
 
313
  key="b_tool_files",
314
  format_func=lambda x: x["file_name"],
315
  )
316
+ st.text_input("Tool Name", "get_relevant_documents", key="b_tool_name")
 
317
  st.text_input(
318
  "Tool Description",
319
  "Searches among user's private files and returns related documents",
 
359
  )
360
  st.markdown("### Uploaded Files")
361
  st.dataframe(
362
+ st.session_state.private_kb.list_files(st.session_state.user_name),
 
363
  use_container_width=True,
364
  )
365
  col_1, col_2 = st.columns(2)
366
  with col_1:
367
  st.button("Add Files", on_click=add_file)
368
  with col_2:
369
+ st.button("Clear Files and All Tools", on_click=clear_files)
 
370
 
371
  st.button("Clear Chat History", on_click=clear_history)
372
  st.button("Logout", on_click=back_to_main)
login.py CHANGED
@@ -1,3 +1,5 @@
 
 
1
  import pandas as pd
2
  from os import environ
3
  import streamlit as st
@@ -6,18 +8,14 @@ from auth0_component import login_button
6
  AUTH0_CLIENT_ID = st.secrets['AUTH0_CLIENT_ID']
7
  AUTH0_DOMAIN = st.secrets['AUTH0_DOMAIN']
8
 
9
-
10
  def login():
11
  if "user_name" in st.session_state or ("jump_query_ask" in st.session_state and st.session_state.jump_query_ask):
12
  return True
13
- st.subheader(
14
- "πŸ€— Welcom to [MyScale](https://myscale.com)'s [ChatData](https://github.com/myscale/ChatData)! πŸ€— ")
15
  st.write("You can now chat with ArXiv and Wikipedia! 🌟\n")
16
  st.write("Built purely with streamlit πŸ‘‘ , LangChain πŸ¦œπŸ”— and love ❀️ for AI!")
17
- st.write(
18
- "Follow us on [Twitter](https://x.com/myscaledb) and [Discord](https://discord.gg/D2qpkqc4Jq)!")
19
- st.write(
20
- "For more details, please refer to [our repository on GitHub](https://github.com/myscale/ChatData)!")
21
  st.divider()
22
  col1, col2 = st.columns(2, gap='large')
23
  with col1.container():
@@ -35,7 +33,7 @@ def login():
35
  st.write("- [Privacy Policy](https://myscale.com/privacy/)\n"
36
  "- [Terms of Sevice](https://myscale.com/terms/)")
37
  if st.session_state.auth0 is not None:
38
- st.session_state.user_info = dict(st.session_state.auth0)
39
  if 'email' in st.session_state.user_info:
40
  email = st.session_state.user_info["email"]
41
  else:
@@ -46,7 +44,6 @@ def login():
46
  if st.session_state.jump_query_ask:
47
  st.experimental_rerun()
48
 
49
-
50
  def back_to_main():
51
  if "user_info" in st.session_state:
52
  del st.session_state.user_info
 
1
+ import json
2
+ import time
3
  import pandas as pd
4
  from os import environ
5
  import streamlit as st
 
8
  AUTH0_CLIENT_ID = st.secrets['AUTH0_CLIENT_ID']
9
  AUTH0_DOMAIN = st.secrets['AUTH0_DOMAIN']
10
 
 
11
  def login():
12
  if "user_name" in st.session_state or ("jump_query_ask" in st.session_state and st.session_state.jump_query_ask):
13
  return True
14
+ st.subheader("πŸ€— Welcom to [MyScale](https://myscale.com)'s [ChatData](https://github.com/myscale/ChatData)! πŸ€— ")
 
15
  st.write("You can now chat with ArXiv and Wikipedia! 🌟\n")
16
  st.write("Built purely with streamlit πŸ‘‘ , LangChain πŸ¦œπŸ”— and love ❀️ for AI!")
17
+ st.write("Follow us on [Twitter](https://x.com/myscaledb) and [Discord](https://discord.gg/D2qpkqc4Jq)!")
18
+ st.write("For more details, please refer to [our repository on GitHub](https://github.com/myscale/ChatData)!")
 
 
19
  st.divider()
20
  col1, col2 = st.columns(2, gap='large')
21
  with col1.container():
 
33
  st.write("- [Privacy Policy](https://myscale.com/privacy/)\n"
34
  "- [Terms of Sevice](https://myscale.com/terms/)")
35
  if st.session_state.auth0 is not None:
36
+ st.session_state.user_info = dict(st.session_state.auth0)
37
  if 'email' in st.session_state.user_info:
38
  email = st.session_state.user_info["email"]
39
  else:
 
44
  if st.session_state.jump_query_ask:
45
  st.experimental_rerun()
46
 
 
47
  def back_to_main():
48
  if "user_info" in st.session_state:
49
  del st.session_state.user_info