Skip to content

Commit

Permalink
🐛 Fix chat validation about new chatgpt
Browse files Browse the repository at this point in the history
  • Loading branch information
luoshuijs committed Mar 27, 2024
1 parent f022738 commit bd7d583
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions crates/openai/src/serve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ use std::str::FromStr;
use std::sync::Arc;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use tower_http::trace;
use tracing::Level;
use tracing::{Instrument, Level};
use tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt;

Expand Down Expand Up @@ -185,7 +185,8 @@ impl Serve {
.route("/auth/revoke_token", post(post_revoke_token))
.route("/auth/refresh_session", post(post_refresh_session))
.route("/auth/sess_token", post(post_sess_token))
.route("/auth/billing", post(post_billing));
.route("/auth/billing", post(post_billing))
.route("/v2/*path", any(arkos_static));

let router = router::config(
// Enable arkose token endpoint proxy
Expand Down Expand Up @@ -509,3 +510,23 @@ async fn check_wan_address() {
}
}
}

async fn arkos_static(path: Path<String>) -> Result<Response<Body>, ResponseError> {
let client = with_context!(api_client);
let data = client
.get(format!(
"{}/v2/{}",
arkose::Type::GPT4.origin_url(),
path.0.as_str()
))
.send()
.await?;
let mut builder = Response::builder().status(data.status());
for (key, value) in data.headers().iter() {
builder = builder.header(key, value);
}
let content = data.bytes().await?;
builder
.body(content.into())
.map_err(ResponseError::InternalServerError)
}

0 comments on commit bd7d583

Please sign in to comment.