3v324v23 commited on
Commit
e341596
1 Parent(s): 9de97da
Files changed (1) hide show
  1. predict.py +3 -1
predict.py CHANGED
@@ -130,8 +130,10 @@ def predict(inputs, top_p, temperature, chatbot=[], history=[], system_prompt=''
130
  chunk = get_full_error(chunk, stream_response)
131
  error_msg = chunk.decode()
132
  if "reduce the length" in error_msg:
133
- chatbot[-1] = (history[-1], "[Local Message] Input (or history) is too long, please reduce input or clear history by refleshing this page.")
134
  history = []
 
 
135
  yield chatbot, history, "Json解析不合常规,很可能是文本过长" + error_msg
136
  return
137
 
 
130
  chunk = get_full_error(chunk, stream_response)
131
  error_msg = chunk.decode()
132
  if "reduce the length" in error_msg:
133
+ chatbot[-1] = (chatbot[-1][0], "[Local Message] Input (or history) is too long, please reduce input or clear history by refleshing this page.")
134
  history = []
135
+ elif "Incorrect API key" in error_msg:
136
+ chatbot[-1] = (chatbot[-1][0], "[Local Message] Incorrect API key provided.")
137
  yield chatbot, history, "Json解析不合常规,很可能是文本过长" + error_msg
138
  return
139