Redesign sensitive info protection settings

This commit is contained in:
fawney19
2026-05-14 11:14:20 +08:00
parent 91955ad1e0
commit 509bd30252
71 changed files with 3254 additions and 884 deletions

View File

@@ -4274,6 +4274,12 @@ async fn gateway_updates_users_me_detail_locally_without_proxying_upstream() {
.json(&json!({
"email": "alice+updated@example.com",
"username": "alice-updated",
"feature_settings": {
"chat_pii_redaction": {
"enabled": true,
"inject_model_instruction": false
}
}
}))
.send()
.await
@@ -4301,6 +4307,14 @@ async fn gateway_updates_users_me_detail_locally_without_proxying_upstream() {
assert_eq!(get_payload["username"], "alice-updated");
assert_eq!(get_payload["auth_source"], "local");
assert_eq!(get_payload["has_password"], true);
assert_eq!(
get_payload["feature_settings"]["chat_pii_redaction"]["enabled"],
true
);
assert_eq!(
get_payload["feature_settings"]["chat_pii_redaction"]["inject_model_instruction"],
false
);
assert_eq!(*upstream_hits.lock().expect("mutex should lock"), 0);
gateway_handle.abort();
@@ -6334,6 +6348,7 @@ async fn gateway_handles_users_me_api_key_writes_locally_without_proxying_upstre
assert_eq!(create_payload["name"], "writer-key");
assert_eq!(create_payload["rate_limit"], 120);
assert_eq!(create_payload["concurrent_limit"], serde_json::Value::Null);
assert_eq!(create_payload["feature_settings"], serde_json::Value::Null);
assert_eq!(create_payload["message"], "API密钥创建成功");
let created_at = create_payload["created_at"]
.as_str()
@@ -6353,7 +6368,13 @@ async fn gateway_handles_users_me_api_key_writes_locally_without_proxying_upstre
.json(&json!({
"name": "writer-key-renamed",
"rate_limit": 30,
"concurrent_limit": 4
"concurrent_limit": 4,
"feature_settings": {
"chat_pii_redaction": {
"enabled": true,
"inject_model_instruction": false
}
}
}))
.send()
.await
@@ -6366,6 +6387,14 @@ async fn gateway_handles_users_me_api_key_writes_locally_without_proxying_upstre
assert_eq!(update_payload["name"], "writer-key-renamed");
assert_eq!(update_payload["rate_limit"], 30);
assert_eq!(update_payload["concurrent_limit"], 4);
assert_eq!(
update_payload["feature_settings"]["chat_pii_redaction"]["enabled"],
true
);
assert_eq!(
update_payload["feature_settings"]["chat_pii_redaction"]["inject_model_instruction"],
false
);
assert_eq!(update_payload["message"], "API密钥已更新");
let toggle_response = client
@@ -6446,6 +6475,10 @@ async fn gateway_handles_users_me_api_key_writes_locally_without_proxying_upstre
assert_eq!(detail_payload["concurrent_limit"], 4);
assert_eq!(detail_payload["force_capabilities"], json!({}));
assert_eq!(detail_payload["created_at"], created_at);
assert_eq!(
detail_payload["feature_settings"]["chat_pii_redaction"]["enabled"],
true
);
let delete_response = client
.delete(format!("{gateway_url}/api/users/me/api-keys/{created_id}"))