Update app.py
Browse files
app.py
CHANGED
@@ -216,9 +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 |
raise gr.Error(error_message[start_index:end_index].strip()) from e
|
223 |
else:
|
224 |
raise gr.Error("Error occurred during response") from e
|
|
|
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("\n")
|
220 |
if start_index != -1 and end_index != -1:
|
221 |
+
messages1.pop()
|
222 |
+
messages1.pop()
|
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
|