Spaces:
Sleeping
Sleeping
feat(chat): include user name and preferences in AI prompt
Browse files
app.py
CHANGED
|
@@ -102,10 +102,16 @@ def chat(user_id):
|
|
| 102 |
user_decision = magical_if.start_chat(
|
| 103 |
enable_automatic_function_calling=True
|
| 104 |
)
|
| 105 |
-
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
)
|
| 108 |
-
|
| 109 |
try:
|
| 110 |
function_call = (
|
| 111 |
gemini_response
|
|
|
|
| 102 |
user_decision = magical_if.start_chat(
|
| 103 |
enable_automatic_function_calling=True
|
| 104 |
)
|
| 105 |
+
name = history.get("name", f"Usuário {user_id}")
|
| 106 |
+
preferences = history.get("preferences", [])
|
| 107 |
+
prompt = (
|
| 108 |
+
f"O nome do usuário é {name}. "
|
| 109 |
+
f"As preferências dele são: "
|
| 110 |
+
f"{', '.join(preferences) or 'nenhuma preferência registrada'}. "
|
| 111 |
+
f"Histórico de compras: {history}. "
|
| 112 |
+
f"Pergunta: {question}"
|
| 113 |
)
|
| 114 |
+
gemini_response = user_decision.send_message(prompt)
|
| 115 |
try:
|
| 116 |
function_call = (
|
| 117 |
gemini_response
|