mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
1 parent
85e687c74a
commit
8b1e397211
3 files changed
+18
-4
No files matched your search
Generated
+1
@@ -1068,6 +1068,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.17",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@@ -1,21 +1,22 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "codex-client"
|
|
||||||
version.workspace = true
|
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
|
name = "codex-client"
|
||||||
|
version.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = { workspace = true }
|
async-trait = { workspace = true }
|
||||||
bytes = { workspace = true }
|
bytes = { workspace = true }
|
||||||
|
eventsource-stream = { workspace = true }
|
||||||
futures = { workspace = true }
|
futures = { workspace = true }
|
||||||
http = { workspace = true }
|
http = { workspace = true }
|
||||||
|
rand = { workspace = true }
|
||||||
reqwest = { workspace = true, features = ["json", "stream"] }
|
reqwest = { workspace = true, features = ["json", "stream"] }
|
||||||
serde = { workspace = true, features = ["derive"] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
serde_json = { workspace = true }
|
serde_json = { workspace = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
tokio = { workspace = true, features = ["macros", "rt", "time", "sync"] }
|
tokio = { workspace = true, features = ["macros", "rt", "time", "sync"] }
|
||||||
rand = { workspace = true }
|
tracing = { workspace = true }
|
||||||
eventsource-stream = { workspace = true }
|
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
@@ -8,6 +8,9 @@ use futures::stream::BoxStream;
|
|||||||
use http::HeaderMap;
|
use http::HeaderMap;
|
||||||
use http::Method;
|
use http::Method;
|
||||||
use http::StatusCode;
|
use http::StatusCode;
|
||||||
|
use tracing::Level;
|
||||||
|
use tracing::enabled;
|
||||||
|
use tracing::trace;
|
||||||
|
|
||||||
pub type ByteStream = BoxStream<'static, Result<Bytes, TransportError>>;
|
pub type ByteStream = BoxStream<'static, Result<Bytes, TransportError>>;
|
||||||
|
|
||||||
@@ -83,6 +86,15 @@ impl HttpTransport for ReqwestTransport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn stream(&self, req: Request) -> Result<StreamResponse, TransportError> {
|
async fn stream(&self, req: Request) -> Result<StreamResponse, TransportError> {
|
||||||
|
if enabled!(Level::TRACE) {
|
||||||
|
trace!(
|
||||||
|
"{} to {}: {}",
|
||||||
|
req.method,
|
||||||
|
req.url,
|
||||||
|
req.body.as_ref().unwrap_or_default()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let builder = self.build(req)?;
|
let builder = self.build(req)?;
|
||||||
let resp = builder.send().await.map_err(Self::map_error)?;
|
let resp = builder.send().await.map_err(Self::map_error)?;
|
||||||
let status = resp.status();
|
let status = resp.status();
|
||||||
|
|||||||
Reference in new issue
Block a user