Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -74,7 +74,7 @@ with gr.Blocks() as demo:
|
|
| 74 |
def user(user_message, url_params, history):
|
| 75 |
return "", history + [[user_message, None]]
|
| 76 |
|
| 77 |
-
def bot(history, url_params):
|
| 78 |
if "hi" in history[-1][0]:
|
| 79 |
session_index = url_params.get('session_index')
|
| 80 |
print(session_index)
|
|
@@ -84,7 +84,22 @@ with gr.Blocks() as demo:
|
|
| 84 |
"""
|
| 85 |
# Fetch personalized data
|
| 86 |
personalized_data = fetch_personalized_data(session_index)
|
| 87 |
-
print(personalized_data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
else:
|
| 89 |
bot_message = "There was an error. Please try again."
|
| 90 |
history[-1][1] = bot_message
|
|
|
|
| 74 |
def user(user_message, url_params, history):
|
| 75 |
return "", history + [[user_message, None]]
|
| 76 |
|
| 77 |
+
'''def bot(history, url_params):
|
| 78 |
if "hi" in history[-1][0]:
|
| 79 |
session_index = url_params.get('session_index')
|
| 80 |
print(session_index)
|
|
|
|
| 84 |
"""
|
| 85 |
# Fetch personalized data
|
| 86 |
personalized_data = fetch_personalized_data(session_index)
|
| 87 |
+
print(personalized_data)'''
|
| 88 |
+
|
| 89 |
+
def bot(history, url_params):
|
| 90 |
+
if "hi" in history[-1][0]:
|
| 91 |
+
session_index = url_params.get('session_index')
|
| 92 |
+
if session_index: # Check if session_index is not None or empty
|
| 93 |
+
print(session_index)
|
| 94 |
+
bot_message = f"""
|
| 95 |
+
here your URL params:
|
| 96 |
+
{json.dumps(url_params, indent=4)}
|
| 97 |
+
"""
|
| 98 |
+
# Fetch personalized data
|
| 99 |
+
personalized_data = fetch_personalized_data(session_index)
|
| 100 |
+
print(personalized_data)
|
| 101 |
+
else:
|
| 102 |
+
bot_message = "Session index is missing."
|
| 103 |
else:
|
| 104 |
bot_message = "There was an error. Please try again."
|
| 105 |
history[-1][1] = bot_message
|