3v324v23 commited on
Commit
2a6e50d
1 Parent(s): 371d62a
Files changed (1) hide show
  1. predict.py +5 -1
predict.py CHANGED
@@ -132,8 +132,12 @@ def predict(api, inputs, top_p, temperature, chatbot=[], history=[], system_prom
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
- if "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
 
 
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 "API key" in error_msg:
136
  chatbot[-1] = (chatbot[-1][0], "[Local Message] Incorrect API key provided.")
137
+ else:
138
+ from toolbox import regular_txt_to_markdown
139
+ tb_str = regular_txt_to_markdown(traceback.format_exc())
140
+ chatbot[-1] = (chatbot[-1][0], f"[Local Message] Json Error \n\n {tb_str} \n\n {regular_txt_to_markdown(chunk.decode()[4:])}")
141
  yield chatbot, history, "Json解析不合常规,很可能是文本过长" + error_msg
142
  return
143