Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -31,18 +31,21 @@ if summarise_button:
|
|
31 |
# Generate summary from conversation buffer
|
32 |
summary = str(st.session_state['conversation'].memory.buffer)
|
33 |
|
34 |
-
#
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
st.markdown("<h3 style='text-align: center;'>Summary of Conversation</h3>", unsafe_allow_html=True)
|
37 |
|
38 |
-
# Display the summary in the chat UI format
|
39 |
summary_container = st.container()
|
40 |
with summary_container:
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
if line.strip(): # Avoid blank lines
|
45 |
-
message(line.strip(), is_user=False, key=f"summary_{i}")
|
46 |
else:
|
47 |
st.sidebar.write("No conversation history to summarize.")
|
48 |
|
|
|
31 |
# Generate summary from conversation buffer
|
32 |
summary = str(st.session_state['conversation'].memory.buffer)
|
33 |
|
34 |
+
# Split summary into sentences
|
35 |
+
summary_sentences = summary.strip().split(". ")
|
36 |
+
|
37 |
+
# Exclude the first two sentences
|
38 |
+
filtered_summary = summary_sentences[2:]
|
39 |
+
|
40 |
+
# Display the remaining summary in chat-like format
|
41 |
+
st.markdown("---") # Separator line
|
42 |
st.markdown("<h3 style='text-align: center;'>Summary of Conversation</h3>", unsafe_allow_html=True)
|
43 |
|
|
|
44 |
summary_container = st.container()
|
45 |
with summary_container:
|
46 |
+
for i, line in enumerate(filtered_summary):
|
47 |
+
if line: # Avoid blank lines
|
48 |
+
message(line, is_user=False, key=f"summary_{i}")
|
|
|
|
|
49 |
else:
|
50 |
st.sidebar.write("No conversation history to summarize.")
|
51 |
|