From a8e5100380d4d55871ea19e70d6941851907c988 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Mon, 18 May 2026 00:34:49 +0100 Subject: [PATCH] =?UTF-8?q?llm-proxy(ui):=20=E4=BF=AE=20placeholder=20toke?= =?UTF-8?q?n=20=E6=B3=84=E6=BC=8F=20+=20UI=20=E9=87=8D=E5=81=9A=20+=20?= =?UTF-8?q?=CE=BB=20favicon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修:token 输入框 placeholder 之前硬编码了真实 token (`e.g. famzheng-llm-2026`),等于明文泄露。改成 `your auth token` - UI 重做 — 100dvh 锁 viewport(处理移动软键盘)+ grid 布局 让 thread 永远占中间、footer 永远贴底 - textarea autogrow(最高 200px,超出内部滚) - 复制按钮 / smooth scroll-to-bottom (double rAF) / iOS momentum scroll / safe-area padding - 错误状态独立 row,monospace + 红底 - λ favicon(紫蓝渐变 + 绿色在线点 + glow)— SVG include_str! 进 binary,`/favicon.svg` + `/favicon.ico` 同源响应 --- apps/llm-proxy/src/main.rs | 13 +++++++++++++ apps/llm-proxy/web/chat.html | 1 + apps/llm-proxy/web/favicon.svg | 18 ++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 apps/llm-proxy/web/favicon.svg 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