Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -45,7 +45,7 @@ if "generated_question" not in st.session_state:
|
|
45 |
st.session_state.generated_question = None # Stores the generated question for persistence
|
46 |
|
47 |
if "debug_logs" not in st.session_state:
|
48 |
-
st.session_state.debug_logs =
|
49 |
|
50 |
# Function to find the top 1 most similar question based on user input
|
51 |
def find_top_question(query):
|
@@ -69,8 +69,8 @@ def find_top_question(query):
|
|
69 |
|
70 |
# Function to generate response using OpenAI API with debugging logs
|
71 |
def generate_response(messages):
|
72 |
-
|
73 |
-
st.session_state.debug_logs.
|
74 |
|
75 |
response = client.chat.completions.create(
|
76 |
model="o1-mini",
|
@@ -160,9 +160,8 @@ else:
|
|
160 |
|
161 |
# Right sidebar toggleable debug logs and code interpreter section
|
162 |
with st.expander("Debug Logs (Toggle On/Off)", expanded=False):
|
163 |
-
if
|
164 |
-
|
165 |
-
st.write(log_entry)
|
166 |
|
167 |
st.sidebar.markdown("---")
|
168 |
st.sidebar.markdown("## Python Code Interpreter")
|
|
|
45 |
st.session_state.generated_question = None # Stores the generated question for persistence
|
46 |
|
47 |
if "debug_logs" not in st.session_state:
|
48 |
+
st.session_state.debug_logs = None # Stores debug logs for toggling
|
49 |
|
50 |
# Function to find the top 1 most similar question based on user input
|
51 |
def find_top_question(query):
|
|
|
69 |
|
70 |
# Function to generate response using OpenAI API with debugging logs
|
71 |
def generate_response(messages):
|
72 |
+
# For debug logs, store only the follow-up conversation history
|
73 |
+
st.session_state.debug_logs = st.session_state.messages # Update debug logs with current conversation
|
74 |
|
75 |
response = client.chat.completions.create(
|
76 |
model="o1-mini",
|
|
|
160 |
|
161 |
# Right sidebar toggleable debug logs and code interpreter section
|
162 |
with st.expander("Debug Logs (Toggle On/Off)", expanded=False):
|
163 |
+
if st.session_state.debug_logs:
|
164 |
+
st.write(st.session_state.debug_logs)
|
|
|
165 |
|
166 |
st.sidebar.markdown("---")
|
167 |
st.sidebar.markdown("## Python Code Interpreter")
|