(
State(state): State<Arc<ServerState>>,
Path((session_id, msg_id)): Path<(String, String)>,
)
| 1860 | } |
| 1861 | |
| 1862 | async fn get_message( |
| 1863 | State(state): State<Arc<ServerState>>, |
| 1864 | Path((session_id, msg_id)): Path<(String, String)>, |
| 1865 | ) -> Result<Json<serde_json::Value>> { |
| 1866 | let sessions = state.sessions.lock().await; |
| 1867 | let session = sessions |
| 1868 | .get(&session_id) |
| 1869 | .ok_or_else(|| ApiError::SessionNotFound(session_id.clone()))?; |
| 1870 | let message = session |
| 1871 | .get_message(&msg_id) |
| 1872 | .ok_or_else(|| ApiError::NotFound(format!("Message not found: {}", msg_id)))?; |
| 1873 | |
| 1874 | let info = serde_json::json!({ |
| 1875 | "id": message.id, |
| 1876 | "sessionID": session_id, |
| 1877 | "role": message_role_name(&message.role), |
| 1878 | "createdAt": message.created_at.timestamp_millis(), |
| 1879 | }); |
| 1880 | Ok(Json(serde_json::json!({ |
| 1881 | "info": info, |
| 1882 | "parts": message.parts.clone(), |
| 1883 | }))) |
| 1884 | } |
| 1885 | |
| 1886 | #[derive(Debug, Deserialize)] |
| 1887 | pub struct UpdatePartRequest { |
nothing calls this directly
no test coverage detected