diff --git a/apps/llm-proxy/src/main.rs b/apps/llm-proxy/src/main.rs index 02f35fa..3dd7721 100644 --- a/apps/llm-proxy/src/main.rs +++ b/apps/llm-proxy/src/main.rs @@ -37,6 +37,8 @@ async fn main() -> std::io::Result<()> { .route("/healthz", get(|| async { "ok" })) .route("/", get(|| async { Redirect::permanent("/chat") })) .route("/chat", get(chat_ui)) + .route("/favicon.svg", get(favicon)) + .route("/favicon.ico", get(favicon)) // 浏览器默认会请求 .ico,让它共享同一 SVG .merge(chat_api) .layer(TraceLayer::new_for_http()); @@ -47,11 +49,22 @@ async fn main() -> std::io::Result<()> { } const CHAT_HTML: &str = include_str!("../web/chat.html"); +const FAVICON_SVG: &str = include_str!("../web/favicon.svg"); async fn chat_ui() -> Html<&'static str> { Html(CHAT_HTML) } +async fn favicon() -> impl IntoResponse { + ( + [ + (axum::http::header::CONTENT_TYPE, "image/svg+xml"), + (axum::http::header::CACHE_CONTROL, "public, max-age=604800"), + ], + FAVICON_SVG, + ) +} + /// 验 `Authorization: token `,错的直接 401。 async fn require_token( State(cfg): State>, diff --git a/apps/llm-proxy/web/chat.html b/apps/llm-proxy/web/chat.html index ec52cef..bc9f63f 100644 --- a/apps/llm-proxy/web/chat.html +++ b/apps/llm-proxy/web/chat.html @@ -4,6 +4,7 @@ + llm.famzheng.me