Update app.py
Browse files
app.py
CHANGED
@@ -216,11 +216,10 @@ def Chat_Message(history, messages1):
|
|
216 |
except Exception as e:
|
217 |
error_message = str(e)
|
218 |
start_index = error_message.find("Input validation error:")
|
219 |
-
end_index = error_message.find("
|
220 |
if start_index != -1 and end_index != -1:
|
221 |
-
messages1
|
222 |
-
|
223 |
-
raise gr.Error(error_message[start_index:end_index].strip()) from e
|
224 |
else:
|
225 |
raise gr.Error("Error occurred during response") from e
|
226 |
|
@@ -266,7 +265,7 @@ def Internet_Search(history, messages2):
|
|
266 |
end_index = error_message.find("and 4096 `max_new_tokens`")
|
267 |
if start_index != -1 and end_index != -1:
|
268 |
messages2 = messages2[:-2]
|
269 |
-
raise gr.Error(error_message[start_index:end_index].strip()) from e
|
270 |
else:
|
271 |
raise gr.Error("Error occurred during response") from e
|
272 |
|
@@ -304,7 +303,7 @@ def Chart_Generator(history, messages3):
|
|
304 |
end_index = error_message.find("and 4096 `max_new_tokens`")
|
305 |
if start_index != -1 and end_index != -1:
|
306 |
messages3 = messages3[:-2]
|
307 |
-
raise gr.Error(error_message[start_index:end_index].strip()) from e
|
308 |
else:
|
309 |
raise gr.Error("Error occurred during response") from e
|
310 |
|
@@ -329,7 +328,7 @@ def Chart_Generator(history, messages3):
|
|
329 |
end_index = error_message.find("and 4096 `max_new_tokens`")
|
330 |
if start_index != -1 and end_index != -1:
|
331 |
messages3 = messages3[:-2]
|
332 |
-
raise gr.Error(error_message[start_index:end_index].strip()) from e
|
333 |
else:
|
334 |
raise gr.Error("Error occurred during response") from e
|
335 |
|
@@ -388,7 +387,7 @@ def Link_Scratch(history, messages4):
|
|
388 |
end_index = error_message.find("and 4096 `max_new_tokens`")
|
389 |
if start_index != -1 and end_index != -1:
|
390 |
messages4 = messages4[:-2]
|
391 |
-
raise gr.Error(error_message[start_index:end_index].strip()) from e
|
392 |
else:
|
393 |
raise gr.Error("Error occurred during response") from e
|
394 |
|
@@ -457,7 +456,7 @@ def File_Interact(history, filepath, messages5):
|
|
457 |
end_index = error_message.find("and 4096 `max_new_tokens`")
|
458 |
if start_index != -1 and end_index != -1:
|
459 |
messages5 = messages5[:-2]
|
460 |
-
raise gr.Error(error_message[start_index:end_index].strip()) from e
|
461 |
else:
|
462 |
raise gr.Error("Error occurred during response") from e
|
463 |
|
@@ -506,7 +505,7 @@ def Explore_WebSite(history, messages6):
|
|
506 |
end_index = error_message.find("and 4096 `max_new_tokens`")
|
507 |
if start_index != -1 and end_index != -1:
|
508 |
messages6 = messages6[:-2]
|
509 |
-
raise gr.Error(error_message[start_index:end_index].strip()) from e
|
510 |
else:
|
511 |
raise gr.Error("Error occurred during response") from e
|
512 |
|
|
|
216 |
except Exception as e:
|
217 |
error_message = str(e)
|
218 |
start_index = error_message.find("Input validation error:")
|
219 |
+
end_index = error_message.find("and 4096 `max_new_tokens`")
|
220 |
if start_index != -1 and end_index != -1:
|
221 |
+
messages1 = messages1[:-2]
|
222 |
+
raise gr.Error(error_message[start_index:end_index+ len("and 4096 `max_new_tokens`")].strip()) from e
|
|
|
223 |
else:
|
224 |
raise gr.Error("Error occurred during response") from e
|
225 |
|
|
|
265 |
end_index = error_message.find("and 4096 `max_new_tokens`")
|
266 |
if start_index != -1 and end_index != -1:
|
267 |
messages2 = messages2[:-2]
|
268 |
+
raise gr.Error(error_message[start_index:end_index+ len("and 4096 `max_new_tokens`")].strip()) from e
|
269 |
else:
|
270 |
raise gr.Error("Error occurred during response") from e
|
271 |
|
|
|
303 |
end_index = error_message.find("and 4096 `max_new_tokens`")
|
304 |
if start_index != -1 and end_index != -1:
|
305 |
messages3 = messages3[:-2]
|
306 |
+
raise gr.Error(error_message[start_index:end_index+ len("and 4096 `max_new_tokens`")].strip()) from e
|
307 |
else:
|
308 |
raise gr.Error("Error occurred during response") from e
|
309 |
|
|
|
328 |
end_index = error_message.find("and 4096 `max_new_tokens`")
|
329 |
if start_index != -1 and end_index != -1:
|
330 |
messages3 = messages3[:-2]
|
331 |
+
raise gr.Error(error_message[start_index:end_index+ len("and 4096 `max_new_tokens`")].strip()) from e
|
332 |
else:
|
333 |
raise gr.Error("Error occurred during response") from e
|
334 |
|
|
|
387 |
end_index = error_message.find("and 4096 `max_new_tokens`")
|
388 |
if start_index != -1 and end_index != -1:
|
389 |
messages4 = messages4[:-2]
|
390 |
+
raise gr.Error(error_message[start_index:end_index+ len("and 4096 `max_new_tokens`")].strip()) from e
|
391 |
else:
|
392 |
raise gr.Error("Error occurred during response") from e
|
393 |
|
|
|
456 |
end_index = error_message.find("and 4096 `max_new_tokens`")
|
457 |
if start_index != -1 and end_index != -1:
|
458 |
messages5 = messages5[:-2]
|
459 |
+
raise gr.Error(error_message[start_index:end_index+ len("and 4096 `max_new_tokens`")].strip()) from e
|
460 |
else:
|
461 |
raise gr.Error("Error occurred during response") from e
|
462 |
|
|
|
505 |
end_index = error_message.find("and 4096 `max_new_tokens`")
|
506 |
if start_index != -1 and end_index != -1:
|
507 |
messages6 = messages6[:-2]
|
508 |
+
raise gr.Error(error_message[start_index:end_index+ len("and 4096 `max_new_tokens`")].strip()) from e
|
509 |
else:
|
510 |
raise gr.Error("Error occurred during response") from e
|
511 |
|