fix: format + tracing
This commit is contained in:
+2
-2
@@ -28,13 +28,13 @@ pub fn init_tracing() {
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
init_tracing();
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
dotenvy::dotenv().ok();
|
||||
}
|
||||
|
||||
init_tracing();
|
||||
|
||||
let state = AppState {
|
||||
ollama: Arc::new(OllamaProvider::new(OLLAMA_URL.as_str())),
|
||||
};
|
||||
|
||||
@@ -41,7 +41,7 @@ pub async fn auth_middleware(mut request: Request, next: Next) -> Result<Respons
|
||||
Ok(next.run(request).await)
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("JWT validation failed: {:?}", e);
|
||||
tracing::error!("JWT validation failed: {:?}", e);
|
||||
Err(StatusCode::UNAUTHORIZED)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ pub async fn completions(
|
||||
State(state): State<AppState>,
|
||||
Json(body): Json<api::CompletionRequest>,
|
||||
) -> Result<Response, (axum::http::StatusCode, Json<api::ErrorResponse>)> {
|
||||
tracing::debug!("Received /completion with body {:?}", body);
|
||||
if body.base.stream {
|
||||
let stream = state.ollama.completions_stream(&body).await.map_err(|e| {
|
||||
let (code, msg) = ollama_err(e);
|
||||
@@ -116,6 +117,7 @@ pub async fn chat_completions(
|
||||
State(state): State<AppState>,
|
||||
Json(body): Json<api::ChatRequest>,
|
||||
) -> Result<Response, (axum::http::StatusCode, String)> {
|
||||
tracing::debug!("Received /completion with body {:?}", body);
|
||||
if body.base.stream {
|
||||
let stream = state
|
||||
.ollama
|
||||
|
||||
Reference in New Issue
Block a user