Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1672,12 +1672,14 @@ def download_trustbuilder_as_md(content, trustbuilder_id):
|
|
| 1672 |
download_link = f'<a href="data:text/markdown;base64,{b64_content}" download="TrustBuilder_{trustbuilder_id}.md">Download</a>'
|
| 1673 |
st.sidebar.markdown(download_link, unsafe_allow_html=True)
|
| 1674 |
|
| 1675 |
-
|
| 1676 |
def handle_save_trustbuilder(content, specified_bucket=None):
|
| 1677 |
"""
|
| 1678 |
Handles saving TrustBuilders by detecting or automatically allocating the Trust Bucket.
|
| 1679 |
"""
|
| 1680 |
-
|
|
|
|
|
|
|
|
|
|
| 1681 |
trust_buckets = {
|
| 1682 |
"Stability": [
|
| 1683 |
"track record", "longevity", "size", "stability", "experience", "established", "heritage",
|
|
@@ -1743,9 +1745,13 @@ def handle_save_trustbuilder(content, specified_bucket=None):
|
|
| 1743 |
save_content(st.session_state["wix_user_id"], content_to_save)
|
| 1744 |
|
| 1745 |
# Update last processed content
|
|
|
|
|
|
|
|
|
|
| 1746 |
return f"TrustBuilder allocated to **{bucket}** and saved successfully!"
|
| 1747 |
|
| 1748 |
|
|
|
|
| 1749 |
# Generate response
|
| 1750 |
|
| 1751 |
# Function to update the message counter in a static location
|
|
|
|
| 1672 |
download_link = f'<a href="data:text/markdown;base64,{b64_content}" download="TrustBuilder_{trustbuilder_id}.md">Download</a>'
|
| 1673 |
st.sidebar.markdown(download_link, unsafe_allow_html=True)
|
| 1674 |
|
|
|
|
| 1675 |
def handle_save_trustbuilder(content, specified_bucket=None):
|
| 1676 |
"""
|
| 1677 |
Handles saving TrustBuilders by detecting or automatically allocating the Trust Bucket.
|
| 1678 |
"""
|
| 1679 |
+
# Avoid reprocessing the same content
|
| 1680 |
+
if "last_processed_content" in st.session_state and st.session_state["last_processed_content"] == content:
|
| 1681 |
+
return None # Exit if the content was already processed
|
| 1682 |
+
|
| 1683 |
trust_buckets = {
|
| 1684 |
"Stability": [
|
| 1685 |
"track record", "longevity", "size", "stability", "experience", "established", "heritage",
|
|
|
|
| 1745 |
save_content(st.session_state["wix_user_id"], content_to_save)
|
| 1746 |
|
| 1747 |
# Update last processed content
|
| 1748 |
+
st.session_state["last_processed_content"] = content
|
| 1749 |
+
|
| 1750 |
+
# Generate response
|
| 1751 |
return f"TrustBuilder allocated to **{bucket}** and saved successfully!"
|
| 1752 |
|
| 1753 |
|
| 1754 |
+
|
| 1755 |
# Generate response
|
| 1756 |
|
| 1757 |
# Function to update the message counter in a static location
|