Skip to content

Commit

Permalink
Fix model name.
Browse files Browse the repository at this point in the history
  • Loading branch information
cryscan committed Oct 22, 2023
1 parent 4547344 commit cc5b776
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/oai/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,17 @@ pub struct ModelResponse {

pub async fn models(State(ThreadState(sender)): State<ThreadState>) -> Json<ModelResponse> {
let info = request_info(sender, Duration::from_secs(1)).await;
let model_name = info.reload.model_path.to_string_lossy().into();
let model_name = info
.reload
.model_path
.file_stem()
.map(|stem| stem.to_string_lossy())
.unwrap_or_default();

Json(ModelResponse {
data: vec![ModelChoice {
object: "models".into(),
id: model_name,
id: model_name.into(),
}],
})
}

0 comments on commit cc5b776

Please sign in to comment.