Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -241,7 +241,7 @@ def chat(slug, user_id):
|
|
241 |
|
242 |
# User-provided prompt
|
243 |
if prompt := st.chat_input():
|
244 |
-
increment_user_chat_count(user_id)
|
245 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
246 |
st.session_state.prompts = prompt
|
247 |
with st.chat_message("user"):
|
@@ -260,6 +260,8 @@ def chat(slug, user_id):
|
|
260 |
{"role": "system", "content": message_content}
|
261 |
)
|
262 |
st.write(message_content)
|
|
|
|
|
263 |
|
264 |
|
265 |
def init():
|
@@ -292,7 +294,7 @@ def main():
|
|
292 |
load_dotenv()
|
293 |
st.title("Chat with GPT :books:")
|
294 |
|
295 |
-
if slug:
|
296 |
chat(slug, user_id)
|
297 |
|
298 |
else:
|
|
|
241 |
|
242 |
# User-provided prompt
|
243 |
if prompt := st.chat_input():
|
244 |
+
# increment_user_chat_count(user_id)
|
245 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
246 |
st.session_state.prompts = prompt
|
247 |
with st.chat_message("user"):
|
|
|
260 |
{"role": "system", "content": message_content}
|
261 |
)
|
262 |
st.write(message_content)
|
263 |
+
if not is_user_in_unlimited_chat_group(user_id):
|
264 |
+
increment_user_chat_count(user_id) # Increment count after response
|
265 |
|
266 |
|
267 |
def init():
|
|
|
294 |
load_dotenv()
|
295 |
st.title("Chat with GPT :books:")
|
296 |
|
297 |
+
if slug and user_id:
|
298 |
chat(slug, user_id)
|
299 |
|
300 |
else:
|