Update app.py
Browse files
app.py
CHANGED
@@ -216,8 +216,9 @@ def Chat_Message(history, messages1):
|
|
216 |
except Exception as e:
|
217 |
error_message = str(e)
|
218 |
index = error_message.find("Input validation error:")
|
219 |
-
|
220 |
-
|
|
|
221 |
else:
|
222 |
raise gr.Error("Error occurred during response") from e
|
223 |
|
@@ -260,8 +261,9 @@ def Internet_Search(history, messages2):
|
|
260 |
except Exception as e:
|
261 |
error_message = str(e)
|
262 |
index = error_message.find("Input validation error:")
|
263 |
-
|
264 |
-
|
|
|
265 |
else:
|
266 |
raise gr.Error("Error occurred during response") from e
|
267 |
|
@@ -296,8 +298,9 @@ def Chart_Generator(history, messages3):
|
|
296 |
except Exception as e:
|
297 |
error_message = str(e)
|
298 |
index = error_message.find("Input validation error:")
|
299 |
-
|
300 |
-
|
|
|
301 |
else:
|
302 |
raise gr.Error("Error occurred during response") from e
|
303 |
|
@@ -319,8 +322,9 @@ def Chart_Generator(history, messages3):
|
|
319 |
except Exception as e:
|
320 |
error_message = str(e)
|
321 |
index = error_message.find("Input validation error:")
|
322 |
-
|
323 |
-
|
|
|
324 |
else:
|
325 |
raise gr.Error("Error occurred during response") from e
|
326 |
|
@@ -376,8 +380,9 @@ def Link_Scratch(history, messages4):
|
|
376 |
except Exception as e:
|
377 |
error_message = str(e)
|
378 |
index = error_message.find("Input validation error:")
|
379 |
-
|
380 |
-
|
|
|
381 |
else:
|
382 |
raise gr.Error("Error occurred during response") from e
|
383 |
|
@@ -443,11 +448,11 @@ def File_Interact(history, filepath, messages5):
|
|
443 |
except Exception as e:
|
444 |
error_message = str(e)
|
445 |
index = error_message.find("Input validation error:")
|
446 |
-
|
447 |
-
|
|
|
448 |
else:
|
449 |
raise gr.Error("Error occurred during response") from e
|
450 |
-
|
451 |
|
452 |
messages5.append(AIMessage(content=response.content))
|
453 |
|
@@ -491,8 +496,9 @@ def Explore_WebSite(history, messages6):
|
|
491 |
except Exception as e:
|
492 |
error_message = str(e)
|
493 |
index = error_message.find("Input validation error:")
|
494 |
-
|
495 |
-
|
|
|
496 |
else:
|
497 |
raise gr.Error("Error occurred during response") from e
|
498 |
|
|
|
216 |
except Exception as e:
|
217 |
error_message = str(e)
|
218 |
index = error_message.find("Input validation error:")
|
219 |
+
end_index = error_message.find("\nMake sure 'text-generation' task is supported by the model.")
|
220 |
+
if start_index != -1 and end_index != -1:
|
221 |
+
raise gr.Error(error_message[start_index:end_index].strip()) from e
|
222 |
else:
|
223 |
raise gr.Error("Error occurred during response") from e
|
224 |
|
|
|
261 |
except Exception as e:
|
262 |
error_message = str(e)
|
263 |
index = error_message.find("Input validation error:")
|
264 |
+
end_index = error_message.find("\nMake sure 'text-generation' task is supported by the model.")
|
265 |
+
if start_index != -1 and end_index != -1:
|
266 |
+
raise gr.Error(error_message[start_index:end_index].strip()) from e
|
267 |
else:
|
268 |
raise gr.Error("Error occurred during response") from e
|
269 |
|
|
|
298 |
except Exception as e:
|
299 |
error_message = str(e)
|
300 |
index = error_message.find("Input validation error:")
|
301 |
+
end_index = error_message.find("\nMake sure 'text-generation' task is supported by the model.")
|
302 |
+
if start_index != -1 and end_index != -1:
|
303 |
+
raise gr.Error(error_message[start_index:end_index].strip()) from e
|
304 |
else:
|
305 |
raise gr.Error("Error occurred during response") from e
|
306 |
|
|
|
322 |
except Exception as e:
|
323 |
error_message = str(e)
|
324 |
index = error_message.find("Input validation error:")
|
325 |
+
end_index = error_message.find("\nMake sure 'text-generation' task is supported by the model.")
|
326 |
+
if start_index != -1 and end_index != -1:
|
327 |
+
raise gr.Error(error_message[start_index:end_index].strip()) from e
|
328 |
else:
|
329 |
raise gr.Error("Error occurred during response") from e
|
330 |
|
|
|
380 |
except Exception as e:
|
381 |
error_message = str(e)
|
382 |
index = error_message.find("Input validation error:")
|
383 |
+
end_index = error_message.find("\nMake sure 'text-generation' task is supported by the model.")
|
384 |
+
if start_index != -1 and end_index != -1:
|
385 |
+
raise gr.Error(error_message[start_index:end_index].strip()) from e
|
386 |
else:
|
387 |
raise gr.Error("Error occurred during response") from e
|
388 |
|
|
|
448 |
except Exception as e:
|
449 |
error_message = str(e)
|
450 |
index = error_message.find("Input validation error:")
|
451 |
+
end_index = error_message.find("\nMake sure 'text-generation' task is supported by the model.")
|
452 |
+
if start_index != -1 and end_index != -1:
|
453 |
+
raise gr.Error(error_message[start_index:end_index].strip()) from e
|
454 |
else:
|
455 |
raise gr.Error("Error occurred during response") from e
|
|
|
456 |
|
457 |
messages5.append(AIMessage(content=response.content))
|
458 |
|
|
|
496 |
except Exception as e:
|
497 |
error_message = str(e)
|
498 |
index = error_message.find("Input validation error:")
|
499 |
+
end_index = error_message.find("\nMake sure 'text-generation' task is supported by the model.")
|
500 |
+
if start_index != -1 and end_index != -1:
|
501 |
+
raise gr.Error(error_message[start_index:end_index].strip()) from e
|
502 |
else:
|
503 |
raise gr.Error("Error occurred during response") from e
|
504 |
|