Skip to content

Commit

Permalink
builds
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyftang committed Feb 23, 2024
1 parent 95c6eb4 commit c166f96
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions router/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,14 @@ async fn completions_v1(
let req = req.0;
let mut gen_req = CompatGenerateRequest::from(req);

match headers.get("Authorization") {
Some(x) => x.strip_prefix("Bearer :").and_then(|token| gen_req.parameters.api_token = token)
// TODO: Just for testing, don't merge
None => println!("headers: {headers}")
}
headers.get("Authorization").map_or((), |x| {
x.to_str().map_or((), |y| {
y.strip_prefix("Bearer :").map_or((), |token| {
println!("token!! {token}");
gen_req.parameters.api_token = Some(token.to_string());
})
})
});

// default return_full_text given the pipeline_tag
if gen_req.parameters.return_full_text.is_none() {
Expand Down Expand Up @@ -184,11 +187,14 @@ async fn chat_completions_v1(
let req = req.0;
let mut gen_req = CompatGenerateRequest::from(req);

match headers.get("Authorization") {
Some(x) => x.strip_prefix("Bearer :").and_then(|token| gen_req.parameters.api_token = token)
// TODO: Just for testing, don't merge
None => println!("headers: {headers}")
}
headers.get("Authorization").map_or((), |x| {
x.to_str().map_or((), |y| {
y.strip_prefix("Bearer :").map_or((), |token| {
println!("token!! {token}");
gen_req.parameters.api_token = Some(token.to_string());
})
})
});

// default return_full_text given the pipeline_tag
if gen_req.parameters.return_full_text.is_none() {
Expand Down

0 comments on commit c166f96

Please sign in to comment.