Spaces:
Runtime error
Runtime error
http post error show
Browse files- predict.py +6 -2
predict.py
CHANGED
@@ -126,7 +126,7 @@ def predict(inputs, top_p, temperature, chatbot=[], history=[], system_prompt=''
|
|
126 |
|
127 |
except Exception as e:
|
128 |
traceback.print_exc()
|
129 |
-
yield chatbot, history, "Json
|
130 |
chunk = get_full_error(chunk, stream_response)
|
131 |
error_msg = chunk.decode()
|
132 |
if "reduce the length" in error_msg:
|
@@ -134,7 +134,11 @@ def predict(inputs, top_p, temperature, chatbot=[], history=[], system_prompt=''
|
|
134 |
history = []
|
135 |
elif "Incorrect API key" in error_msg:
|
136 |
chatbot[-1] = (chatbot[-1][0], "[Local Message] Incorrect API key provided.")
|
137 |
-
|
|
|
|
|
|
|
|
|
138 |
return
|
139 |
|
140 |
def generate_payload(inputs, top_p, temperature, history, system_prompt, stream):
|
|
|
126 |
|
127 |
except Exception as e:
|
128 |
traceback.print_exc()
|
129 |
+
yield chatbot, history, "Json解析不合常规"
|
130 |
chunk = get_full_error(chunk, stream_response)
|
131 |
error_msg = chunk.decode()
|
132 |
if "reduce the length" in error_msg:
|
|
|
134 |
history = []
|
135 |
elif "Incorrect 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 |
|
144 |
def generate_payload(inputs, top_p, temperature, history, system_prompt, stream):
|