diff --git a/crates/neuron/src/api.rs b/crates/neuron/src/api.rs index 30399d2..19d108f 100644 --- a/crates/neuron/src/api.rs +++ b/crates/neuron/src/api.rs @@ -56,7 +56,7 @@ async fn list_models(State(state): State>) -> impl IntoResponse Ok(models) => Json(json!(models)).into_response(), Err(e) => ( StatusCode::INTERNAL_SERVER_ERROR, - Json(json!({"error": e.to_string()})), + Json(json!({"error": format!("{e:#}")})), ) .into_response(), } @@ -71,7 +71,7 @@ async fn load_model( Ok(()) => Json(json!({"status": "loaded"})).into_response(), Err(e) => ( StatusCode::BAD_REQUEST, - Json(json!({"error": e.to_string()})), + Json(json!({"error": format!("{e:#}")})), ) .into_response(), } @@ -95,7 +95,11 @@ async fn unload_model( let registry = state.registry.read().await; match registry.unload_model(&model_id).await { Ok(()) => Json(json!({"status": "unloaded"})).into_response(), - Err(e) => (StatusCode::NOT_FOUND, Json(json!({"error": e.to_string()}))).into_response(), + Err(e) => ( + StatusCode::NOT_FOUND, + Json(json!({"error": format!("{e:#}")})), + ) + .into_response(), } } @@ -151,7 +155,7 @@ async fn chat_completions( .into_response(), Err(InferenceError::Other(e)) => ( StatusCode::INTERNAL_SERVER_ERROR, - Json(json!({"error": e.to_string()})), + Json(json!({"error": format!("{e:#}")})), ) .into_response(), } @@ -165,7 +169,7 @@ async fn chat_completions( .into_response(), Err(InferenceError::Other(e)) => ( StatusCode::INTERNAL_SERVER_ERROR, - Json(json!({"error": e.to_string()})), + Json(json!({"error": format!("{e:#}")})), ) .into_response(), } diff --git a/data/neuron.service b/data/neuron.service index c844da7..5da4066 100644 --- a/data/neuron.service +++ b/data/neuron.service @@ -10,6 +10,12 @@ Restart=on-failure RestartSec=5 User=neuron Group=neuron +# /var/lib/neuron is the neuron user's $HOME — hf-hub writes its +# default cache there (~/.cache/huggingface/hub). Without this directive +# systemd doesn't create the directory and hf-hub downloads fail with +# "fetch GGUF : failed to create cache dir". +StateDirectory=neuron +StateDirectoryMode=0755 # Loading default_models from neuron.toml happens before the HTTP # listener binds; large models can take many minutes to download and # materialise on first activation. systemd's default TimeoutStartSec