Spaces:
Sleeping
Sleeping
Download src/chat/route/api.rs from devin15/cursor2api-rust: direct link, hf CLI and curl.
- Browser
- Download file 974 Bytes
-
https://huggingface.co/spaces/devin15/cursor2api-rust/resolve/2887ce23ea202d72c66755fb23eeae3fa04f2f92/src/chat/route/api.rs
- Command line
-
hf download hf://spaces/devin15/cursor2api-rust@2887ce23ea202d72c66755fb23eeae3fa04f2f92/src/chat/route/api.rs
-
curl -L -o api.rs https://huggingface.co/spaces/devin15/cursor2api-rust/resolve/2887ce23ea202d72c66755fb23eeae3fa04f2f92/src/chat/route/api.rs
974 Bytes
| use axum::response::{IntoResponse, Response}; | |
| use reqwest::header::CONTENT_TYPE; | |
| use crate::{ | |
| app::constant::{ | |
| CONTENT_TYPE_TEXT_HTML_WITH_UTF8, CONTENT_TYPE_TEXT_PLAIN_WITH_UTF8, ROUTE_API_PATH, | |
| }, | |
| AppConfig, PageContent, | |
| }; | |
| pub async fn handle_api_page() -> impl IntoResponse { | |
| match AppConfig::get_page_content(ROUTE_API_PATH).unwrap_or_default() { | |
| PageContent::Default => Response::builder() | |
| .header(CONTENT_TYPE, CONTENT_TYPE_TEXT_HTML_WITH_UTF8) | |
| .body(include_str!("../../../static/api.min.html").to_string()) | |
| .unwrap(), | |
| PageContent::Text(content) => Response::builder() | |
| .header(CONTENT_TYPE, CONTENT_TYPE_TEXT_PLAIN_WITH_UTF8) | |
| .body(content.clone()) | |
| .unwrap(), | |
| PageContent::Html(content) => Response::builder() | |
| .header(CONTENT_TYPE, CONTENT_TYPE_TEXT_HTML_WITH_UTF8) | |
| .body(content.clone()) | |
| .unwrap(), | |
| } | |
| } | |