SanaAdeel commited on
Commit
c3bd387
·
verified ·
1 Parent(s): 760e675

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -63,19 +63,14 @@ def chat_completion(user_id, system_message, history, user_message, max_tokens,
63
  def respond(
64
  message, history, system_message, max_tokens, temperature, top_p, hf_token
65
  ):
66
- user_id = "demo_user" # Replace with actual user session ID or dynamic assignment
67
-
68
  connected, paywall_msg = check_paywall(user_id)
69
 
70
  if not connected:
71
- # Append paywall message as an assistant chat message
72
- new_history = history + [{"role": "assistant", "content": paywall_msg}]
73
- # Return as two identical chat histories per Gradio's expected output
74
- return new_history, new_history
75
 
76
  reply_text = chat_completion(user_id, system_message, history, message, max_tokens, temperature, top_p)
77
- new_history = history + [{"role": "user", "content": message}, {"role": "assistant", "content": reply_text}]
78
- return new_history, new_history
79
 
80
  # Gradio chat interface with additional inputs
81
  chatbot = gr.ChatInterface(
 
63
  def respond(
64
  message, history, system_message, max_tokens, temperature, top_p, hf_token
65
  ):
66
+ user_id = "demo_user"
 
67
  connected, paywall_msg = check_paywall(user_id)
68
 
69
  if not connected:
70
+ return paywall_msg # Return just the message
 
 
 
71
 
72
  reply_text = chat_completion(user_id, system_message, history, message, max_tokens, temperature, top_p)
73
+ return reply_text # Return just the reply
 
74
 
75
  # Gradio chat interface with additional inputs
76
  chatbot = gr.ChatInterface(