commonlemon commited on
Commit
8e89158
·
verified ·
1 Parent(s): 2861dbc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -9,11 +9,14 @@ def respond(message, history): #function for Gradio to call
9
  #Gradio passes arguments as parameters: the user's most recent input which is a string ("message"), and "history" which is the list of past messages
10
  #I have to put it in this order because Gradio will always past the current user input first and then the convo history
11
  # however for now, this chatbot won't use the history parameter anyway
12
- messages = [{"role": "system", "content": "You are a friendly chatbot."}] #dict in list to store messages
 
 
 
13
 
14
  #Add convo history to the messages if there's convo history
15
  if history:
16
- messages.extend(history)
17
 
18
  messages.append({"role": "user", "content": message}) #add the current user’s message to the messages list
19
 
 
9
  #Gradio passes arguments as parameters: the user's most recent input which is a string ("message"), and "history" which is the list of past messages
10
  #I have to put it in this order because Gradio will always past the current user input first and then the convo history
11
  # however for now, this chatbot won't use the history parameter anyway
12
+ messages = [
13
+ {"role": "system",
14
+ "content": "You are a friendly chatbot."}
15
+ ] #dict in list to store messages
16
 
17
  #Add convo history to the messages if there's convo history
18
  if history:
19
+ messages.extend(history) # adds history to the end of messages list via .extend() method
20
 
21
  messages.append({"role": "user", "content": message}) #add the current user’s message to the messages list
22