feat(gateway): add reversible chat pii redaction

This commit is contained in:
Kayphoon
2026-05-13 18:25:13 +08:00
parent 3c2497f019
commit 2958041dc7
43 changed files with 7770 additions and 126 deletions

View File

@@ -13,6 +13,7 @@ use crate::insert_header_if_missing;
pub(crate) enum GatewayError {
UpstreamUnavailable { trace_id: String, message: String },
ControlUnavailable { trace_id: String, message: String },
Client { status: StatusCode, message: String },
Internal(String),
}
@@ -55,6 +56,15 @@ impl IntoResponse for GatewayError {
);
response
}
Self::Client { status, message } => (
status,
Json(json!({
"error": {
"message": message,
}
})),
)
.into_response(),
Self::Internal(message) => (
StatusCode::INTERNAL_SERVER_ERROR,
Json(json!({