Fix duplicate error message by skipping first line of error_details

parent 378e4127
...@@ -932,7 +932,7 @@ class RotationHandler: ...@@ -932,7 +932,7 @@ class RotationHandler:
if notify_errors: if notify_errors:
logger.info(f"notifyerrors is enabled for rotation '{rotation_id}', returning error as normal message") logger.info(f"notifyerrors is enabled for rotation '{rotation_id}', returning error as normal message")
# Return a normal response with error message instead of HTTP 503 # Return a normal response with error message instead of HTTP 503
error_message = f"All providers in rotation '{rotation_id}' failed. Details:\n{chr(10).join(error_details)}" error_message = f"All providers in rotation '{rotation_id}' failed. Details:\n{chr(10).join(error_details[1:])}"
error_response = { error_response = {
"id": f"error-{rotation_id}-{int(time.time())}", "id": f"error-{rotation_id}-{int(time.time())}",
"object": "chat.completion", "object": "chat.completion",
...@@ -963,7 +963,7 @@ class RotationHandler: ...@@ -963,7 +963,7 @@ class RotationHandler:
else: else:
logger.info(f"notifyerrors is disabled for rotation '{rotation_id}', returning error with status code 429") logger.info(f"notifyerrors is disabled for rotation '{rotation_id}', returning error with status code 429")
# Return a normal response with error message and status code 429 # Return a normal response with error message and status code 429
error_message = f"All providers in rotation '{rotation_id}' failed. Details:\n{chr(10).join(error_details)}" error_message = f"All providers in rotation '{rotation_id}' failed. Details:\n{chr(10).join(error_details[1:])}"
error_response = { error_response = {
"id": f"error-{rotation_id}-{int(time.time())}", "id": f"error-{rotation_id}-{int(time.time())}",
"object": "chat.completion", "object": "chat.completion",
...@@ -1340,7 +1340,7 @@ class RotationHandler: ...@@ -1340,7 +1340,7 @@ class RotationHandler:
if notify_errors: if notify_errors:
logger.info(f"notifyerrors is enabled for rotation '{rotation_id}', returning error as normal message") logger.info(f"notifyerrors is enabled for rotation '{rotation_id}', returning error as normal message")
# Return a normal response with error message instead of HTTP 503 # Return a normal response with error message instead of HTTP 503
error_message = f"All providers in rotation '{rotation_id}' failed after {max_retries} attempts. Details:\n{chr(10).join(error_details)}" error_message = f"All providers in rotation '{rotation_id}' failed after {max_retries} attempts. Details:\n{chr(10).join(error_details[1:])}"
error_response = { error_response = {
"id": f"error-{rotation_id}-{int(time.time())}", "id": f"error-{rotation_id}-{int(time.time())}",
"object": "chat.completion", "object": "chat.completion",
...@@ -1375,7 +1375,7 @@ class RotationHandler: ...@@ -1375,7 +1375,7 @@ class RotationHandler:
else: else:
logger.info(f"notifyerrors is disabled for rotation '{rotation_id}', returning error with status code 429") logger.info(f"notifyerrors is disabled for rotation '{rotation_id}', returning error with status code 429")
# Return a normal response with error message and status code 429 # Return a normal response with error message and status code 429
error_message = f"All providers in rotation '{rotation_id}' failed after {max_retries} attempts. Details:\n{chr(10).join(error_details)}" error_message = f"All providers in rotation '{rotation_id}' failed after {max_retries} attempts. Details:\n{chr(10).join(error_details[1:])}"
error_response = { error_response = {
"id": f"error-{rotation_id}-{int(time.time())}", "id": f"error-{rotation_id}-{int(time.time())}",
"object": "chat.completion", "object": "chat.completion",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment