spandana30 commited on
Commit
83a2d42
Β·
verified Β·
1 Parent(s): 3153158

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -4
app.py CHANGED
@@ -125,10 +125,23 @@ def main():
125
  b64 = base64.b64encode(html.encode()).decode()
126
  st.markdown(f'<a href="data:file/html;base64,{b64}" download="ui.html">Download HTML</a>', unsafe_allow_html=True)
127
 
128
- st.subheader("🧠 Agent Log")
129
- log = "".join([f"---\n{m['role'].title()}:\n{m['content']}\n\n" for m in final_state["messages"]])
130
- st.text_area("Agent Communication", value=log, height=300)
131
-
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  st.subheader("πŸ“Š Performance")
133
  st.write(f"⏱️ Total Time: {total_time:.2f} seconds")
134
  st.write(f"πŸ” Iterations: {final_state['iteration']}")
 
125
  b64 = base64.b64encode(html.encode()).decode()
126
  st.markdown(f'<a href="data:file/html;base64,{b64}" download="ui.html">Download HTML</a>', unsafe_allow_html=True)
127
 
128
+ # Communication History
129
+ st.subheader("🧠 Agent Communication Log")
130
+ history_text = ""
131
+ for msg in final_state["messages"]:
132
+ role = msg["role"].replace("_", " ").title()
133
+ content = msg["content"]
134
+ history_text += f"---\n{role}:\n{content}\n\n"
135
+ st.text_area("Agent Dialogue", value=history_text, height=300)
136
+
137
+ # Download Chat Log
138
+ b64_hist = base64.b64encode(history_text.encode()).decode()
139
+ st.markdown(
140
+ f'<a href="data:file/txt;base64,{b64_hist}" download="agent_communication.txt" '
141
+ 'style="padding: 0.4em 1em; background: #4CAF50; color: white; border-radius: 0.3em; text-decoration: none;">'
142
+ 'πŸ“₯ Download Communication Log</a>',
143
+ unsafe_allow_html=True
144
+ )
145
  st.subheader("πŸ“Š Performance")
146
  st.write(f"⏱️ Total Time: {total_time:.2f} seconds")
147
  st.write(f"πŸ” Iterations: {final_state['iteration']}")