mirror of
https://github.com/openai/codex.git
synced 2026-04-24 22:54:54 +00:00
use client
This commit is contained in:
@@ -7,11 +7,10 @@ use codex_client::ReqwestTransport;
|
||||
use http::header::CONTENT_TYPE;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde_json::Value;
|
||||
use std::fmt;
|
||||
use std::time::Duration;
|
||||
use strum::Display;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, Display, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ComponentHealth {
|
||||
Operational,
|
||||
@@ -33,14 +32,6 @@ impl ComponentHealth {
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for ComponentHealth {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let value = Value::from(self).as_str().ok_or(fmt::Error)?;
|
||||
|
||||
f.write_str(value)
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn fetch_codex_health() -> Result<ComponentHealth> {
|
||||
let client = reqwest::Client::builder()
|
||||
.connect_timeout(Duration::from_secs(5))
|
||||
|
||||
Reference in New Issue
Block a user