mirror of
https://github.com/openai/codex.git
synced 2026-05-28 15:00:16 +00:00
[codex-analytics] ingest server requests and responses
This commit is contained in:
@@ -889,6 +889,23 @@ macro_rules! server_request_definitions {
|
||||
$(Self::$variant { request_id, .. } => request_id,)*
|
||||
}
|
||||
}
|
||||
|
||||
pub fn response_from_result(
|
||||
&self,
|
||||
result: crate::Result,
|
||||
) -> serde_json::Result<ServerResponse> {
|
||||
match self {
|
||||
$(
|
||||
Self::$variant { request_id, .. } => {
|
||||
let response = serde_json::from_value::<$response>(result)?;
|
||||
Ok(ServerResponse::$variant {
|
||||
request_id: request_id.clone(),
|
||||
response,
|
||||
})
|
||||
}
|
||||
)*
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Typed response from the client to the server.
|
||||
|
||||
Reference in New Issue
Block a user