Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1677,10 +1677,7 @@ def handle_save_trustbuilder(content, specified_bucket=None):
|
|
| 1677 |
"""
|
| 1678 |
Handles saving TrustBuilders by detecting or automatically allocating the Trust Bucket.
|
| 1679 |
"""
|
| 1680 |
-
|
| 1681 |
-
if "last_processed_content" in st.session_state and st.session_state["last_processed_content"] == content:
|
| 1682 |
-
return None # Exit if the content was already processed
|
| 1683 |
-
|
| 1684 |
trust_buckets = {
|
| 1685 |
"Stability": [
|
| 1686 |
"track record", "longevity", "size", "stability", "experience", "established", "heritage",
|
|
@@ -1746,13 +1743,11 @@ def handle_save_trustbuilder(content, specified_bucket=None):
|
|
| 1746 |
save_content(st.session_state["wix_user_id"], content_to_save)
|
| 1747 |
|
| 1748 |
# Update last processed content
|
| 1749 |
-
st.session_state["last_processed_content"] = content
|
| 1750 |
return f"TrustBuilder allocated to **{bucket}** and saved successfully!"
|
| 1751 |
|
| 1752 |
|
| 1753 |
# Generate response
|
| 1754 |
|
| 1755 |
-
|
| 1756 |
# Function to update the message counter in a static location
|
| 1757 |
|
| 1758 |
if "email" not in st.session_state:
|
|
@@ -1870,15 +1865,16 @@ def handle_prompt(prompt):
|
|
| 1870 |
specified_bucket = bucket_match.group(1).capitalize()
|
| 1871 |
|
| 1872 |
if content_to_save:
|
| 1873 |
-
|
| 1874 |
-
|
| 1875 |
-
|
| 1876 |
-
if content_to_save:
|
| 1877 |
-
handle_save_trustbuilder(content_to_save, specified_bucket)
|
| 1878 |
-
else:
|
| 1879 |
with st.chat_message("assistant"):
|
| 1880 |
-
st.markdown(
|
| 1881 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1882 |
# Mark as handled and exit to prevent further processing
|
| 1883 |
st.session_state["handled"] = True
|
| 1884 |
return # Exit here to avoid triggering normal AI response
|
|
|
|
| 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 |
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
|
| 1752 |
|
| 1753 |
if "email" not in st.session_state:
|
|
|
|
| 1865 |
specified_bucket = bucket_match.group(1).capitalize()
|
| 1866 |
|
| 1867 |
if content_to_save:
|
| 1868 |
+
response = handle_save_trustbuilder(content_to_save, specified_bucket)
|
| 1869 |
+
if response:
|
| 1870 |
+
st.session_state.chat_history.append({"role": "assistant", "content": response})
|
|
|
|
|
|
|
|
|
|
| 1871 |
with st.chat_message("assistant"):
|
| 1872 |
+
st.markdown(response)
|
| 1873 |
+
else:
|
| 1874 |
+
# Prompt user to provide content if missing
|
| 1875 |
+
with st.chat_message("assistant"):
|
| 1876 |
+
st.markdown("Please provide the content to save as a TrustBuilder.")
|
| 1877 |
+
|
| 1878 |
# Mark as handled and exit to prevent further processing
|
| 1879 |
st.session_state["handled"] = True
|
| 1880 |
return # Exit here to avoid triggering normal AI response
|