Update app.py
Browse files
app.py
CHANGED
@@ -161,8 +161,11 @@ with tab1:
|
|
161 |
with st.chat_message(message["role"]):
|
162 |
st.markdown(message["content"], unsafe_allow_html=True)
|
163 |
|
164 |
-
#
|
165 |
-
|
|
|
|
|
|
|
166 |
st.chat_message("user").markdown(topic)
|
167 |
st.session_state["messages"].append({"role": "user", "content": topic})
|
168 |
|
@@ -173,11 +176,15 @@ with tab1:
|
|
173 |
else:
|
174 |
st.error("⚠️ Agents are not initialized. Please check the system or restart the app.")
|
175 |
|
176 |
-
#
|
177 |
with st.chat_message("assistant"):
|
178 |
if response and "essay" in response: # Display essay preview and allow editing
|
179 |
essay = response["essay"]
|
180 |
|
|
|
|
|
|
|
|
|
181 |
# Create Two-Column Layout
|
182 |
col1, col2 = st.columns(2)
|
183 |
|
@@ -250,6 +257,7 @@ with tab1:
|
|
250 |
else:
|
251 |
st.error("⚠️ No response received. Please try again.")
|
252 |
|
|
|
253 |
# 📊 Tab 2: Workflow Visualization
|
254 |
with tab2:
|
255 |
#st.subheader("📊 Multi-Agent Essay Writer Workflow Viz")
|
|
|
161 |
with st.chat_message(message["role"]):
|
162 |
st.markdown(message["content"], unsafe_allow_html=True)
|
163 |
|
164 |
+
# Use text_input instead of chat_input to allow a default value
|
165 |
+
topic = st.text_input("📝 Provide an essay topic:", value="Write an essay on the cultural diversity of India")
|
166 |
+
|
167 |
+
if topic:
|
168 |
+
# Store user message
|
169 |
st.chat_message("user").markdown(topic)
|
170 |
st.session_state["messages"].append({"role": "user", "content": topic})
|
171 |
|
|
|
176 |
else:
|
177 |
st.error("⚠️ Agents are not initialized. Please check the system or restart the app.")
|
178 |
|
179 |
+
# Store assistant response and display it
|
180 |
with st.chat_message("assistant"):
|
181 |
if response and "essay" in response: # Display essay preview and allow editing
|
182 |
essay = response["essay"]
|
183 |
|
184 |
+
# Store response in session state
|
185 |
+
assistant_response = f"Here is your {essay_length}-word essay preview and the download link."
|
186 |
+
st.session_state["messages"].append({"role": "assistant", "content": assistant_response})
|
187 |
+
|
188 |
# Create Two-Column Layout
|
189 |
col1, col2 = st.columns(2)
|
190 |
|
|
|
257 |
else:
|
258 |
st.error("⚠️ No response received. Please try again.")
|
259 |
|
260 |
+
|
261 |
# 📊 Tab 2: Workflow Visualization
|
262 |
with tab2:
|
263 |
#st.subheader("📊 Multi-Agent Essay Writer Workflow Viz")
|