Elouarn commited on
Commit
14f5718
·
verified ·
1 Parent(s): 800897d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -24,7 +24,7 @@ def save_message(user_id, message, role="user"):
24
  [
25
  {
26
  "role": role,
27
- "message": f"[{role.upper()}] {message} [/{role.upper()}]",
28
  "timestamp": datetime.now(),
29
  }
30
  ]
@@ -107,7 +107,7 @@ def format_prompt(message, history, user_id=""):
107
  if role == "user":
108
  prompt += f"[USER] {content} [/USER]"
109
  elif role == "bot":
110
- if not content.startswith("[BOT]"):
111
  content = f"[BOT] {content}"
112
  prompt += f"{content} [/BOT]"
113
 
@@ -202,7 +202,7 @@ def chatbot_interface(request: gr.Request):
202
  retry_btn=None,
203
  undo_btn=None,
204
  submit_btn="Parler",
205
- css="footer {visibility: hidden}"
206
 
207
  )
208
  return chatbot_interface
 
24
  [
25
  {
26
  "role": role,
27
+ "message": f"{message}",
28
  "timestamp": datetime.now(),
29
  }
30
  ]
 
107
  if role == "user":
108
  prompt += f"[USER] {content} [/USER]"
109
  elif role == "bot":
110
+ if content == history[-1].get("message"):
111
  content = f"[BOT] {content}"
112
  prompt += f"{content} [/BOT]"
113
 
 
202
  retry_btn=None,
203
  undo_btn=None,
204
  submit_btn="Parler",
205
+ css="footer {visibility: hidden} .gradio-container {background-color: #2D4059; color: #FFD460}"
206
 
207
  )
208
  return chatbot_interface