Update app.py
Browse files
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"
|
| 67 |
-
|
| 68 |
connected, paywall_msg = check_paywall(user_id)
|
| 69 |
|
| 70 |
if not connected:
|
| 71 |
-
#
|
| 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 |
-
|
| 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(
|