diff --git a/crates/openfang-api/src/webchat.rs b/crates/openfang-api/src/webchat.rs index e0f6926f9f..4e4874a448 100644 --- a/crates/openfang-api/src/webchat.rs +++ b/crates/openfang-api/src/webchat.rs @@ -14,6 +14,7 @@ use axum::http::header; use axum::response::IntoResponse; +use std::sync::LazyLock; /// Nonce placeholder in compile-time HTML, replaced at request time. const NONCE_PLACEHOLDER: &str = "__NONCE__"; @@ -120,7 +121,7 @@ pub async fn webchat_page() -> impl IntoResponse { /// All vendor libraries (Alpine.js, marked.js, highlight.js) are bundled /// locally — no CDN dependency. Alpine.js is included LAST because it /// immediately processes x-data directives and fires alpine:init on load. -const WEBCHAT_HTML: &str = concat!( +const WEBCHAT_HTML_BASE: &str = concat!( include_str!("../static/index_head.html"), "\n", - include_str!("../static/index_body.html"), + include_str!("../static/index_body.html") +); + +const WEBCHAT_SCRIPTS: &str = concat!( // Vendor libs: marked + highlight first (used by app.js), then Chart.js "\n", // App code "\n", - "" + "\n\n" ); + +static WEBCHAT_HTML: LazyLock = LazyLock::new(|| { + if let Some(body_close_idx) = WEBCHAT_HTML_BASE.rfind("") { + let mut assembled = String::with_capacity(WEBCHAT_HTML_BASE.len() + WEBCHAT_SCRIPTS.len()); + assembled.push_str(&WEBCHAT_HTML_BASE[..body_close_idx]); + assembled.push_str(WEBCHAT_SCRIPTS); + assembled.push_str(&WEBCHAT_HTML_BASE[body_close_idx..]); + assembled + } else { + let mut assembled = String::with_capacity(WEBCHAT_HTML_BASE.len() + WEBCHAT_SCRIPTS.len()); + assembled.push_str(WEBCHAT_HTML_BASE); + assembled.push_str(WEBCHAT_SCRIPTS); + assembled + } +}); diff --git a/crates/openfang-api/static/css/components.css b/crates/openfang-api/static/css/components.css index 7ead14aba4..9da0c887cf 100644 --- a/crates/openfang-api/static/css/components.css +++ b/crates/openfang-api/static/css/components.css @@ -1256,12 +1256,14 @@ mark.search-highlight { font-weight: 500; } -/* Theme switcher — 3-mode pill (Light / System / Dark) */ +/* Theme switcher — theme + locale */ .theme-switcher { display: inline-flex; border-radius: var(--radius-sm); border: 1px solid var(--border); overflow: hidden; + flex: 0 0 auto; + margin-left: auto; } .theme-opt { cursor: pointer; @@ -1275,6 +1277,12 @@ mark.search-highlight { } .theme-opt:hover { color: var(--text-primary); background: var(--bg-hover); } .theme-opt.active { color: var(--accent); background: var(--accent-glow); } +.theme-opt.locale-opt { + min-width: 34px; + font-size: 12px; + font-weight: 700; + letter-spacing: 0.02em; +} /* Utility */ .flex { display: flex; } diff --git a/crates/openfang-api/static/css/layout.css b/crates/openfang-api/static/css/layout.css index e892a0a1d1..0733d5b55f 100644 --- a/crates/openfang-api/static/css/layout.css +++ b/crates/openfang-api/static/css/layout.css @@ -34,9 +34,15 @@ display: flex; align-items: center; justify-content: space-between; + flex-wrap: wrap; + gap: 8px; min-height: 60px; } +.sidebar-header-text { + min-width: 0; +} + .sidebar-logo { display: flex; align-items: center; diff --git a/crates/openfang-api/static/index_body.html b/crates/openfang-api/static/index_body.html index b8f7f3d8d9..ec931ec084 100644 --- a/crates/openfang-api/static/index_body.html +++ b/crates/openfang-api/static/index_body.html @@ -41,8 +41,9 @@

OPENFANG

- + +
@@ -485,7 +486,7 @@

Welcome to OpenFang

- + @@ -957,7 +958,7 @@

-
Created
+
Created
@@ -1241,7 +1242,7 @@

Create Agent

- +
@@ -1370,7 +1371,7 @@

Workflows


- + @@ -1400,7 +1401,7 @@

No workflows yet

-
Each step runs an agent. Use {{input}} in prompts to pass the previous step's output.
+
Each step runs an agent. Use {{input}} in prompts to pass the previous step's output.
@@ -1573,7 +1574,7 @@

No workflows yet

- +
@@ -1865,7 +1866,7 @@

Create Scheduled Job

- + @@ -2440,7 +2441,7 @@

Quick Start Skills

- +
@@ -2602,7 +2603,7 @@

No hands available

-
+
Activated:
@@ -3160,9 +3161,9 @@

- + - + @@ -3666,7 +3667,7 @@

Peer Networking (OFP)

No peers connected

-

Add a [network] section to config.toml with shared_secret and peer addresses.

+

[network] 配置段中设置 shared_secret 和节点地址。

@@ -4002,7 +4003,7 @@

Top Spenders (Today)

@@ -4211,7 +4212,7 @@

Sessions

- + @@ -4361,7 +4362,7 @@

Logs