merged pr #218 with the new streamlit
This commit is contained in:
parent
6f6a739872
commit
104e58a342
12 changed files with 15 additions and 15 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -20,6 +20,8 @@ accounts.txt
|
||||||
|
|
||||||
**/__pycache__/
|
**/__pycache__/
|
||||||
|
|
||||||
|
__pycache__/
|
||||||
|
|
||||||
*.log
|
*.log
|
||||||
|
|
||||||
cookie.json
|
cookie.json
|
||||||
|
|
Binary file not shown.
|
@ -53,8 +53,10 @@ def query_you(question: str) -> str:
|
||||||
# Return error message if an exception occurs
|
# Return error message if an exception occurs
|
||||||
return f'An error occurred: {e}. Please make sure you are using a valid cloudflare clearance token and user agent.'
|
return f'An error occurred: {e}. Please make sure you are using a valid cloudflare clearance token and user agent.'
|
||||||
|
|
||||||
# Define a dictionary containing all query methods
|
|
||||||
avail_query_methods = {
|
def query(user_input: str, selected_method: str = "Random") -> str:
|
||||||
|
# Define a dictionary containing all query methods
|
||||||
|
avail_query_methods = {
|
||||||
"Forefront": query_forefront,
|
"Forefront": query_forefront,
|
||||||
"Poe": query_quora,
|
"Poe": query_quora,
|
||||||
"Theb": query_theb,
|
"Theb": query_theb,
|
||||||
|
@ -63,9 +65,7 @@ avail_query_methods = {
|
||||||
# "T3nsor": query_t3nsor,
|
# "T3nsor": query_t3nsor,
|
||||||
# "Phind": query_phind,
|
# "Phind": query_phind,
|
||||||
# "Ora": query_ora,
|
# "Ora": query_ora,
|
||||||
}
|
}
|
||||||
|
|
||||||
def query(user_input: str, selected_method: str = "Random") -> str:
|
|
||||||
|
|
||||||
# If a specific query method is selected (not "Random") and the method is in the dictionary, try to call it
|
# If a specific query method is selected (not "Random") and the method is in the dictionary, try to call it
|
||||||
if selected_method != "Random" and selected_method in avail_query_methods:
|
if selected_method != "Random" and selected_method in avail_query_methods:
|
||||||
|
@ -98,5 +98,3 @@ def query(user_input: str, selected_method: str = "Random") -> str:
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['query', 'avail_query_methods']
|
|
||||||
|
|
|
@ -5,10 +5,11 @@ sys.path.append(os.path.join(os.path.dirname(__file__), os.path.pardir))
|
||||||
|
|
||||||
import streamlit as st
|
import streamlit as st
|
||||||
from streamlit_chat import message
|
from streamlit_chat import message
|
||||||
from query_methods import query, avail_query_methods
|
from query_methods import query
|
||||||
import pickle
|
import pickle
|
||||||
import openai_rev
|
import openai_rev
|
||||||
|
|
||||||
|
|
||||||
conversations_file = "conversations.pkl"
|
conversations_file = "conversations.pkl"
|
||||||
|
|
||||||
def load_conversations():
|
def load_conversations():
|
||||||
|
@ -71,7 +72,6 @@ if st.sidebar.button("New Conversation"):
|
||||||
st.session_state['current_conversation'] = {'user_inputs': [], 'generated_responses': []}
|
st.session_state['current_conversation'] = {'user_inputs': [], 'generated_responses': []}
|
||||||
st.session_state['input_field_key'] += 1
|
st.session_state['input_field_key'] += 1
|
||||||
|
|
||||||
print(openai_rev.Provider.__methods__.keys())
|
|
||||||
st.session_state['query_method'] = st.sidebar.selectbox(
|
st.session_state['query_method'] = st.sidebar.selectbox(
|
||||||
"Select API:",
|
"Select API:",
|
||||||
options=openai_rev.Provider.__members__.keys(),
|
options=openai_rev.Provider.__members__.keys(),
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue