mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
fix(codex): 移除未使用的 user_id 字段,修复请求上下文未清理的问题
Co-Authored-By: AAEE86 <ppk0227@hotmail.com>
This commit is contained in:
@@ -20,7 +20,6 @@ class CodexRequestContext:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
account_id: str | None = None
|
account_id: str | None = None
|
||||||
user_id: str | None = None
|
|
||||||
|
|
||||||
|
|
||||||
_codex_request_context: contextvars.ContextVar[CodexRequestContext | None] = contextvars.ContextVar(
|
_codex_request_context: contextvars.ContextVar[CodexRequestContext | None] = contextvars.ContextVar(
|
||||||
|
|||||||
@@ -46,10 +46,11 @@ class CodexOAuthEnvelope:
|
|||||||
if ua:
|
if ua:
|
||||||
headers["User-Agent"] = ua
|
headers["User-Agent"] = ua
|
||||||
|
|
||||||
# Add chatgpt-account-id from context (set by wrap_request)
|
# Add chatgpt-account-id from context (set by wrap_request), then clear.
|
||||||
ctx = get_codex_request_context()
|
ctx = get_codex_request_context()
|
||||||
if ctx and ctx.account_id:
|
if ctx and ctx.account_id:
|
||||||
headers["chatgpt-account-id"] = ctx.account_id
|
headers["chatgpt-account-id"] = ctx.account_id
|
||||||
|
set_codex_request_context(None)
|
||||||
|
|
||||||
return headers
|
return headers
|
||||||
|
|
||||||
@@ -63,11 +64,9 @@ class CodexOAuthEnvelope:
|
|||||||
) -> tuple[dict[str, Any], str | None]:
|
) -> tuple[dict[str, Any], str | None]:
|
||||||
# Extract account_id from auth_config and set context for extra_headers()
|
# Extract account_id from auth_config and set context for extra_headers()
|
||||||
account_id = (decrypted_auth_config or {}).get("account_id")
|
account_id = (decrypted_auth_config or {}).get("account_id")
|
||||||
user_id = (decrypted_auth_config or {}).get("user_id")
|
|
||||||
set_codex_request_context(
|
set_codex_request_context(
|
||||||
CodexRequestContext(
|
CodexRequestContext(
|
||||||
account_id=str(account_id) if account_id else None,
|
account_id=str(account_id) if account_id else None,
|
||||||
user_id=str(user_id) if user_id else None,
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
# No wire envelope for Codex; keep request body as-is.
|
# No wire envelope for Codex; keep request body as-is.
|
||||||
|
|||||||
Reference in New Issue
Block a user