mirror of
https://github.com/zyycn/codex-proxy-rs.git
synced 2026-11-15 00:06:24 +00:00
feat: add codex sse and usage helpers
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
+2
-2
@@ -35,7 +35,7 @@ impl<T> AdminEnvelope<T> {
|
||||
data: T,
|
||||
request_id: impl Into<String>,
|
||||
) -> Self {
|
||||
// 中文注释:body code 给前端做业务分支,HTTP status 仍然是传输层真相。
|
||||
// body code 给前端做业务分支,HTTP status 仍然是传输层真相。
|
||||
Self {
|
||||
code,
|
||||
message: message.into(),
|
||||
@@ -161,7 +161,7 @@ pub async fn login(
|
||||
}
|
||||
};
|
||||
|
||||
// 中文注释:admin 登录只校验管理员密码;客户端 cpr_ API Key 不能参与后台登录。
|
||||
// admin 登录只校验管理员密码;客户端 cpr_ API Key 不能参与后台登录。
|
||||
match verify_admin_password(&payload.password, &admin.password_hash) {
|
||||
Ok(true) => {}
|
||||
Ok(false) => {
|
||||
|
||||
@@ -31,7 +31,7 @@ pub async fn attach_request_id(mut request: Request, next: Next) -> Response {
|
||||
.and_then(RequestId::from_header)
|
||||
.unwrap_or_else(RequestId::generate);
|
||||
|
||||
// 中文注释:同一个 requestId 同时进入日志、响应头和 admin body,方便跨层排查。
|
||||
// 同一个 requestId 同时进入日志、响应头和 admin body,方便跨层排查。
|
||||
request.extensions_mut().insert(request_id.clone());
|
||||
let mut response = next.run(request).await;
|
||||
if let Ok(value) = HeaderValue::from_str(request_id.as_str()) {
|
||||
|
||||
Reference in New Issue
Block a user