refactor(body-rules): 移除 protected_body_keys 机制,允许 body_rules 自由修改所有请求体字段

删除 get_cache_sensitive_protected_body_keys 函数及相关常量、_is_protected_path
辅助函数,从 apply_body_rules、RequestBuilder、ProviderRequestResult 等处移除
protected_body_keys 参数,更新所有调用点和测试用例。
This commit is contained in:
fawney19
2026-03-18 10:52:07 +08:00
parent 684689a82b
commit d026398bab
11 changed files with 40 additions and 213 deletions

View File

@@ -333,7 +333,6 @@ def test_codex_passthrough_builder_preserves_real_codex_headers() -> None:
def test_codex_passthrough_builder_applies_prompt_body_rules() -> None:
from src.api.handlers.base.request_builder import get_cache_sensitive_protected_body_keys
from src.core.api_format.metadata import CODEX_DEFAULT_BODY_RULES
builder = PassthroughRequestBuilder()
@@ -351,10 +350,6 @@ def test_codex_passthrough_builder_applies_prompt_body_rules() -> None:
endpoint,
key,
pre_computed_auth=("Authorization", "Bearer upstream-token"),
protected_body_keys=get_cache_sensitive_protected_body_keys(
"openai:cli",
provider_type="codex",
),
provider_api_format="openai:cli",
)