research14 commited on
Commit
fad6b55
1 Parent(s): ef08bd0

all new prompts will appear first in chatbot

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -56,7 +56,7 @@ def gpt_respond(have_key, tab_name, message, chat_history, max_convo_length = 10
56
  print(formatted_prompt)
57
  bot_message = chat(system_prompt = f'''Generate the output only for the assistant. Output any <{tab_name}> in the following sentence one per line.''',
58
  user_prompt = formatted_prompt)
59
- chat_history.append((message, bot_message))
60
  return "", chat_history
61
 
62
  def vicuna_respond(tab_name, message, chat_history):
@@ -117,7 +117,7 @@ def gpt_strategies_respond(have_key, strategy, task_name, task_ling_ent, message
117
  print(formatted_prompt)
118
  bot_message = chat(system_prompt = formatted_system_prompt,
119
  user_prompt = formatted_prompt)
120
- chat_history.append((message, bot_message))
121
  return "", chat_history
122
 
123
  def vicuna_strategies_respond(strategy, task_name, task_ling_ent, message, chat_history):
@@ -148,7 +148,7 @@ def vicuna_strategies_respond(strategy, task_name, task_ling_ent, message, chat_
148
  bot_message = bot_message.replace(formatted_prompt, '')
149
  print(bot_message)
150
 
151
- chat_history.append((formatted_prompt, bot_message))
152
  time.sleep(2)
153
  return task_name, "", chat_history
154
 
@@ -180,7 +180,7 @@ def llama_strategies_respond(strategy, task_name, task_ling_ent, message, chat_h
180
  bot_message = bot_message.replace(formatted_prompt, '')
181
  # print(bot_message)
182
 
183
- chat_history.append((formatted_prompt, bot_message))
184
  time.sleep(2)
185
  return task_name, "", chat_history
186
 
 
56
  print(formatted_prompt)
57
  bot_message = chat(system_prompt = f'''Generate the output only for the assistant. Output any <{tab_name}> in the following sentence one per line.''',
58
  user_prompt = formatted_prompt)
59
+ chat_history.insert(0, (message, bot_message))
60
  return "", chat_history
61
 
62
  def vicuna_respond(tab_name, message, chat_history):
 
117
  print(formatted_prompt)
118
  bot_message = chat(system_prompt = formatted_system_prompt,
119
  user_prompt = formatted_prompt)
120
+ chat_history.insert(0, (message, bot_message))
121
  return "", chat_history
122
 
123
  def vicuna_strategies_respond(strategy, task_name, task_ling_ent, message, chat_history):
 
148
  bot_message = bot_message.replace(formatted_prompt, '')
149
  print(bot_message)
150
 
151
+ chat_history.append(0, (formatted_prompt, bot_message))
152
  time.sleep(2)
153
  return task_name, "", chat_history
154
 
 
180
  bot_message = bot_message.replace(formatted_prompt, '')
181
  # print(bot_message)
182
 
183
+ chat_history.append(0, (formatted_prompt, bot_message))
184
  time.sleep(2)
185
  return task_name, "", chat_history
186