vioott commited on
Commit
c2139f1
·
1 Parent(s): 2962f9a

feat(chat): include user name and preferences in AI prompt

Browse files
Files changed (1) hide show
  1. app.py +9 -3
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
- gemini_response = user_decision.send_message(
106
- f"Usuário {user_id}, histórico: {history}. Pergunta: {question}"
 
 
 
 
 
 
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