6Genix commited on
Commit
cd48cb7
·
1 Parent(s): 38ac42c

Addressed redundancy, formatting, notes, while focusing on goals.

Browse files
Files changed (1) hide show
  1. app.py +8 -16
app.py CHANGED
@@ -81,7 +81,7 @@ def summarize_conversation(conversation):
81
  """
82
  Summarize the entire conversation to produce a comprehensive plan.
83
  """
84
- summary = "**Final Plan:**\n"
85
  for speaker, text in conversation:
86
  if speaker not in ["User", "Summary"]:
87
  summary += f"- **{speaker}:** {text}\n"
@@ -100,12 +100,12 @@ if "conversation" not in st.session_state:
100
  if "user_input" not in st.session_state:
101
  st.session_state.user_input = ""
102
 
103
- st.text_area("User Input:", value=st.session_state.user_input, height=100, max_chars=None, key="user_input")
104
 
105
- if st.button("Start/Continue Conversation"):
106
  if st.session_state.user_input.strip():
107
  user_text = st.session_state.user_input
108
- st.session_state.conversation.append(("User", user_text))
109
 
110
  # Engineer generates a response
111
  with st.spinner("Engineer is formulating a solution..."):
@@ -117,7 +117,7 @@ if st.button("Start/Continue Conversation"):
117
  st.session_state.conversation.append(("Engineer", engineer_resp))
118
 
119
  # Display Engineer response immediately
120
- st.markdown(f"**Engineer:** {engineer_resp}")
121
 
122
  # Analyst generates a response based on engineer's output
123
  with st.spinner("Analyst is analyzing data and providing insights..."):
@@ -130,18 +130,10 @@ if st.button("Start/Continue Conversation"):
130
  st.session_state.conversation.append(("Analyst", analyst_resp))
131
 
132
  # Display Analyst response immediately
133
- st.markdown(f"**Analyst:** {analyst_resp}")
134
 
135
- # Limit the conversation to 1 iteration
136
  with st.spinner("Generating the final plan..."):
137
  final_plan = summarize_conversation(st.session_state.conversation)
138
  st.session_state.conversation.append(("Summary", final_plan))
139
- st.markdown(final_plan)
140
-
141
- for speaker, text in st.session_state.conversation:
142
- if speaker == "User":
143
- st.markdown(f"**{speaker}:** {text}")
144
- elif speaker == "Summary":
145
- st.markdown(f"**{speaker}:** {text}")
146
- else:
147
- st.markdown(f"**{speaker}:** {text}")
 
81
  """
82
  Summarize the entire conversation to produce a comprehensive plan.
83
  """
84
+ summary = "### Final Plan\n"
85
  for speaker, text in conversation:
86
  if speaker not in ["User", "Summary"]:
87
  summary += f"- **{speaker}:** {text}\n"
 
100
  if "user_input" not in st.session_state:
101
  st.session_state.user_input = ""
102
 
103
+ st.text_area("Enter your query:", value=st.session_state.user_input, height=100, max_chars=None, key="user_input")
104
 
105
+ if st.button("Generate Responses"):
106
  if st.session_state.user_input.strip():
107
  user_text = st.session_state.user_input
108
+ st.session_state.conversation = [("User", user_text)] # Clear and restart conversation
109
 
110
  # Engineer generates a response
111
  with st.spinner("Engineer is formulating a solution..."):
 
117
  st.session_state.conversation.append(("Engineer", engineer_resp))
118
 
119
  # Display Engineer response immediately
120
+ st.markdown(f"### Engineer Response\n{engineer_resp}")
121
 
122
  # Analyst generates a response based on engineer's output
123
  with st.spinner("Analyst is analyzing data and providing insights..."):
 
130
  st.session_state.conversation.append(("Analyst", analyst_resp))
131
 
132
  # Display Analyst response immediately
133
+ st.markdown(f"### Analyst Response\n{analyst_resp}")
134
 
135
+ # Summarize the final plan
136
  with st.spinner("Generating the final plan..."):
137
  final_plan = summarize_conversation(st.session_state.conversation)
138
  st.session_state.conversation.append(("Summary", final_plan))
139
+ st.markdown(final_plan)