feat: add codex sse and usage helpers

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
zyycn
2026-06-11 23:19:01 +08:00
co-authored by Codex
parent 1b1e447697
commit 225fbffb75
15 changed files with 305 additions and 12 deletions
+2 -2
View File
@@ -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) => {
+1 -1
View File
@@ -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()) {