mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
fix(codex): 取消对 openai:compact 端点的 body_rules 修改
Codex 的请求体规则(drop max_output_tokens/temperature/top_p, set store=false 等) 只应作用于 openai:cli, 不应影响 openai:compact 端点。
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
"""backfill_codex_default_body_rules
|
"""backfill_codex_default_body_rules
|
||||||
|
|
||||||
Backfill default body_rules for openai:cli and openai:compact endpoints
|
Backfill default body_rules for openai:cli endpoints
|
||||||
that currently have body_rules IS NULL.
|
that currently have body_rules IS NULL.
|
||||||
|
|
||||||
Rules:
|
Rules:
|
||||||
@@ -29,7 +29,7 @@ down_revision = "1d2e3f4a5b6c"
|
|||||||
branch_labels = None
|
branch_labels = None
|
||||||
depends_on = None
|
depends_on = None
|
||||||
|
|
||||||
_TARGET_FORMATS = ("openai:cli", "openai:compact")
|
_TARGET_FORMATS = ("openai:cli",)
|
||||||
|
|
||||||
_DEFAULT_BODY_RULES = [
|
_DEFAULT_BODY_RULES = [
|
||||||
{"action": "drop", "path": "max_output_tokens"},
|
{"action": "drop", "path": "max_output_tokens"},
|
||||||
@@ -55,10 +55,10 @@ def upgrade() -> None:
|
|||||||
UPDATE provider_endpoints
|
UPDATE provider_endpoints
|
||||||
SET body_rules = CAST(:rules AS json),
|
SET body_rules = CAST(:rules AS json),
|
||||||
updated_at = CURRENT_TIMESTAMP
|
updated_at = CURRENT_TIMESTAMP
|
||||||
WHERE api_format IN (:fmt1, :fmt2)
|
WHERE api_format = :fmt
|
||||||
AND (body_rules IS NULL OR body_rules::text = 'null')
|
AND (body_rules IS NULL OR body_rules::text = 'null')
|
||||||
"""),
|
"""),
|
||||||
{"rules": rules_json, "fmt1": _TARGET_FORMATS[0], "fmt2": _TARGET_FORMATS[1]},
|
{"rules": rules_json, "fmt": _TARGET_FORMATS[0]},
|
||||||
)
|
)
|
||||||
if result.rowcount:
|
if result.rowcount:
|
||||||
print(f" backfilled body_rules for {result.rowcount} endpoint(s)")
|
print(f" backfilled body_rules for {result.rowcount} endpoint(s)")
|
||||||
|
|||||||
@@ -152,7 +152,6 @@ _ENDPOINT_DEFINITIONS: dict[tuple[ApiFamily, EndpointKind], EndpointDefinition]
|
|||||||
# compact endpoint is non-streaming by design.
|
# compact endpoint is non-streaming by design.
|
||||||
stream_in_body=False,
|
stream_in_body=False,
|
||||||
data_format_id="openai_responses",
|
data_format_id="openai_responses",
|
||||||
default_body_rules=_CODEX_DEFAULT_BODY_RULES,
|
|
||||||
),
|
),
|
||||||
(ApiFamily.OPENAI, EndpointKind.VIDEO): EndpointDefinition(
|
(ApiFamily.OPENAI, EndpointKind.VIDEO): EndpointDefinition(
|
||||||
api_family=ApiFamily.OPENAI,
|
api_family=ApiFamily.OPENAI,
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ def maybe_patch_request_for_codex(
|
|||||||
"""
|
"""
|
||||||
if (provider_type or "").lower() != ProviderType.CODEX:
|
if (provider_type or "").lower() != ProviderType.CODEX:
|
||||||
return request_body
|
return request_body
|
||||||
if (provider_api_format or "").lower() not in {"openai:cli", "openai:compact"}:
|
if (provider_api_format or "").lower() not in {"openai:cli"}:
|
||||||
return request_body
|
return request_body
|
||||||
if not isinstance(request_body, dict):
|
if not isinstance(request_body, dict):
|
||||||
return request_body
|
return request_body
|
||||||
|
|||||||
Reference in New Issue
Block a user