From 104e58a3421665fc3acfd7fea8e1317fe1181c6d Mon Sep 17 00:00:00 2001 From: noptuno Date: Thu, 27 Apr 2023 20:48:00 -0400 Subject: merged pr #218 with the new streamlit --- gui/query_methods.py | 24 +++++++++++------------- gui/streamlit_chat_app.py | 4 ++-- 2 files changed, 13 insertions(+), 15 deletions(-) (limited to 'gui') diff --git a/gui/query_methods.py b/gui/query_methods.py index 08a81b64..49946900 100644 --- a/gui/query_methods.py +++ b/gui/query_methods.py @@ -53,19 +53,19 @@ def query_you(question: str) -> str: # 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.' -# Define a dictionary containing all query methods -avail_query_methods = { - "Forefront": query_forefront, - "Poe": query_quora, - "Theb": query_theb, - "You": query_you, - # "Writesonic": query_writesonic, - # "T3nsor": query_t3nsor, - # "Phind": query_phind, - # "Ora": query_ora, -} def query(user_input: str, selected_method: str = "Random") -> str: + # Define a dictionary containing all query methods + avail_query_methods = { + "Forefront": query_forefront, + "Poe": query_quora, + "Theb": query_theb, + "You": query_you, + # "Writesonic": query_writesonic, + # "T3nsor": query_t3nsor, + # "Phind": query_phind, + # "Ora": query_ora, + } # 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: @@ -98,5 +98,3 @@ def query(user_input: str, selected_method: str = "Random") -> str: return result - -__all__ = ['query', 'avail_query_methods'] diff --git a/gui/streamlit_chat_app.py b/gui/streamlit_chat_app.py index 09d53bcf..aee3563e 100644 --- a/gui/streamlit_chat_app.py +++ b/gui/streamlit_chat_app.py @@ -5,10 +5,11 @@ sys.path.append(os.path.join(os.path.dirname(__file__), os.path.pardir)) import streamlit as st from streamlit_chat import message -from query_methods import query, avail_query_methods +from query_methods import query import pickle import openai_rev + conversations_file = "conversations.pkl" 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['input_field_key'] += 1 -print(openai_rev.Provider.__methods__.keys()) st.session_state['query_method'] = st.sidebar.selectbox( "Select API:", options=openai_rev.Provider.__members__.keys(), -- cgit v1.2.3