Guiyom commited on
Commit
03e6b4b
·
1 Parent(s): 5fa7a01

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -50,9 +50,9 @@ with gr.Blocks(theme=gr.themes.Glass()) as demo:
50
  msg = msg + f"\nRemember to answer in {language}"
51
  chatbot += [msg, None]
52
  state += {'role':'user','content':'msg'}
53
- return msg, chatbot, state
54
 
55
- def bot(chatbot, state, mode):
56
  #Bot context
57
  if mode == "mode1":
58
  context = themewhatcanido
@@ -63,12 +63,12 @@ with gr.Blocks(theme=gr.themes.Glass()) as demo:
63
 
64
  #remind mission
65
  if len(state) == 0:
66
- state += {'role':'system','content':f"Take notice of your mission:\n\n{context}"}
67
  elif len(state) > 10:
68
- state += {'role':'system','content':f"Remember your mission as briefed earlier:\n\n{context}"}
69
  response = answer(state)
70
- chatbot += [None, response]
71
- state += {'role':'assistant','content':'response'}
72
  return chatbot, state
73
 
74
  def refresh(language: str):
 
50
  msg = msg + f"\nRemember to answer in {language}"
51
  chatbot += [msg, None]
52
  state += {'role':'user','content':'msg'}
53
+ return "", chatbot, state
54
 
55
+ def bot(chatbot, state, mode: str):
56
  #Bot context
57
  if mode == "mode1":
58
  context = themewhatcanido
 
63
 
64
  #remind mission
65
  if len(state) == 0:
66
+ state .append({'role':'system','content':f"Take notice of your mission:\n\n{context}"})
67
  elif len(state) > 10:
68
+ state.append({'role':'system','content':f"Remember your mission as briefed earlier:\n\n{context}"})
69
  response = answer(state)
70
+ chatbot.append([None, response])
71
+ state.append({'role':'assistant','content':'response'})
72
  return chatbot, state
73
 
74
  def refresh(language: str):