Skip to content

Commit

Permalink
Misc tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
dtcristo committed Apr 28, 2023
1 parent f074318 commit e70f67f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*
!/src/
!/Cargo*
!/Cargo.lock
!/Cargo.toml
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/target
/target/
9 changes: 6 additions & 3 deletions src/web/generate.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
use std::{env, future};
use std::future;

use axum::{body::StreamBody, http::Uri, response::IntoResponse};
use eventsource_stream::Eventsource;
use futures::{StreamExt, TryStreamExt};
use reqwest::{header, Client};
use serde::{Deserialize, Serialize};

use crate::error::{Error, Result};
use crate::{
env,
error::{Error, Result},
};

#[derive(Debug, Serialize)]
struct ChatCompletionsBody {
Expand Down Expand Up @@ -70,7 +73,7 @@ Start the reponse with the following exact characters:
"authorization",
&format!(
"Bearer {}",
env::var("OPENAI_API_KEY").map_err(|_| Error::EnvironmentError)?
env::openai_api_key().ok_or(Error::EnvironmentError)?
),
)
.body(serde_json::to_string(&body).map_err(|_| Error::SerializationError)?)
Expand Down

0 comments on commit e70f67f

Please sign in to comment.