diff --git a/lightrag/api/webui/assets/index-BLBnmXUl.js b/lightrag/api/webui/assets/index-Bj1VgJta.js similarity index 99% rename from lightrag/api/webui/assets/index-BLBnmXUl.js rename to lightrag/api/webui/assets/index-Bj1VgJta.js index 6ff9c4f3..461032dd 100644 --- a/lightrag/api/webui/assets/index-BLBnmXUl.js +++ b/lightrag/api/webui/assets/index-Bj1VgJta.js @@ -28,7 +28,7 @@ You can add a description to the \`${Na}\` by passing a \`${Dd}\` component as a Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Na}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. -For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return E.useEffect(()=>{var d;document.getElementById((d=g.current)==null?void 0:d.getAttribute("aria-describedby"))||console.warn(b)},[b,g]),null},gp=vd,pp=bd,Cd=Sd,Od=Td,jd=Ed,Rd=zd,Ud=Ad,_d=Nd;const yp=gp,vp=pp,Hd=E.forwardRef(({className:g,...b},x)=>o.jsx(Cd,{className:Qe("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",g),...b,ref:x}));Hd.displayName=Cd.displayName;const Ld=E.forwardRef(({className:g,...b},x)=>o.jsxs(vp,{children:[o.jsx(Hd,{}),o.jsx(Od,{ref:x,className:Qe("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-top-[48%] fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg",g),...b})]}));Ld.displayName=Od.displayName;const qd=({className:g,...b})=>o.jsx("div",{className:Qe("flex flex-col space-y-2 text-center sm:text-left",g),...b});qd.displayName="AlertDialogHeader";const Bd=E.forwardRef(({className:g,...b},x)=>o.jsx(Ud,{ref:x,className:Qe("text-lg font-semibold",g),...b}));Bd.displayName=Ud.displayName;const Gd=E.forwardRef(({className:g,...b},x)=>o.jsx(_d,{ref:x,className:Qe("text-muted-foreground text-sm",g),...b}));Gd.displayName=_d.displayName;const bp=E.forwardRef(({className:g,...b},x)=>o.jsx(jd,{ref:x,className:Qe(od(),g),...b}));bp.displayName=jd.displayName;const Sp=E.forwardRef(({className:g,...b},x)=>o.jsx(Rd,{ref:x,className:Qe(od({variant:"outline"}),"mt-2 sm:mt-0",g),...b}));Sp.displayName=Rd.displayName;const Tp=({open:g,onOpenChange:b})=>{const{t:x}=ql(),d=Ve.use.apiKey(),[N,j]=E.useState(""),H=Gt.use.message();E.useEffect(()=>{j(d||"")},[d,g]),E.useEffect(()=>{H&&(H.includes(rd)||H.includes(fd))&&b(!0)},[H,b]);const $=E.useCallback(()=>{Ve.setState({apiKey:N||null}),b(!1)},[N,b]),Y=E.useCallback(W=>{j(W.target.value)},[j]);return o.jsx(yp,{open:g,onOpenChange:b,children:o.jsxs(Ld,{children:[o.jsxs(qd,{children:[o.jsx(Bd,{children:x("apiKeyAlert.title")}),o.jsx(Gd,{children:x("apiKeyAlert.description")})]}),o.jsxs("div",{className:"flex flex-col gap-4",children:[o.jsxs("form",{className:"flex gap-2",onSubmit:W=>W.preventDefault(),children:[o.jsx(us,{type:"password",value:N,onChange:Y,placeholder:x("apiKeyAlert.placeholder"),className:"max-h-full w-full min-w-0",autoComplete:"off"}),o.jsx(Cn,{onClick:$,variant:"outline",size:"sm",children:x("apiKeyAlert.save")})]}),H&&o.jsx("div",{className:"text-sm text-red-500",children:H})]})]})})},xp=({status:g})=>{const{t:b}=ql();return g?o.jsxs("div",{className:"min-w-[300px] space-y-2 text-xs",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("h4",{className:"font-medium",children:b("graphPanel.statusCard.storageInfo")}),o.jsxs("div",{className:"text-foreground grid grid-cols-[120px_1fr] gap-1",children:[o.jsxs("span",{children:[b("graphPanel.statusCard.workingDirectory"),":"]}),o.jsx("span",{className:"truncate",children:g.working_directory}),o.jsxs("span",{children:[b("graphPanel.statusCard.inputDirectory"),":"]}),o.jsx("span",{className:"truncate",children:g.input_directory})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("h4",{className:"font-medium",children:b("graphPanel.statusCard.llmConfig")}),o.jsxs("div",{className:"text-foreground grid grid-cols-[120px_1fr] gap-1",children:[o.jsxs("span",{children:[b("graphPanel.statusCard.llmBinding"),":"]}),o.jsx("span",{children:g.configuration.llm_binding}),o.jsxs("span",{children:[b("graphPanel.statusCard.llmBindingHost"),":"]}),o.jsx("span",{children:g.configuration.llm_binding_host}),o.jsxs("span",{children:[b("graphPanel.statusCard.llmModel"),":"]}),o.jsx("span",{children:g.configuration.llm_model}),o.jsxs("span",{children:[b("graphPanel.statusCard.maxTokens"),":"]}),o.jsx("span",{children:g.configuration.max_tokens})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("h4",{className:"font-medium",children:b("graphPanel.statusCard.embeddingConfig")}),o.jsxs("div",{className:"text-foreground grid grid-cols-[120px_1fr] gap-1",children:[o.jsxs("span",{children:[b("graphPanel.statusCard.embeddingBinding"),":"]}),o.jsx("span",{children:g.configuration.embedding_binding}),o.jsxs("span",{children:[b("graphPanel.statusCard.embeddingBindingHost"),":"]}),o.jsx("span",{children:g.configuration.embedding_binding_host}),o.jsxs("span",{children:[b("graphPanel.statusCard.embeddingModel"),":"]}),o.jsx("span",{children:g.configuration.embedding_model})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("h4",{className:"font-medium",children:b("graphPanel.statusCard.storageConfig")}),o.jsxs("div",{className:"text-foreground grid grid-cols-[120px_1fr] gap-1",children:[o.jsxs("span",{children:[b("graphPanel.statusCard.kvStorage"),":"]}),o.jsx("span",{children:g.configuration.kv_storage}),o.jsxs("span",{children:[b("graphPanel.statusCard.docStatusStorage"),":"]}),o.jsx("span",{children:g.configuration.doc_status_storage}),o.jsxs("span",{children:[b("graphPanel.statusCard.graphStorage"),":"]}),o.jsx("span",{children:g.configuration.graph_storage}),o.jsxs("span",{children:[b("graphPanel.statusCard.vectorStorage"),":"]}),o.jsx("span",{children:g.configuration.vector_storage})]})]})]}):o.jsx("div",{className:"text-foreground text-xs",children:b("graphPanel.statusCard.unavailable")})},Ap=({open:g,onOpenChange:b,status:x})=>{const{t:d}=ql();return o.jsx(Mg,{open:g,onOpenChange:b,children:o.jsxs(zg,{className:"sm:max-w-[500px]",children:[o.jsxs(Cg,{children:[o.jsx(Og,{children:d("graphPanel.statusDialog.title")}),o.jsx(jg,{children:d("graphPanel.statusDialog.description")})]}),o.jsx(xp,{status:x})]})})},Dp=()=>{const{t:g}=ql(),b=Gt.use.health(),x=Gt.use.lastCheckTime(),d=Gt.use.status(),[N,j]=E.useState(!1),[H,$]=E.useState(!1);return E.useEffect(()=>{j(!0);const Y=setTimeout(()=>j(!1),300);return()=>clearTimeout(Y)},[x]),o.jsxs("div",{className:"fixed right-4 bottom-4 flex items-center gap-2 opacity-80 select-none",children:[o.jsxs("div",{className:"flex cursor-pointer items-center gap-2",onClick:()=>$(!0),children:[o.jsx("div",{className:Qe("h-3 w-3 rounded-full transition-all duration-300","shadow-[0_0_8px_rgba(0,0,0,0.2)]",b?"bg-green-500":"bg-red-500",N&&"scale-125",N&&b&&"shadow-[0_0_12px_rgba(34,197,94,0.4)]",N&&!b&&"shadow-[0_0_12px_rgba(239,68,68,0.4)]")}),o.jsx("span",{className:"text-muted-foreground text-xs",children:g(b?"graphPanel.statusIndicator.connected":"graphPanel.statusIndicator.disconnected")})]}),o.jsx(Ap,{open:H,onOpenChange:$,status:d})]})};function Yd({className:g}){const[b,x]=E.useState(!1),{t:d}=ql(),N=Ve.use.language(),j=Ve.use.setLanguage(),H=Ve.use.theme(),$=Ve.use.setTheme(),Y=E.useCallback(he=>{j(he)},[j]),W=E.useCallback(he=>{$(he)},[$]);return o.jsxs(Rg,{open:b,onOpenChange:x,children:[o.jsx(Ug,{asChild:!0,children:o.jsx(Cn,{variant:"ghost",size:"icon",className:Qe("h-9 w-9",g),children:o.jsx(_g,{className:"h-5 w-5"})})}),o.jsx(Hg,{side:"bottom",align:"end",className:"w-56",children:o.jsxs("div",{className:"flex flex-col gap-4",children:[o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("label",{className:"text-sm font-medium",children:d("settings.language")}),o.jsxs(kf,{value:N,onValueChange:Y,children:[o.jsx(Ff,{children:o.jsx($f,{})}),o.jsxs(Wf,{children:[o.jsx(ot,{value:"en",children:"English"}),o.jsx(ot,{value:"zh",children:"中文"}),o.jsx(ot,{value:"fr",children:"Français"}),o.jsx(ot,{value:"ar",children:"العربية"}),o.jsx(ot,{value:"zh_TW",children:"繁體中文"})]})]})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("label",{className:"text-sm font-medium",children:d("settings.theme")}),o.jsxs(kf,{value:H,onValueChange:W,children:[o.jsx(Ff,{children:o.jsx($f,{})}),o.jsxs(Wf,{children:[o.jsx(ot,{value:"light",children:d("settings.light")}),o.jsx(ot,{value:"dark",children:d("settings.dark")}),o.jsx(ot,{value:"system",children:d("settings.system")})]})]})]})]})})]})}const Np=xg,Xd=E.forwardRef(({className:g,...b},x)=>o.jsx(ud,{ref:x,className:Qe("bg-muted text-muted-foreground inline-flex h-10 items-center justify-center rounded-md p-1",g),...b}));Xd.displayName=ud.displayName;const Vd=E.forwardRef(({className:g,...b},x)=>o.jsx(id,{ref:x,className:Qe("ring-offset-background focus-visible:ring-ring data-[state=active]:bg-background data-[state=active]:text-foreground inline-flex items-center justify-center rounded-sm px-3 py-1.5 text-sm font-medium whitespace-nowrap transition-all focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm",g),...b}));Vd.displayName=id.displayName;const zn=E.forwardRef(({className:g,...b},x)=>o.jsx(cd,{ref:x,className:Qe("ring-offset-background focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none","data-[state=inactive]:invisible data-[state=active]:visible","h-full w-full",g),forceMount:!0,...b}));zn.displayName=cd.displayName;function Zu({value:g,currentTab:b,children:x}){return o.jsx(Vd,{value:g,className:Qe("cursor-pointer px-2 py-1 transition-all",b===g?"!bg-emerald-400 !text-zinc-50":"hover:bg-background/60"),children:x})}function Ep(){const g=Ve.use.currentTab(),{t:b}=ql();return o.jsx("div",{className:"flex h-8 self-center",children:o.jsxs(Xd,{className:"h-full gap-2",children:[o.jsx(Zu,{value:"documents",currentTab:g,children:b("header.documents")}),o.jsx(Zu,{value:"knowledge-graph",currentTab:g,children:b("header.knowledgeGraph")}),o.jsx(Zu,{value:"retrieval",currentTab:g,children:b("header.retrieval")}),o.jsx(Zu,{value:"api",currentTab:g,children:b("header.api")})]})})}function Mp(){const{t:g}=ql(),{isGuestMode:b,coreVersion:x,apiVersion:d,username:N,webuiTitle:j,webuiDescription:H}=Ll(),$=x&&d?`${x}/${d}`:null,Y=()=>{md.navigateToLogin()};return o.jsxs("header",{className:"border-border/40 bg-background/95 supports-[backdrop-filter]:bg-background/60 sticky top-0 z-50 flex h-10 w-full border-b px-4 backdrop-blur",children:[o.jsxs("div",{className:"min-w-[200px] w-auto flex items-center",children:[o.jsxs("a",{href:dd,className:"flex items-center gap-2",children:[o.jsx(ss,{className:"size-4 text-emerald-400","aria-hidden":"true"}),o.jsx("span",{className:"font-bold md:inline-block",children:is.name})]}),j&&o.jsxs("div",{className:"flex items-center",children:[o.jsx("span",{className:"mx-1 text-xs text-gray-500 dark:text-gray-400",children:"|"}),o.jsx(Lg,{children:o.jsxs(qg,{children:[o.jsx(Bg,{asChild:!0,children:o.jsx("span",{className:"font-medium text-sm cursor-default",children:j})}),H&&o.jsx(Gg,{side:"bottom",children:H})]})})]})]}),o.jsxs("div",{className:"flex h-10 flex-1 items-center justify-center",children:[o.jsx(Ep,{}),b&&o.jsx("div",{className:"ml-2 self-center px-2 py-1 text-xs bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200 rounded-md",children:g("login.guestMode","Guest Mode")})]}),o.jsx("nav",{className:"w-[200px] flex items-center justify-end",children:o.jsxs("div",{className:"flex items-center gap-2",children:[$&&o.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 mr-1",children:["v",$]}),o.jsx(Cn,{variant:"ghost",size:"icon",side:"bottom",tooltip:g("header.projectRepository"),children:o.jsx("a",{href:is.github,target:"_blank",rel:"noopener noreferrer",children:o.jsx(Yg,{className:"size-4","aria-hidden":"true"})})}),o.jsx(Yd,{}),!b&&o.jsx(Cn,{variant:"ghost",size:"icon",side:"bottom",tooltip:`${g("header.logout")} (${N})`,onClick:Y,children:o.jsx(Xg,{className:"size-4","aria-hidden":"true"})})]})})]})}const zp=()=>{const g=E.useContext(pd);if(!g)throw new Error("useTabVisibility must be used within a TabVisibilityProvider");return g};function Cp(){const{t:g}=ql(),{isTabVisible:b}=zp(),x=b("api"),[d,N]=E.useState(!1);return E.useEffect(()=>{d||N(!0)},[d]),o.jsx("div",{className:`size-full ${x?"":"hidden"}`,children:d?o.jsx("iframe",{src:Vg+"/docs",className:"size-full w-full h-full",style:{width:"100%",height:"100%",border:"none"}},"api-docs-iframe"):o.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background",children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"mb-2 h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),o.jsx("p",{children:g("apiSite.loading")})]})})})}function Op(){const g=Gt.use.message(),b=Ve.use.enableHealthCheck(),x=Ve.use.currentTab(),[d,N]=E.useState(!1),[j,H]=E.useState(!0),$=E.useRef(!1),Y=E.useRef(!1),W=E.useCallback(V=>{N(V),V||Gt.getState().clear()},[]),he=E.useRef(!0);E.useEffect(()=>{he.current=!0;const V=()=>{he.current=!1};return window.addEventListener("beforeunload",V),()=>{he.current=!1,window.removeEventListener("beforeunload",V)}},[]),E.useEffect(()=>{if(!b||d)return;const V=async()=>{try{he.current&&await Gt.getState().check()}catch(le){console.error("Health check error:",le)}};Y.current||(Y.current=!0,V());const pe=setInterval(V,Qg*1e3);return()=>clearInterval(pe)},[b,d]),E.useEffect(()=>{(async()=>{if($.current)return;if($.current=!0,sessionStorage.getItem("VERSION_CHECKED_FROM_LOGIN")==="true"){H(!1);return}try{H(!0);const le=localStorage.getItem("LIGHTRAG-API-TOKEN"),C=await gd();if(!C.auth_configured&&C.access_token)Ll.getState().login(C.access_token,!0,C.core_version,C.api_version,C.webui_title||null,C.webui_description||null);else if(le&&(C.core_version||C.api_version||C.webui_title||C.webui_description)){const pl=C.auth_mode==="disabled"||Ll.getState().isGuestMode;Ll.getState().login(le,pl,C.core_version,C.api_version,C.webui_title||null,C.webui_description||null)}sessionStorage.setItem("VERSION_CHECKED_FROM_LOGIN","true")}catch(le){console.error("Failed to get version info:",le)}finally{H(!1)}})()},[]);const ge=E.useCallback(V=>Ve.getState().setCurrentTab(V),[]);return E.useEffect(()=>{g&&(g.includes(rd)||g.includes(fd))&&N(!0)},[g]),o.jsx(hd,{children:o.jsx(up,{children:j?o.jsxs("div",{className:"flex h-screen w-screen flex-col",children:[o.jsxs("header",{className:"border-border/40 bg-background/95 supports-[backdrop-filter]:bg-background/60 sticky top-0 z-50 flex h-10 w-full border-b px-4 backdrop-blur",children:[o.jsx("div",{className:"min-w-[200px] w-auto flex items-center",children:o.jsxs("a",{href:dd,className:"flex items-center gap-2",children:[o.jsx(ss,{className:"size-4 text-emerald-400","aria-hidden":"true"}),o.jsx("span",{className:"font-bold md:inline-block",children:is.name})]})}),o.jsx("div",{className:"flex h-10 flex-1 items-center justify-center"}),o.jsx("nav",{className:"w-[200px] flex items-center justify-end"})]}),o.jsx("div",{className:"flex flex-1 items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"mb-2 h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),o.jsx("p",{children:"Initializing..."})]})})]}):o.jsxs("main",{className:"flex h-screen w-screen overflow-hidden",children:[o.jsxs(Np,{defaultValue:x,className:"!m-0 flex grow flex-col !p-0 overflow-hidden",onValueChange:ge,children:[o.jsx(Mp,{}),o.jsxs("div",{className:"relative grow",children:[o.jsx(zn,{value:"documents",className:"absolute top-0 right-0 bottom-0 left-0 overflow-auto",children:o.jsx(Pg,{})}),o.jsx(zn,{value:"knowledge-graph",className:"absolute top-0 right-0 bottom-0 left-0 overflow-hidden",children:o.jsx(wg,{})}),o.jsx(zn,{value:"retrieval",className:"absolute top-0 right-0 bottom-0 left-0 overflow-hidden",children:o.jsx(Wg,{})}),o.jsx(zn,{value:"api",className:"absolute top-0 right-0 bottom-0 left-0 overflow-hidden",children:o.jsx(Cp,{})})]})]}),b&&o.jsx(Dp,{}),o.jsx(Tp,{open:d,onOpenChange:W})]})})})}const jp=()=>{const g=sd(),{login:b,isAuthenticated:x}=Ll(),{t:d}=ql(),[N,j]=E.useState(!1),[H,$]=E.useState(""),[Y,W]=E.useState(""),[he,ge]=E.useState(!0),V=E.useRef(!1);if(E.useEffect(()=>{console.log("LoginPage mounted")},[]),E.useEffect(()=>((async()=>{if(!V.current){V.current=!0;try{if(x){g("/");return}const C=await gd();if((C.core_version||C.api_version)&&sessionStorage.setItem("VERSION_CHECKED_FROM_LOGIN","true"),!C.auth_configured&&C.access_token){b(C.access_token,!0,C.core_version,C.api_version,C.webui_title||null,C.webui_description||null),C.message&&En.info(C.message),g("/");return}ge(!1)}catch(C){console.error("Failed to check auth configuration:",C),ge(!1)}}})(),()=>{}),[x,b,g]),he)return null;const pe=async le=>{if(le.preventDefault(),!H||!Y){En.error(d("login.errorEmptyFields"));return}try{j(!0);const C=await kg(H,Y);localStorage.getItem("LIGHTRAG-PREVIOUS-USER")===H?console.log("Same user logging in, preserving chat history"):(console.log("Different user logging in, clearing chat history"),Ve.getState().setRetrievalHistory([])),localStorage.setItem("LIGHTRAG-PREVIOUS-USER",H);const je=C.auth_mode==="disabled";b(C.access_token,je,C.core_version,C.api_version,C.webui_title||null,C.webui_description||null),(C.core_version||C.api_version)&&sessionStorage.setItem("VERSION_CHECKED_FROM_LOGIN","true"),je?En.info(C.message||d("login.authDisabled","Authentication is disabled. Using guest access.")):En.success(d("login.successMessage")),g("/")}catch(C){console.error("Login failed...",C),En.error(d("login.errorInvalidCredentials")),Ll.getState().logout(),localStorage.removeItem("LIGHTRAG-API-TOKEN")}finally{j(!1)}};return o.jsxs("div",{className:"flex h-screen w-screen items-center justify-center bg-gradient-to-br from-emerald-50 to-teal-100 dark:from-gray-900 dark:to-gray-800",children:[o.jsx("div",{className:"absolute top-4 right-4 flex items-center gap-2",children:o.jsx(Yd,{className:"bg-white/30 dark:bg-gray-800/30 backdrop-blur-sm rounded-md"})}),o.jsxs(Zg,{className:"w-full max-w-[480px] shadow-lg mx-4",children:[o.jsx(Kg,{className:"flex items-center justify-center space-y-2 pb-8 pt-6",children:o.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("img",{src:"logo.png",alt:"LightRAG Logo",className:"h-12 w-12"}),o.jsx(ss,{className:"size-10 text-emerald-400","aria-hidden":"true"})]}),o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"LightRAG"}),o.jsx("p",{className:"text-muted-foreground text-sm",children:d("login.description")})]})]})}),o.jsx(Jg,{className:"px-8 pb-8",children:o.jsxs("form",{onSubmit:pe,className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("label",{htmlFor:"username-input",className:"text-sm font-medium w-16 shrink-0",children:d("login.username")}),o.jsx(us,{id:"username-input",placeholder:d("login.usernamePlaceholder"),value:H,onChange:le=>$(le.target.value),required:!0,className:"h-11 flex-1"})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("label",{htmlFor:"password-input",className:"text-sm font-medium w-16 shrink-0",children:d("login.password")}),o.jsx(us,{id:"password-input",type:"password",placeholder:d("login.passwordPlaceholder"),value:Y,onChange:le=>W(le.target.value),required:!0,className:"h-11 flex-1"})]}),o.jsx(Cn,{type:"submit",className:"w-full h-11 text-base font-medium mt-2",disabled:N,children:d(N?"login.loggingIn":"login.loginButton")})]})})]})]})},Rp=()=>{const[g,b]=E.useState(!0),{isAuthenticated:x}=Ll(),d=sd();return E.useEffect(()=>{md.setNavigate(d)},[d]),E.useEffect(()=>((async()=>{try{const j=localStorage.getItem("LIGHTRAG-API-TOKEN");if(j&&x){b(!1);return}j||Ll.getState().logout()}catch(j){console.error("Auth initialization error:",j),x||Ll.getState().logout()}finally{b(!1)}})(),()=>{}),[x]),E.useEffect(()=>{!g&&!x&&window.location.hash.slice(1)!=="/login"&&(console.log("Not authenticated, redirecting to login"),d("/login"))},[g,x,d]),g?null:o.jsxs(Eg,{children:[o.jsx(Jf,{path:"/login",element:o.jsx(jp,{})}),o.jsx(Jf,{path:"/*",element:x?o.jsx(Op,{}):null})]})},Up=()=>o.jsx(hd,{children:o.jsxs(Ng,{children:[o.jsx(Rp,{}),o.jsx(Fg,{position:"bottom-center",theme:"system",closeButton:!0,richColors:!0})]})}),_p={language:"Language",theme:"Theme",light:"Light",dark:"Dark",system:"System"},Hp={documents:"Documents",knowledgeGraph:"Knowledge Graph",retrieval:"Retrieval",api:"API",projectRepository:"Project Repository",logout:"Logout",themeToggle:{switchToLight:"Switch to light theme",switchToDark:"Switch to dark theme"}},Lp={description:"Please enter your account and password to log in to the system",username:"Username",usernamePlaceholder:"Please input a username",password:"Password",passwordPlaceholder:"Please input a password",loginButton:"Login",loggingIn:"Logging in...",successMessage:"Login succeeded",errorEmptyFields:"Please enter your username and password",errorInvalidCredentials:"Login failed, please check username and password",authDisabled:"Authentication is disabled. Using login free mode.",guestMode:"Login Free"},qp={cancel:"Cancel",save:"Save",saving:"Saving...",saveFailed:"Save failed"},Bp={clearDocuments:{button:"Clear",tooltip:"Clear documents",title:"Clear Documents",description:"This will remove all documents from the system",warning:"WARNING: This action will permanently delete all documents and cannot be undone!",confirm:"Do you really want to clear all documents?",confirmPrompt:"Type 'yes' to confirm this action",confirmPlaceholder:"Type yes to confirm",clearCache:"Clear LLM cache",confirmButton:"YES",success:"Documents cleared successfully",cacheCleared:"Cache cleared successfully",cacheClearFailed:`Failed to clear cache: +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return E.useEffect(()=>{var d;document.getElementById((d=g.current)==null?void 0:d.getAttribute("aria-describedby"))||console.warn(b)},[b,g]),null},gp=vd,pp=bd,Cd=Sd,Od=Td,jd=Ed,Rd=zd,Ud=Ad,_d=Nd;const yp=gp,vp=pp,Hd=E.forwardRef(({className:g,...b},x)=>o.jsx(Cd,{className:Qe("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",g),...b,ref:x}));Hd.displayName=Cd.displayName;const Ld=E.forwardRef(({className:g,...b},x)=>o.jsxs(vp,{children:[o.jsx(Hd,{}),o.jsx(Od,{ref:x,className:Qe("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-top-[48%] fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg",g),...b})]}));Ld.displayName=Od.displayName;const qd=({className:g,...b})=>o.jsx("div",{className:Qe("flex flex-col space-y-2 text-center sm:text-left",g),...b});qd.displayName="AlertDialogHeader";const Bd=E.forwardRef(({className:g,...b},x)=>o.jsx(Ud,{ref:x,className:Qe("text-lg font-semibold",g),...b}));Bd.displayName=Ud.displayName;const Gd=E.forwardRef(({className:g,...b},x)=>o.jsx(_d,{ref:x,className:Qe("text-muted-foreground text-sm",g),...b}));Gd.displayName=_d.displayName;const bp=E.forwardRef(({className:g,...b},x)=>o.jsx(jd,{ref:x,className:Qe(od(),g),...b}));bp.displayName=jd.displayName;const Sp=E.forwardRef(({className:g,...b},x)=>o.jsx(Rd,{ref:x,className:Qe(od({variant:"outline"}),"mt-2 sm:mt-0",g),...b}));Sp.displayName=Rd.displayName;const Tp=({open:g,onOpenChange:b})=>{const{t:x}=ql(),d=Ve.use.apiKey(),[N,j]=E.useState(""),H=Gt.use.message();E.useEffect(()=>{j(d||"")},[d,g]),E.useEffect(()=>{H&&(H.includes(rd)||H.includes(fd))&&b(!0)},[H,b]);const $=E.useCallback(()=>{Ve.setState({apiKey:N||null}),b(!1)},[N,b]),Y=E.useCallback(W=>{j(W.target.value)},[j]);return o.jsx(yp,{open:g,onOpenChange:b,children:o.jsxs(Ld,{children:[o.jsxs(qd,{children:[o.jsx(Bd,{children:x("apiKeyAlert.title")}),o.jsx(Gd,{children:x("apiKeyAlert.description")})]}),o.jsxs("div",{className:"flex flex-col gap-4",children:[o.jsxs("form",{className:"flex gap-2",onSubmit:W=>W.preventDefault(),children:[o.jsx(us,{type:"password",value:N,onChange:Y,placeholder:x("apiKeyAlert.placeholder"),className:"max-h-full w-full min-w-0",autoComplete:"off"}),o.jsx(Cn,{onClick:$,variant:"outline",size:"sm",children:x("apiKeyAlert.save")})]}),H&&o.jsx("div",{className:"text-sm text-red-500",children:H})]})]})})},xp=({status:g})=>{const{t:b}=ql();return g?o.jsxs("div",{className:"min-w-[300px] space-y-2 text-xs",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("h4",{className:"font-medium",children:b("graphPanel.statusCard.storageInfo")}),o.jsxs("div",{className:"text-foreground grid grid-cols-[120px_1fr] gap-1",children:[o.jsxs("span",{children:[b("graphPanel.statusCard.workingDirectory"),":"]}),o.jsx("span",{className:"truncate",children:g.working_directory}),o.jsxs("span",{children:[b("graphPanel.statusCard.inputDirectory"),":"]}),o.jsx("span",{className:"truncate",children:g.input_directory})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("h4",{className:"font-medium",children:b("graphPanel.statusCard.llmConfig")}),o.jsxs("div",{className:"text-foreground grid grid-cols-[120px_1fr] gap-1",children:[o.jsxs("span",{children:[b("graphPanel.statusCard.llmBinding"),":"]}),o.jsx("span",{children:g.configuration.llm_binding}),o.jsxs("span",{children:[b("graphPanel.statusCard.llmBindingHost"),":"]}),o.jsx("span",{children:g.configuration.llm_binding_host}),o.jsxs("span",{children:[b("graphPanel.statusCard.llmModel"),":"]}),o.jsx("span",{children:g.configuration.llm_model}),o.jsxs("span",{children:[b("graphPanel.statusCard.maxTokens"),":"]}),o.jsx("span",{children:g.configuration.max_tokens})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("h4",{className:"font-medium",children:b("graphPanel.statusCard.embeddingConfig")}),o.jsxs("div",{className:"text-foreground grid grid-cols-[120px_1fr] gap-1",children:[o.jsxs("span",{children:[b("graphPanel.statusCard.embeddingBinding"),":"]}),o.jsx("span",{children:g.configuration.embedding_binding}),o.jsxs("span",{children:[b("graphPanel.statusCard.embeddingBindingHost"),":"]}),o.jsx("span",{children:g.configuration.embedding_binding_host}),o.jsxs("span",{children:[b("graphPanel.statusCard.embeddingModel"),":"]}),o.jsx("span",{children:g.configuration.embedding_model})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("h4",{className:"font-medium",children:b("graphPanel.statusCard.storageConfig")}),o.jsxs("div",{className:"text-foreground grid grid-cols-[120px_1fr] gap-1",children:[o.jsxs("span",{children:[b("graphPanel.statusCard.kvStorage"),":"]}),o.jsx("span",{children:g.configuration.kv_storage}),o.jsxs("span",{children:[b("graphPanel.statusCard.docStatusStorage"),":"]}),o.jsx("span",{children:g.configuration.doc_status_storage}),o.jsxs("span",{children:[b("graphPanel.statusCard.graphStorage"),":"]}),o.jsx("span",{children:g.configuration.graph_storage}),o.jsxs("span",{children:[b("graphPanel.statusCard.vectorStorage"),":"]}),o.jsx("span",{children:g.configuration.vector_storage})]})]})]}):o.jsx("div",{className:"text-foreground text-xs",children:b("graphPanel.statusCard.unavailable")})},Ap=({open:g,onOpenChange:b,status:x})=>{const{t:d}=ql();return o.jsx(Mg,{open:g,onOpenChange:b,children:o.jsxs(zg,{className:"sm:max-w-[500px]",children:[o.jsxs(Cg,{children:[o.jsx(Og,{children:d("graphPanel.statusDialog.title")}),o.jsx(jg,{children:d("graphPanel.statusDialog.description")})]}),o.jsx(xp,{status:x})]})})},Dp=()=>{const{t:g}=ql(),b=Gt.use.health(),x=Gt.use.lastCheckTime(),d=Gt.use.status(),[N,j]=E.useState(!1),[H,$]=E.useState(!1);return E.useEffect(()=>{j(!0);const Y=setTimeout(()=>j(!1),300);return()=>clearTimeout(Y)},[x]),o.jsxs("div",{className:"fixed right-4 bottom-4 flex items-center gap-2 opacity-80 select-none",children:[o.jsxs("div",{className:"flex cursor-pointer items-center gap-2",onClick:()=>$(!0),children:[o.jsx("div",{className:Qe("h-3 w-3 rounded-full transition-all duration-300","shadow-[0_0_8px_rgba(0,0,0,0.2)]",b?"bg-green-500":"bg-red-500",N&&"scale-125",N&&b&&"shadow-[0_0_12px_rgba(34,197,94,0.4)]",N&&!b&&"shadow-[0_0_12px_rgba(239,68,68,0.4)]")}),o.jsx("span",{className:"text-muted-foreground text-xs",children:g(b?"graphPanel.statusIndicator.connected":"graphPanel.statusIndicator.disconnected")})]}),o.jsx(Ap,{open:H,onOpenChange:$,status:d})]})};function Yd({className:g}){const[b,x]=E.useState(!1),{t:d}=ql(),N=Ve.use.language(),j=Ve.use.setLanguage(),H=Ve.use.theme(),$=Ve.use.setTheme(),Y=E.useCallback(he=>{j(he)},[j]),W=E.useCallback(he=>{$(he)},[$]);return o.jsxs(Rg,{open:b,onOpenChange:x,children:[o.jsx(Ug,{asChild:!0,children:o.jsx(Cn,{variant:"ghost",size:"icon",className:Qe("h-9 w-9",g),children:o.jsx(_g,{className:"h-5 w-5"})})}),o.jsx(Hg,{side:"bottom",align:"end",className:"w-56",children:o.jsxs("div",{className:"flex flex-col gap-4",children:[o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("label",{className:"text-sm font-medium",children:d("settings.language")}),o.jsxs(kf,{value:N,onValueChange:Y,children:[o.jsx(Ff,{children:o.jsx($f,{})}),o.jsxs(Wf,{children:[o.jsx(ot,{value:"en",children:"English"}),o.jsx(ot,{value:"zh",children:"中文"}),o.jsx(ot,{value:"fr",children:"Français"}),o.jsx(ot,{value:"ar",children:"العربية"}),o.jsx(ot,{value:"zh_TW",children:"繁體中文"})]})]})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("label",{className:"text-sm font-medium",children:d("settings.theme")}),o.jsxs(kf,{value:H,onValueChange:W,children:[o.jsx(Ff,{children:o.jsx($f,{})}),o.jsxs(Wf,{children:[o.jsx(ot,{value:"light",children:d("settings.light")}),o.jsx(ot,{value:"dark",children:d("settings.dark")}),o.jsx(ot,{value:"system",children:d("settings.system")})]})]})]})]})})]})}const Np=xg,Xd=E.forwardRef(({className:g,...b},x)=>o.jsx(ud,{ref:x,className:Qe("bg-muted text-muted-foreground inline-flex h-10 items-center justify-center rounded-md p-1",g),...b}));Xd.displayName=ud.displayName;const Vd=E.forwardRef(({className:g,...b},x)=>o.jsx(id,{ref:x,className:Qe("ring-offset-background focus-visible:ring-ring data-[state=active]:bg-background data-[state=active]:text-foreground inline-flex items-center justify-center rounded-sm px-3 py-1.5 text-sm font-medium whitespace-nowrap transition-all focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm",g),...b}));Vd.displayName=id.displayName;const zn=E.forwardRef(({className:g,...b},x)=>o.jsx(cd,{ref:x,className:Qe("ring-offset-background focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none","data-[state=inactive]:invisible data-[state=active]:visible","h-full w-full",g),forceMount:!0,...b}));zn.displayName=cd.displayName;function Zu({value:g,currentTab:b,children:x}){return o.jsx(Vd,{value:g,className:Qe("cursor-pointer px-2 py-1 transition-all",b===g?"!bg-emerald-400 !text-zinc-50":"hover:bg-background/60"),children:x})}function Ep(){const g=Ve.use.currentTab(),{t:b}=ql();return o.jsx("div",{className:"flex h-8 self-center",children:o.jsxs(Xd,{className:"h-full gap-2",children:[o.jsx(Zu,{value:"documents",currentTab:g,children:b("header.documents")}),o.jsx(Zu,{value:"knowledge-graph",currentTab:g,children:b("header.knowledgeGraph")}),o.jsx(Zu,{value:"retrieval",currentTab:g,children:b("header.retrieval")}),o.jsx(Zu,{value:"api",currentTab:g,children:b("header.api")})]})})}function Mp(){const{t:g}=ql(),{isGuestMode:b,coreVersion:x,apiVersion:d,username:N,webuiTitle:j,webuiDescription:H}=Ll(),$=x&&d?`${x}/${d}`:null,Y=()=>{md.navigateToLogin()};return o.jsxs("header",{className:"border-border/40 bg-background/95 supports-[backdrop-filter]:bg-background/60 sticky top-0 z-50 flex h-10 w-full border-b px-4 backdrop-blur",children:[o.jsxs("div",{className:"min-w-[200px] w-auto flex items-center",children:[o.jsxs("a",{href:dd,className:"flex items-center gap-2",children:[o.jsx(ss,{className:"size-4 text-emerald-400","aria-hidden":"true"}),o.jsx("span",{className:"font-bold md:inline-block",children:is.name})]}),j&&o.jsxs("div",{className:"flex items-center",children:[o.jsx("span",{className:"mx-1 text-xs text-gray-500 dark:text-gray-400",children:"|"}),o.jsx(Lg,{children:o.jsxs(qg,{children:[o.jsx(Bg,{asChild:!0,children:o.jsx("span",{className:"font-medium text-sm cursor-default",children:j})}),H&&o.jsx(Gg,{side:"bottom",children:H})]})})]})]}),o.jsxs("div",{className:"flex h-10 flex-1 items-center justify-center",children:[o.jsx(Ep,{}),b&&o.jsx("div",{className:"ml-2 self-center px-2 py-1 text-xs bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200 rounded-md",children:g("login.guestMode","Guest Mode")})]}),o.jsx("nav",{className:"w-[200px] flex items-center justify-end",children:o.jsxs("div",{className:"flex items-center gap-2",children:[$&&o.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 mr-1",children:["v",$]}),o.jsx(Cn,{variant:"ghost",size:"icon",side:"bottom",tooltip:g("header.projectRepository"),children:o.jsx("a",{href:is.github,target:"_blank",rel:"noopener noreferrer",children:o.jsx(Yg,{className:"size-4","aria-hidden":"true"})})}),o.jsx(Yd,{}),!b&&o.jsx(Cn,{variant:"ghost",size:"icon",side:"bottom",tooltip:`${g("header.logout")} (${N})`,onClick:Y,children:o.jsx(Xg,{className:"size-4","aria-hidden":"true"})})]})})]})}const zp=()=>{const g=E.useContext(pd);if(!g)throw new Error("useTabVisibility must be used within a TabVisibilityProvider");return g};function Cp(){const{t:g}=ql(),{isTabVisible:b}=zp(),x=b("api"),[d,N]=E.useState(!1);return E.useEffect(()=>{d||N(!0)},[d]),o.jsx("div",{className:`size-full ${x?"":"hidden"}`,children:d?o.jsx("iframe",{src:Vg+"/docs",className:"size-full w-full h-full",style:{width:"100%",height:"100%",border:"none"}},"api-docs-iframe"):o.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background",children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"mb-2 h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),o.jsx("p",{children:g("apiSite.loading")})]})})})}function Op(){const g=Gt.use.message(),b=Ve.use.enableHealthCheck(),x=Ve.use.currentTab(),[d,N]=E.useState(!1),[j,H]=E.useState(!0),$=E.useRef(!1),Y=E.useRef(!1),W=E.useCallback(V=>{N(V),V||Gt.getState().clear()},[]),he=E.useRef(!0);E.useEffect(()=>{he.current=!0;const V=()=>{he.current=!1};return window.addEventListener("beforeunload",V),()=>{he.current=!1,window.removeEventListener("beforeunload",V)}},[]),E.useEffect(()=>{if(!b||d)return;const V=async()=>{try{he.current&&await Gt.getState().check()}catch(le){console.error("Health check error:",le)}};Y.current||(Y.current=!0,V());const pe=setInterval(V,Qg*1e3);return()=>clearInterval(pe)},[b,d]),E.useEffect(()=>{(async()=>{if($.current)return;if($.current=!0,sessionStorage.getItem("VERSION_CHECKED_FROM_LOGIN")==="true"){H(!1);return}try{H(!0);const le=localStorage.getItem("LIGHTRAG-API-TOKEN"),C=await gd();if(!C.auth_configured&&C.access_token)Ll.getState().login(C.access_token,!0,C.core_version,C.api_version,C.webui_title||null,C.webui_description||null);else if(le&&(C.core_version||C.api_version||C.webui_title||C.webui_description)){const pl=C.auth_mode==="disabled"||Ll.getState().isGuestMode;Ll.getState().login(le,pl,C.core_version,C.api_version,C.webui_title||null,C.webui_description||null)}sessionStorage.setItem("VERSION_CHECKED_FROM_LOGIN","true")}catch(le){console.error("Failed to get version info:",le)}finally{H(!1)}})()},[]);const ge=E.useCallback(V=>Ve.getState().setCurrentTab(V),[]);return E.useEffect(()=>{g&&(g.includes(rd)||g.includes(fd))&&N(!0)},[g]),o.jsx(hd,{children:o.jsx(up,{children:j?o.jsxs("div",{className:"flex h-screen w-screen flex-col",children:[o.jsxs("header",{className:"border-border/40 bg-background/95 supports-[backdrop-filter]:bg-background/60 sticky top-0 z-50 flex h-10 w-full border-b px-4 backdrop-blur",children:[o.jsx("div",{className:"min-w-[200px] w-auto flex items-center",children:o.jsxs("a",{href:dd,className:"flex items-center gap-2",children:[o.jsx(ss,{className:"size-4 text-emerald-400","aria-hidden":"true"}),o.jsx("span",{className:"font-bold md:inline-block",children:is.name})]})}),o.jsx("div",{className:"flex h-10 flex-1 items-center justify-center"}),o.jsx("nav",{className:"w-[200px] flex items-center justify-end"})]}),o.jsx("div",{className:"flex flex-1 items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"mb-2 h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),o.jsx("p",{children:"Initializing..."})]})})]}):o.jsxs("main",{className:"flex h-screen w-screen overflow-hidden",children:[o.jsxs(Np,{defaultValue:x,className:"!m-0 flex grow flex-col !p-0 overflow-hidden",onValueChange:ge,children:[o.jsx(Mp,{}),o.jsxs("div",{className:"relative grow",children:[o.jsx(zn,{value:"documents",className:"absolute top-0 right-0 bottom-0 left-0 overflow-auto",children:o.jsx(Pg,{})}),o.jsx(zn,{value:"knowledge-graph",className:"absolute top-0 right-0 bottom-0 left-0 overflow-hidden",children:o.jsx(wg,{})}),o.jsx(zn,{value:"retrieval",className:"absolute top-0 right-0 bottom-0 left-0 overflow-hidden",children:o.jsx(Wg,{})}),o.jsx(zn,{value:"api",className:"absolute top-0 right-0 bottom-0 left-0 overflow-hidden",children:o.jsx(Cp,{})})]})]}),b&&o.jsx(Dp,{}),o.jsx(Tp,{open:d,onOpenChange:W})]})})})}const jp=()=>{const g=sd(),{login:b,isAuthenticated:x}=Ll(),{t:d}=ql(),[N,j]=E.useState(!1),[H,$]=E.useState(""),[Y,W]=E.useState(""),[he,ge]=E.useState(!0),V=E.useRef(!1);if(E.useEffect(()=>{console.log("LoginPage mounted")},[]),E.useEffect(()=>((async()=>{if(!V.current){V.current=!0;try{if(x){g("/");return}const C=await gd();if((C.core_version||C.api_version)&&sessionStorage.setItem("VERSION_CHECKED_FROM_LOGIN","true"),!C.auth_configured&&C.access_token){b(C.access_token,!0,C.core_version,C.api_version,C.webui_title||null,C.webui_description||null),C.message&&En.info(C.message),g("/");return}ge(!1)}catch(C){console.error("Failed to check auth configuration:",C),ge(!1)}}})(),()=>{}),[x,b,g]),he)return null;const pe=async le=>{if(le.preventDefault(),!H||!Y){En.error(d("login.errorEmptyFields"));return}try{j(!0);const C=await kg(H,Y);localStorage.getItem("LIGHTRAG-PREVIOUS-USER")===H?console.log("Same user logging in, preserving chat history"):(console.log("Different user logging in, clearing chat history"),Ve.getState().setRetrievalHistory([])),localStorage.setItem("LIGHTRAG-PREVIOUS-USER",H);const je=C.auth_mode==="disabled";b(C.access_token,je,C.core_version,C.api_version,C.webui_title||null,C.webui_description||null),(C.core_version||C.api_version)&&sessionStorage.setItem("VERSION_CHECKED_FROM_LOGIN","true"),je?En.info(C.message||d("login.authDisabled","Authentication is disabled. Using guest access.")):En.success(d("login.successMessage")),g("/")}catch(C){console.error("Login failed...",C),En.error(d("login.errorInvalidCredentials")),Ll.getState().logout(),localStorage.removeItem("LIGHTRAG-API-TOKEN")}finally{j(!1)}};return o.jsxs("div",{className:"flex h-screen w-screen items-center justify-center bg-gradient-to-br from-emerald-50 to-teal-100 dark:from-gray-900 dark:to-gray-800",children:[o.jsx("div",{className:"absolute top-4 right-4 flex items-center gap-2",children:o.jsx(Yd,{className:"bg-white/30 dark:bg-gray-800/30 backdrop-blur-sm rounded-md"})}),o.jsxs(Zg,{className:"w-full max-w-[480px] shadow-lg mx-4",children:[o.jsx(Kg,{className:"flex items-center justify-center space-y-2 pb-8 pt-6",children:o.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("img",{src:"logo.svg",alt:"LightRAG Logo",className:"h-12 w-12"}),o.jsx(ss,{className:"size-10 text-emerald-400","aria-hidden":"true"})]}),o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"LightRAG"}),o.jsx("p",{className:"text-muted-foreground text-sm",children:d("login.description")})]})]})}),o.jsx(Jg,{className:"px-8 pb-8",children:o.jsxs("form",{onSubmit:pe,className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("label",{htmlFor:"username-input",className:"text-sm font-medium w-16 shrink-0",children:d("login.username")}),o.jsx(us,{id:"username-input",placeholder:d("login.usernamePlaceholder"),value:H,onChange:le=>$(le.target.value),required:!0,className:"h-11 flex-1"})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("label",{htmlFor:"password-input",className:"text-sm font-medium w-16 shrink-0",children:d("login.password")}),o.jsx(us,{id:"password-input",type:"password",placeholder:d("login.passwordPlaceholder"),value:Y,onChange:le=>W(le.target.value),required:!0,className:"h-11 flex-1"})]}),o.jsx(Cn,{type:"submit",className:"w-full h-11 text-base font-medium mt-2",disabled:N,children:d(N?"login.loggingIn":"login.loginButton")})]})})]})]})},Rp=()=>{const[g,b]=E.useState(!0),{isAuthenticated:x}=Ll(),d=sd();return E.useEffect(()=>{md.setNavigate(d)},[d]),E.useEffect(()=>((async()=>{try{const j=localStorage.getItem("LIGHTRAG-API-TOKEN");if(j&&x){b(!1);return}j||Ll.getState().logout()}catch(j){console.error("Auth initialization error:",j),x||Ll.getState().logout()}finally{b(!1)}})(),()=>{}),[x]),E.useEffect(()=>{!g&&!x&&window.location.hash.slice(1)!=="/login"&&(console.log("Not authenticated, redirecting to login"),d("/login"))},[g,x,d]),g?null:o.jsxs(Eg,{children:[o.jsx(Jf,{path:"/login",element:o.jsx(jp,{})}),o.jsx(Jf,{path:"/*",element:x?o.jsx(Op,{}):null})]})},Up=()=>o.jsx(hd,{children:o.jsxs(Ng,{children:[o.jsx(Rp,{}),o.jsx(Fg,{position:"bottom-center",theme:"system",closeButton:!0,richColors:!0})]})}),_p={language:"Language",theme:"Theme",light:"Light",dark:"Dark",system:"System"},Hp={documents:"Documents",knowledgeGraph:"Knowledge Graph",retrieval:"Retrieval",api:"API",projectRepository:"Project Repository",logout:"Logout",themeToggle:{switchToLight:"Switch to light theme",switchToDark:"Switch to dark theme"}},Lp={description:"Please enter your account and password to log in to the system",username:"Username",usernamePlaceholder:"Please input a username",password:"Password",passwordPlaceholder:"Please input a password",loginButton:"Login",loggingIn:"Logging in...",successMessage:"Login succeeded",errorEmptyFields:"Please enter your username and password",errorInvalidCredentials:"Login failed, please check username and password",authDisabled:"Authentication is disabled. Using login free mode.",guestMode:"Login Free"},qp={cancel:"Cancel",save:"Save",saving:"Saving...",saveFailed:"Save failed"},Bp={clearDocuments:{button:"Clear",tooltip:"Clear documents",title:"Clear Documents",description:"This will remove all documents from the system",warning:"WARNING: This action will permanently delete all documents and cannot be undone!",confirm:"Do you really want to clear all documents?",confirmPrompt:"Type 'yes' to confirm this action",confirmPlaceholder:"Type yes to confirm",clearCache:"Clear LLM cache",confirmButton:"YES",success:"Documents cleared successfully",cacheCleared:"Cache cleared successfully",cacheClearFailed:`Failed to clear cache: {{error}}`,failed:`Clear Documents Failed: {{message}}`,error:`Clear Documents Failed: {{error}}`},uploadDocuments:{button:"Upload",tooltip:"Upload documents",title:"Upload Documents",description:"Drag and drop your documents here or click to browse.",single:{uploading:"Uploading {{name}}: {{percent}}%",success:`Upload Success: diff --git a/lightrag/api/webui/index.html b/lightrag/api/webui/index.html index 7c8a0936..9738d10d 100644 --- a/lightrag/api/webui/index.html +++ b/lightrag/api/webui/index.html @@ -5,10 +5,10 @@ - + Lightrag - + diff --git a/lightrag/api/webui/logo.png b/lightrag/api/webui/logo.png deleted file mode 100644 index 1d2d3a42..00000000 Binary files a/lightrag/api/webui/logo.png and /dev/null differ diff --git a/lightrag/api/webui/logo.svg b/lightrag/api/webui/logo.svg new file mode 100755 index 00000000..a78a1717 --- /dev/null +++ b/lightrag/api/webui/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/lightrag_webui/index.html b/lightrag_webui/index.html index 3dd1ebbc..6eb226fa 100644 --- a/lightrag_webui/index.html +++ b/lightrag_webui/index.html @@ -5,7 +5,7 @@ - + Lightrag diff --git a/lightrag_webui/public/logo.png b/lightrag_webui/public/logo.png deleted file mode 100644 index e7afaa7e..00000000 Binary files a/lightrag_webui/public/logo.png and /dev/null differ diff --git a/lightrag_webui/public/logo.svg b/lightrag_webui/public/logo.svg new file mode 100755 index 00000000..a78a1717 --- /dev/null +++ b/lightrag_webui/public/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/lightrag_webui/src/features/LoginPage.tsx b/lightrag_webui/src/features/LoginPage.tsx index bc08d8f8..9f5f68e4 100644 --- a/lightrag_webui/src/features/LoginPage.tsx +++ b/lightrag_webui/src/features/LoginPage.tsx @@ -153,7 +153,7 @@ const LoginPage = () => {
- LightRAG Logo + LightRAG Logo
diff --git a/lightrag_webui/src/features/SiteHeader.tsx b/lightrag_webui/src/features/SiteHeader.tsx index 4881e4b6..e0186b6a 100644 --- a/lightrag_webui/src/features/SiteHeader.tsx +++ b/lightrag_webui/src/features/SiteHeader.tsx @@ -71,7 +71,6 @@ export default function SiteHeader() {
{webuiTitle && (