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

@@ -65,6 +65,7 @@ pub fn AppShell() -> Element {
email: info.email,
name: info.name,
avatar_url: info.avatar_url,
librechat_url: info.librechat_url,
class: sidebar_cls,
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(Route),
/// External URL opened in a new tab (rendered as `<a href>`).
External(&'static str),
External(String),
}
/// Navigation entry for the sidebar.
@@ -43,6 +43,7 @@ pub fn Sidebar(
name: String,
email: String,
avatar_url: String,
#[props(default = "http://localhost:3080".to_string())] librechat_url: String,
#[props(default = "sidebar".to_string())] class: String,
#[props(default)] on_nav: EventHandler<()>,
) -> Element {
@@ -66,7 +67,7 @@ pub fn Sidebar(
key: "chat",
label: t(locale_val, "nav.chat"),
// 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 } },
},
NavItem {
@@ -124,7 +125,7 @@ pub fn Sidebar(
}
}
NavTarget::External(url) => {
let url = *url;
let url = url.clone();
rsx! {
a {
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}")))?;
match user_state {
Some(u) => Ok(AuthInfo {
authenticated: true,
sub: u.sub,
email: u.user.email,
name: u.user.name,
avatar_url: u.user.avatar_url,
}),
Some(u) => {
let librechat_url =
std::env::var("LIBRECHAT_URL").unwrap_or_else(|_| "http://localhost:3080".into());
Ok(AuthInfo {
authenticated: true,
sub: u.sub,
email: u.user.email,
name: u.user.name,
avatar_url: u.user.avatar_url,
librechat_url,
})
}
None => Ok(AuthInfo::default()),
}
}

View File

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