Solshine commited on
Commit
74c5a05
1 Parent(s): 8d3beee

Added JSON extraction detection and denial

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -72,6 +72,7 @@ def launch_bot():
72
  st.markdown(
73
  "## Democratizing access to farming knowledge.\n"
74
  "This app was built with the support of our Patreon subscribers. Thank you! [Click here to join our patreon or upgrade your membership.](https://www.patreon.com/CopyleftCultivarsNonprofit). \n"
 
75
  )
76
  st.markdown("---")
77
  st.image(image, width=250)
@@ -92,6 +93,11 @@ def launch_bot():
92
  st.session_state.messages.append({"role": "user", "content": prompt})
93
  with st.chat_message("user"):
94
  st.write(prompt)
 
 
 
 
 
95
 
96
  # Generate a new response if last message is not from assistant
97
  if st.session_state.messages[-1]["role"] != "assistant":
 
72
  st.markdown(
73
  "## Democratizing access to farming knowledge.\n"
74
  "This app was built with the support of our Patreon subscribers. Thank you! [Click here to join our patreon or upgrade your membership.](https://www.patreon.com/CopyleftCultivarsNonprofit). \n"
75
+ "Use of this app indicates agreement to our terms of membership, available on Copyleftcultivars.com as well as an agreement not to attempt to access our databases in any way. \n"
76
  )
77
  st.markdown("---")
78
  st.image(image, width=250)
 
93
  st.session_state.messages.append({"role": "user", "content": prompt})
94
  with st.chat_message("user"):
95
  st.write(prompt)
96
+ if any(variant in prompt for variant in ("JSON", "json", "jsON", "jSon", "Json", "jsoN", "JSon")):
97
+ if "ADMINISTRATION" not in prompt:
98
+ st.chat_message("Database scraping is not permitted. Please abide by the terms of membership, and reach out with any collaboration requests via email")
99
+ message = {"role": "assistant", "content": response}
100
+ st.session_state.messages.append(message)
101
 
102
  # Generate a new response if last message is not from assistant
103
  if st.session_state.messages[-1]["role"] != "assistant":