hotfix: hard-coded URL for chat in dashboard #15

Merged
sharang merged 5 commits from feat/librechat-integration into main 2026-02-24 11:52:59 +00:00
5 changed files with 20 additions and 11 deletions

View File

@@ -95,4 +95,4 @@ services:
- librechat-data:/app/data - librechat-data:/app/data
volumes: volumes:
librechat-data: librechat-data:

View File

@@ -65,6 +65,7 @@ pub fn AppShell() -> Element {
email: info.email, email: info.email,
name: info.name, name: info.name,
avatar_url: info.avatar_url, avatar_url: info.avatar_url,
librechat_url: info.librechat_url,
class: sidebar_cls, class: sidebar_cls,
on_nav: move |_| mobile_menu_open.set(false), on_nav: move |_| mobile_menu_open.set(false),
} }

View File

@@ -13,7 +13,7 @@ enum NavTarget {
/// Internal Dioxus route (rendered as `Link { to: route }`). /// Internal Dioxus route (rendered as `Link { to: route }`).
Internal(Route), Internal(Route),
/// External URL opened in a new tab (rendered as `<a href>`). /// External URL opened in a new tab (rendered as `<a href>`).
External(&'static str), External(String),
} }
/// Navigation entry for the sidebar. /// Navigation entry for the sidebar.
@@ -43,6 +43,7 @@ pub fn Sidebar(
name: String, name: String,
email: String, email: String,
avatar_url: String, avatar_url: String,
#[props(default = "http://localhost:3080".to_string())] librechat_url: String,
#[props(default = "sidebar".to_string())] class: String, #[props(default = "sidebar".to_string())] class: String,
#[props(default)] on_nav: EventHandler<()>, #[props(default)] on_nav: EventHandler<()>,
) -> Element { ) -> Element {
@@ -66,7 +67,7 @@ pub fn Sidebar(
key: "chat", key: "chat",
label: t(locale_val, "nav.chat"), label: t(locale_val, "nav.chat"),
// Opens LibreChat in a new tab; SSO via shared Keycloak realm. // Opens LibreChat in a new tab; SSO via shared Keycloak realm.
target: NavTarget::External("http://localhost:3080"), target: NavTarget::External(librechat_url.clone()),
icon: rsx! { Icon { icon: BsChatDots, width: 18, height: 18 } }, icon: rsx! { Icon { icon: BsChatDots, width: 18, height: 18 } },
}, },
NavItem { NavItem {
@@ -124,7 +125,7 @@ pub fn Sidebar(
} }
} }
NavTarget::External(url) => { NavTarget::External(url) => {
let url = *url; let url = url.clone();
rsx! { rsx! {
a { a {
href: url, href: url,

View File

@@ -24,13 +24,18 @@ pub async fn check_auth() -> Result<AuthInfo, ServerFnError> {
.map_err(|e| ServerFnError::new(format!("session read failed: {e}")))?; .map_err(|e| ServerFnError::new(format!("session read failed: {e}")))?;
match user_state { match user_state {
Some(u) => Ok(AuthInfo { Some(u) => {
authenticated: true, let librechat_url =
sub: u.sub, std::env::var("LIBRECHAT_URL").unwrap_or_else(|_| "http://localhost:3080".into());
email: u.user.email, Ok(AuthInfo {
name: u.user.name, authenticated: true,
avatar_url: u.user.avatar_url, sub: u.sub,
}), email: u.user.email,
name: u.user.name,
avatar_url: u.user.avatar_url,
librechat_url,
})
}
None => Ok(AuthInfo::default()), None => Ok(AuthInfo::default()),
} }
} }

View File

@@ -22,6 +22,8 @@ pub struct AuthInfo {
pub name: String, pub name: String,
/// Avatar URL (from Keycloak picture claim) /// Avatar URL (from Keycloak picture claim)
pub avatar_url: String, pub avatar_url: String,
/// LibreChat instance URL for the sidebar chat link
pub librechat_url: String,
} }
/// Per-user LLM provider configuration stored in MongoDB. /// Per-user LLM provider configuration stored in MongoDB.