FredZhang7 commited on
Commit
fe97083
·
verified ·
1 Parent(s): 643a523

fix empty instruction

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -21,7 +21,8 @@ def generate_prompt(instruction, input=None, history=None):
21
  for pair in history:
22
  if len(pair[0]) > 0 and len(pair[1]) > 0:
23
  history_str += f"User: {pair[0]}\n\nAssistant: {pair[1]}\n\n"
24
-
 
25
  instruction = (
26
  instruction.strip()
27
  .replace("\r\n", "\n")
@@ -94,7 +95,6 @@ def respond(history=None):
94
  global token_count_chat, temperature_chat, top_p_chat, presence_penalty_chat, count_penalty_chat
95
 
96
  # get the lastest user message and the additional parameters
97
- instruction = msg.value
98
  token_count = token_count_chat.value
99
 
100
  temperature = temperature_chat.value
@@ -105,7 +105,7 @@ def respond(history=None):
105
  history[-1][1] = ""
106
 
107
  for character in generator(
108
- instruction,
109
  None,
110
  token_count,
111
  temperature,
 
21
  for pair in history:
22
  if len(pair[0]) > 0 and len(pair[1]) > 0:
23
  history_str += f"User: {pair[0]}\n\nAssistant: {pair[1]}\n\n"
24
+ instruction = history[-1][0]
25
+
26
  instruction = (
27
  instruction.strip()
28
  .replace("\r\n", "\n")
 
95
  global token_count_chat, temperature_chat, top_p_chat, presence_penalty_chat, count_penalty_chat
96
 
97
  # get the lastest user message and the additional parameters
 
98
  token_count = token_count_chat.value
99
 
100
  temperature = temperature_chat.value
 
105
  history[-1][1] = ""
106
 
107
  for character in generator(
108
+ None,
109
  None,
110
  token_count,
111
  temperature,