diff --git a/CHANGELOG.md b/CHANGELOG.md index ed3066af09..5cdf2a62d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ All notable changes to this project will be documented in this file. ## Fixed - Check error logs coming from Ollama and send it to the frontend +- Check If Chunks Are NoneType ## [1.0.2] diff --git a/frontend/app/components/Chat/ChatInterface.tsx b/frontend/app/components/Chat/ChatInterface.tsx index c577c409d1..33ec12c588 100644 --- a/frontend/app/components/Chat/ChatInterface.tsx +++ b/frontend/app/components/Chat/ChatInterface.tsx @@ -344,8 +344,9 @@ const ChatInterfaceComponent: React.FC = ({ if (data) { if (data.error !== "") { triggerNotification(data.error, true); - setIsFetching(false); + isFetching.current = false; setFetchingStatus("DONE"); + return; } setChunks(data.chunks); diff --git a/goldenverba/components/interfaces.py b/goldenverba/components/interfaces.py index 8fa9958c15..e0bedb9743 100644 --- a/goldenverba/components/interfaces.py +++ b/goldenverba/components/interfaces.py @@ -154,15 +154,6 @@ def embed( """ raise NotImplementedError("embed method must be implemented by a subclass.") - def check_embedder_pre_requirements(self) -> tuple[bool, list]: - """Check if the embedder has all the necessary pre-requirements. - @returns tuple[bool, list] - Bool whether the embedding was successful and list of missing requirements. - """ - missing_env_vars = [var for var in self.requires_env if not os.getenv(var)] - if missing_env_vars: - return False, [f"Environment:{var}" for var in missing_env_vars] - return True, [] - def import_data( self, documents: list[Document], client: Client, logging: list[dict] ) -> bool: diff --git a/goldenverba/components/managers.py b/goldenverba/components/managers.py index fcd90605b5..e212669271 100644 --- a/goldenverba/components/managers.py +++ b/goldenverba/components/managers.py @@ -177,7 +177,7 @@ def __init__(self): "CohereEmbedder": CohereEmbedder(), "OllamaEmbedder": OllamaEmbedder(), } - self.set_embedder("ADAEmbedder") + self.selected_embedder: str = "TokenChunker" def embed( diff --git a/goldenverba/server/frontend/out/404.html b/goldenverba/server/frontend/out/404.html index 659074cb0a..957fe97274 100644 --- a/goldenverba/server/frontend/out/404.html +++ b/goldenverba/server/frontend/out/404.html @@ -1,2 +1 @@ -404: This page could not be found.Verba

404

This page could not be found.

- +404: This page could not be found.Verba

404

This page could not be found.

\ No newline at end of file diff --git a/goldenverba/server/frontend/out/_next/static/chunks/app/page-d7176c87f5190890.js b/goldenverba/server/frontend/out/_next/static/chunks/app/page-d7176c87f5190890.js new file mode 100644 index 0000000000..c17d862e75 --- /dev/null +++ b/goldenverba/server/frontend/out/_next/static/chunks/app/page-d7176c87f5190890.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{87094:function(e,t,s){Promise.resolve().then(s.bind(s,14923))},14923:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return em}});var l=s(57437),o=s(2265),n=s(58177),r=s(30505),a=s(8603),i=s(14063),c=s(97223),d=e=>{let{Icon:t,iconSize:s,title:o,currentPage:n,setPage:r,setCurrentPage:a,APIHost:i,hide:c}=e;return(0,l.jsxs)("button",{disabled:null===i,className:"btn md:btn-sm lg:btn-md ".concat(c?"hidden":"flex"," flex-grow items-center justify-center border-none hover:bg-button-hover-verba ").concat(n===r?"bg-primary-verba text-text-verba":"bg-button-verba text-text-alt-verba"),onClick:e=>{a(r)},children:[(0,l.jsx)(t,{size:s}),(0,l.jsx)("p",{className:"md:text-xs lg:text-sm sm:hidden md:flex",children:o})]},o)};async function x(){try{let e=await fetch("https://api.github.com/repos/weaviate/verba",{method:"GET"}),t=await e.json();if(t)return t.stargazers_count;return 0}catch(e){return console.error("Failed to perform search:",e),0}}let g=e=>e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"k":e.toString();var m=e=>{let{imageSrc:t,title:s,subtitle:m,APIHost:u,version:h,currentPage:b,setCurrentPage:p,production:f}=e,[v,j]=(0,o.useState)("0");(0,o.useEffect)(()=>{(async()=>{try{let e=await x();if(e){let t=g(e);j(t)}}catch(e){console.error("Failed to fetch GitHub stars:",e)}})()},[]);let y=()=>{window.open("https://github.com/weaviate/verba","_blank","noopener,noreferrer")};return(0,l.jsxs)("div",{className:"flex justify-between items-center mb-10",children:[(0,l.jsxs)("div",{className:"flex flex-row items-center gap-5",children:[(0,l.jsx)("img",{src:t,width:80,className:"flex"}),(0,l.jsxs)("div",{className:"flex flex-col lg:flex-row lg:items-end justify-center lg:gap-3",children:[(0,l.jsx)("p",{className:"sm:text-2xl md:text-3xl text-text-verba",children:s}),(0,l.jsx)("p",{className:"sm:text-sm text-base text-text-alt-verba font-light",children:m})]})]}),(0,l.jsxs)("div",{className:"flex flex-row justify-center items-center",children:[(0,l.jsx)("div",{className:"hidden sm:h-[3vh] lg:h-[5vh] bg-text-alt-verba w-px sm:mx-2 md:mx-4"}),(0,l.jsxs)("div",{className:"lg:flex hidden lg:flex-row items-center lg:gap-3 justify-between",children:[(0,l.jsx)("div",{className:" ".concat(f?"h-[0vh]":"sm:h-[3vh] lg:h-[5vh] mx-1"," hidden sm:block bg-text-alt-verba w-px")}),(0,l.jsx)(d,{hide:!1,APIHost:u,Icon:n.utr,iconSize:18,title:"Chat",currentPage:b,setCurrentPage:p,setPage:"CHAT"}),(0,l.jsx)(d,{hide:!1,APIHost:u,Icon:n.emU,iconSize:18,title:"Documents",currentPage:b,setCurrentPage:p,setPage:"DOCUMENTS"}),(0,l.jsx)(d,{hide:f,APIHost:u,Icon:r.lLR,iconSize:18,title:"Overview",currentPage:b,setCurrentPage:p,setPage:"STATUS"}),(0,l.jsx)("div",{className:" ".concat(f?"h-[0vh]":"sm:h-[3vh] lg:h-[5vh] mx-1"," hidden sm:block bg-text-alt-verba w-px")}),(0,l.jsx)(d,{hide:f,APIHost:u,Icon:a.Lgw,iconSize:18,title:"Add Documents",currentPage:b,setCurrentPage:p,setPage:"ADD"}),(0,l.jsx)(d,{hide:f,APIHost:u,Icon:n.LTV,iconSize:18,title:"RAG",currentPage:b,setCurrentPage:p,setPage:"RAG"}),(0,l.jsx)(d,{hide:f,APIHost:u,Icon:n.zfW,iconSize:18,title:"Settings",currentPage:b,setCurrentPage:p,setPage:"SETTINGS"}),(0,l.jsx)("div",{className:"sm:h-[3vh] lg:h-[5vh] mx-1 hidden sm:block bg-text-alt-verba w-px"}),(0,l.jsxs)("button",{className:"md:hidden btn md:btn-sm lg:btn-md lg:flex items-center justify-center border-none bg-secondary-verba hover:bg-button-hover-verba",onClick:y,children:[(0,l.jsx)(i.hJX,{size:18,className:"text-text-verba"}),(0,l.jsx)("p",{className:"text-xs sm:hidden md:flex text-text-verba ",children:v})]}),(0,l.jsx)("p",{className:"hidden lg:flex text-xs text-text-alt-verba",children:h})]}),(0,l.jsx)("div",{className:"flex flex-row items-center sm:gap-1 lg:gap-5 justify-between",children:(0,l.jsx)("div",{className:"lg:hidden sm:flex md:ml-4 sm:mr-8",children:(0,l.jsx)("ul",{className:"menu md:menu-md sm:menu-sm sm:menu-horizontal bg-base-200 rounded-box bg-bg-alt-verba z-50",children:(0,l.jsx)("li",{children:(0,l.jsxs)("details",{children:[(0,l.jsx)("summary",{children:(0,l.jsx)(c.bqP,{size:20})}),(0,l.jsxs)("ul",{className:"bg-bg-alt-verba",children:[(0,l.jsx)("li",{onClick:e=>{p("CHAT")},children:(0,l.jsx)("a",{children:"Chat"})}),(0,l.jsx)("li",{onClick:e=>{p("DOCUMENTS")},children:(0,l.jsx)("a",{children:"Documents"})}),!f&&(0,l.jsx)("li",{onClick:e=>{p("STATUS")},children:(0,l.jsx)("a",{children:"Status"})}),!f&&(0,l.jsx)("li",{onClick:e=>{p("ADD")},children:(0,l.jsx)("a",{children:"Add Documents"})}),!f&&(0,l.jsx)("li",{onClick:e=>{p("RAG")},children:(0,l.jsx)("a",{children:"RAG"})}),!f&&(0,l.jsx)("li",{onClick:e=>{p("SETTINGS")},children:(0,l.jsx)("a",{children:"Settings"})}),(0,l.jsx)("li",{onClick:y,children:(0,l.jsx)("a",{children:"GitHub"})}),(0,l.jsx)("li",{className:"items-center justify-center text-xs text-text-alt-verba mt-2",children:h})]})]})})})})})]})]})};let u=["Inter","Plus_Jakarta_Sans","Open_Sans","PT_Mono"],h={value:"Plus_Jakarta_Sans",type:"select",options:u,description:"Text Font"},b={title:"Chat Settings",description:"Customize chat settings like caching generated answers in Weaviate or let Weaviate give you autocomplete suggestions.",settings:{caching:{checked:!0,type:"check",description:"Enable Caching"},suggestion:{checked:!0,type:"check",description:"Enable Autocompletion"},info_button:{checked:!0,type:"check",description:"Enable Help Information"},max_document_size:{value:1e4,type:"number",description:"Max characters to show Documents"}}},p={Default:{Customization:{title:"Customization",description:"Customize the layout of your Verba by changing the title, subtitle, logo, and colors of the app.",settings:{title:{text:"Verba",type:"text",description:"Title of the Page"},subtitle:{text:"The Golden RAGtriever",type:"text",description:"Subtitle of the Page"},intro_message:{text:"Welcome to Verba, your open-source RAG application!",type:"text",description:"Intro Message"},placeholder_message:{text:"Ask Verba anything!",type:"text",description:"Input Placeholder"},image:{src:"https://github.com/weaviate/Verba/blob/main/img/verba_icon.png?raw=true",type:"image",description:"Logo of the Page"},primary_color:{color:"#FDFF91",type:"color",description:"Primary Color"},secondary_color:{color:"#90FFA8",type:"color",description:"Secondary Color"},warning_color:{color:"#FF8399",type:"color",description:"Accent Color"},bg_color:{color:"#FEF7F7",type:"color",description:"Background Color"},bg_alt_color:{color:"#FFFFFF",type:"color",description:"Alternative Background Color"},text_color:{color:"#161616",type:"color",description:"Text Color"},text_alt_color:{color:"#8E8E8E",type:"color",description:"Alternative Text Color"},button_color:{color:"#EFEFEF",type:"color",description:"Button Color"},button_hover_color:{color:"#DCDCDC",type:"color",description:"Button Hover Color"},bg_console:{color:"#3F3E40",type:"color",description:"Console Background"},text_console:{color:"#FFFFFF",type:"color",description:"Console Text"},font:h,theme:"light"}},Chat:b},DarkMode:{Customization:{title:"Customization",description:"Customize the layout of your Verba by changing the title, subtitle, logo, and colors of the app.",settings:{title:{text:"Verba",type:"text",description:"Title of the Page"},subtitle:{text:"The Dark RAGtriever",type:"text",description:"Subtitle of the Page"},intro_message:{text:"Welcome to the dark mode version of Verba! Spooky, right?",type:"text",description:"Intro Message"},placeholder_message:{text:"Ask anything!",type:"text",description:"Input Placeholder"},image:{src:"https://github.com/weaviate/Verba/blob/main/img/verba_icon.png?raw=true",type:"image",description:"Logo of the Page"},primary_color:{color:"#BB86FC",type:"color",description:"Primary Color"},secondary_color:{color:"#008F82",type:"color",description:"Secondary Color"},warning_color:{color:"#FF8399",type:"color",description:"Accent Color"},bg_color:{color:"#202020",type:"color",description:"Background Color"},bg_alt_color:{color:"#2F2929",type:"color",description:"Alternative Background Color"},text_color:{color:"#ffffff",type:"color",description:"Text Color"},text_alt_color:{color:"#999999",type:"color",description:"Alternative Text Color"},button_color:{color:"#3C3C3C",type:"color",description:"Button Color"},button_hover_color:{color:"#2C2C2C",type:"color",description:"Button Hover Color"},bg_console:{color:"#2F2929",type:"color",description:"Console Background"},text_console:{color:"#FFFFFF",type:"color",description:"Console Text"},font:{value:"Open_Sans",type:"select",options:u,description:"Text Font"},theme:"dark"}},Chat:b},Weaviate:{Customization:{title:"Customization",description:"Customize the layout of your Verba by changing the title, subtitle, logo, and colors of the app.",settings:{title:{text:"Weaviate Verba",type:"text",description:"Title of the Page"},subtitle:{text:"Chatbot for Weaviate",type:"text",description:"Subtitle of the Page"},intro_message:{text:"Welcome to Weaviate, your AI-Native vector database. How can I help you with Weaviate today?",type:"text",description:"Intro Message"},placeholder_message:{text:"Ask all questions related to Weaviate",type:"text",description:"Input Placeholder"},image:{src:"https://github.com/weaviate/Verba/blob/1.0.0/frontend/public/weaviate.png?raw=true",type:"image",description:"Logo of the Page"},primary_color:{color:"#6BDF4A",type:"color",description:"Primary Color"},secondary_color:{color:"#7AD6EB",type:"color",description:"Secondary Color"},warning_color:{color:"#F4404E",type:"color",description:"Accent Color"},bg_color:{color:"#EDEDED",type:"color",description:"Background Color"},bg_alt_color:{color:"#ffffff",type:"color",description:"Alternative Background Color"},text_color:{color:"#130C49",type:"color",description:"Text Color"},text_alt_color:{color:"#8196A6",type:"color",description:"Alternative Text Color"},button_color:{color:"#E6E3E3",type:"color",description:"Button Color"},button_hover_color:{color:"#FFFFFF",type:"color",description:"Button Hover Color"},bg_console:{color:"#3F3E40",type:"color",description:"Console Background"},text_console:{color:"#FFFFFF",type:"color",description:"Console Text"},font:{value:"Inter",type:"select",options:u,description:"Text Font"},theme:"light"}},Chat:b},SanaMaxima:{Customization:{title:"Customization",description:"Customize the layout of your Verba by changing the title, subtitle, logo, and colors of the app.",settings:{title:{text:"Prinses Maxima Centrum",type:"text",description:"Title of the Page"},subtitle:{text:"Medical RAG",type:"text",description:"Subtitle of the Page"},intro_message:{text:"Welcome to Medical Retrieval Augmented Generation! We ingested medical data, like clinical reports, research and more to improve access to healthcare. Try it out by asking questions related to diseases, symptoms and medical conditions.",type:"text",description:"Intro Message"},placeholder_message:{text:"Ask a medical question",type:"text",description:"Input Placeholder"},image:{src:"https://www.prinsesmaximacentrum.nl/img/logo/prinses-maxima-centrum-logo-en.svg",type:"image",description:"Logo of the Page"},primary_color:{color:"#FF963F",type:"color",description:"Primary Color"},secondary_color:{color:"#53E797",type:"color",description:"Secondary Color"},warning_color:{color:"#F11F78",type:"color",description:"Accent Color"},bg_color:{color:"#F1F1F1",type:"color",description:"Background Color"},bg_alt_color:{color:"#FFFFFF",type:"color",description:"Alternative Background Color"},text_color:{color:"#000F1D",type:"color",description:"Text Color"},text_alt_color:{color:"#818181",type:"color",description:"Alternative Text Color"},button_color:{color:"#E4E4E4",type:"color",description:"Button Color"},button_hover_color:{color:"#CCCCCC",type:"color",description:"Button Hover Color"},bg_console:{color:"#3F3E40",type:"color",description:"Console Background"},text_console:{color:"#FFFFFF",type:"color",description:"Console Text"},font:{value:"Open_Sans",type:"select",options:u,description:"Text Font"},theme:"light"}},Chat:b},Custom:{Customization:{title:"Customization",description:"Customize the layout of your Verba by changing the title, subtitle, logo, and colors of the app.",settings:{title:{text:"My RAG",type:"text",description:"Title of the Page"},subtitle:{text:"Powered by Weaviate",type:"text",description:"Subtitle of the Page"},intro_message:{text:"Welcome to Verba, your open-source RAG application!",type:"text",description:"Intro Message"},placeholder_message:{text:"Ask Verba anything!",type:"text",description:"Input Placeholder"},image:{src:"https://github.com/weaviate/Verba/blob/main/img/verba_icon.png?raw=true",type:"image",description:"Logo of the Page"},primary_color:{color:"#FDFF91",type:"color",description:"Primary Color"},secondary_color:{color:"#90FFA8",type:"color",description:"Secondary Color"},warning_color:{color:"#FF8399",type:"color",description:"Accent Color"},bg_color:{color:"#FEF7F7",type:"color",description:"Background Color"},bg_alt_color:{color:"#FFFFFF",type:"color",description:"Alternative Background Color"},text_color:{color:"#161616",type:"color",description:"Text Color"},text_alt_color:{color:"#8E8E8E",type:"color",description:"Alternative Text Color"},button_color:{color:"#EFEFEF",type:"color",description:"Button Color"},button_hover_color:{color:"#DCDCDC",type:"color",description:"Button Hover Color"},bg_console:{color:"#3F3E40",type:"color",description:"Console Background"},text_console:{color:"#FFFFFF",type:"color",description:"Console Text"},font:h,theme:"light"}},Chat:b}};var f=s(65125),v=e=>{let{title:t,TextFieldSetting:s,setting:o,settingsConfig:n,setSettingsConfig:r}=e;return(0,l.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,l.jsx)("div",{className:"flex items-center justify-center",children:(0,l.jsx)("p",{children:s.description})}),(0,l.jsx)("div",{className:"flex items-center justify-center",children:(0,l.jsx)("label",{className:"input input-bordered flex items-center gap-2 w-full bg-bg-verba",children:(0,l.jsx)("input",{type:"text",className:"grow",placeholder:t,value:n[o].settings[t].text,onChange:e=>{let s=e.target.value;r(e=>{let l=JSON.parse(JSON.stringify(e));return l[o].settings[t].text=s,l})}})})})]},t)},j=e=>{let{title:t,ImageFieldSetting:s,setting:o,settingsConfig:n,setSettingsConfig:r}=e;return(0,l.jsxs)("div",{className:"flex flex-col justify-center gap-1",children:[(0,l.jsx)("div",{className:"flex justify-center items-center",children:(0,l.jsx)("p",{children:s.description})}),(0,l.jsx)("div",{className:"flex justify-center items-center",children:(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:"flex justify-center items-center mt-4",children:(0,l.jsx)("img",{src:n[o].settings[t].src,alt:"Logo",className:"max-w-xs max-h-32 rounded-xl"})}),(0,l.jsxs)("div",{className:"flex justify-center items-center mt-1",children:[(0,l.jsx)("button",{onClick:()=>{var e;return null===(e=document.getElementById("LogoImageInput"))||void 0===e?void 0:e.click()},className:"btn border-none text-xs bg-bg-verba text-text-alt-verba",children:"Add Logo"}),(0,l.jsx)("input",{id:"LogoImageInput",type:"file",accept:"image/*",onChange:e=>{if(e.target.files&&e.target.files[0]){let s=new FileReader;s.onload=e=>{r(s=>{var l;let n=JSON.parse(JSON.stringify(s));return n[o].settings[t].src=null===(l=e.target)||void 0===l?void 0:l.result,n})},s.readAsDataURL(e.target.files[0])}},className:"hidden"})]})]})})]},t)},y=s(73478),N=e=>{let{title:t,ColorSetting:s,setting:o,settingsConfig:n,setSettingsConfig:r}=e,a=e=>{r(s=>{let l=JSON.parse(JSON.stringify(s));return l[o].settings[t].color=e,l})};return(0,l.jsxs)("div",{className:"flex flex-col justify-center gap-1",children:[(0,l.jsx)("div",{className:"flex justify-center items-center",children:(0,l.jsx)("p",{children:s.description})}),(0,l.jsx)("div",{className:"flex gap-2 justify-center items-center",children:(0,l.jsxs)("div",{className:"flex flex-col gap-1 h-[15vh]",children:[(0,l.jsx)("label",{className:"input bg-bg-verba input-sm input-bordered flex items-center gap-2 w-full",children:(0,l.jsx)("input",{type:"text",className:"grow",placeholder:t,value:n[o].settings[t].color,onChange:e=>{a(e.target.value)}})}),(0,l.jsx)(y.gW,{color:n[o].settings[t].color,onChange:e=>{a(e)}})]})})]},t)},C=e=>{let{title:t,SelectSetting:s,setting:o,settingsConfig:n,setSettingsConfig:r}=e;return(0,l.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,l.jsx)("div",{className:"flex items-center justify-center",children:(0,l.jsx)("p",{children:s.description})}),(0,l.jsx)("div",{className:"flex items-center justify-center",children:(0,l.jsx)("select",{value:n[o].settings[t].value,onChange:e=>{let s=e.target.value;r(e=>{let l=JSON.parse(JSON.stringify(e));return l[o].settings[t].value=s,l})},className:"select bg-bg-verba",children:s.options.map(e=>(0,l.jsx)("option",{children:e},"Select_"+e))})})]},t)},w=e=>{let{title:t,CheckboxSetting:s,setting:o,settingsConfig:n,setSettingsConfig:r}=e;return(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsx)("div",{className:"flex items-center justify-center",children:(0,l.jsx)("p",{children:s.description})}),(0,l.jsx)("div",{className:"flex items-center justify-center",children:(0,l.jsx)("input",{type:"checkbox",className:"toggle",checked:n[o].settings[t].checked,onChange:e=>{let s=e.target.checked;r(e=>{let l=JSON.parse(JSON.stringify(e));return l[o].settings[t].checked=s,l})}})})]},t)},S=e=>{let{title:t,NumberFieldSetting:s,setting:o,settingsConfig:n,setSettingsConfig:r}=e;return(0,l.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,l.jsx)("div",{className:"flex items-center justify-center",children:(0,l.jsx)("p",{children:s.description})}),(0,l.jsx)("div",{className:"flex items-center justify-center",children:(0,l.jsx)("label",{className:"input input-bordered flex items-center gap-2 w-full bg-bg-verba",children:(0,l.jsx)("input",{type:"number",className:"grow",placeholder:t,value:n[o].settings[t].value,onChange:e=>{let s=e.target.value;r(e=>{let l=JSON.parse(JSON.stringify(e));return l[o].settings[t].value=s,l})}})})})]},t)},_=e=>{let{Icon:t,iconSize:s,title:o,currentSetting:n,setSetting:r,setSettingString:a}=e;return(0,l.jsxs)("button",{className:"btn lg:btn-lg flex items-center justify-center border-none hover:bg-button-hover-verba ".concat(n===a?"bg-primary-verba text-text-verba":"bg-button-verba text-text-alt-verba"),onClick:e=>{r(a)},children:[(0,l.jsx)(t,{size:s}),(0,l.jsx)("p",{className:"sm:hidden md:flex md:text-base lg:text-lg",children:o})]},o)},k=e=>{let{settingTemplate:t,setSettingTemplate:s,baseSetting:r,setBaseSetting:a}=e,[d,x]=(0,o.useState)("Customization"),[g,m]=(0,o.useState)(JSON.parse(JSON.stringify(r[t]))),[u,h]=(0,o.useState)(Object.keys(p));(0,o.useEffect)(()=>{h(Object.keys(p)),m(JSON.parse(JSON.stringify(r[t])))},[r,t]);let b=(e,t)=>{if(""===d)return null;switch(t.type){case"text":return(0,l.jsx)(v,{title:e,setting:d,TextFieldSetting:t,settingsConfig:g,setSettingsConfig:m});case"image":return(0,l.jsx)(j,{title:e,setting:d,ImageFieldSetting:t,settingsConfig:g,setSettingsConfig:m});case"check":return(0,l.jsx)(w,{title:e,setting:d,CheckboxSetting:t,settingsConfig:g,setSettingsConfig:m});case"select":return(0,l.jsx)(C,{title:e,setting:d,SelectSetting:t,settingsConfig:g,setSettingsConfig:m});case"color":return(0,l.jsx)(N,{title:e,setting:d,ColorSetting:t,settingsConfig:g,setSettingsConfig:m});case"number":return(0,l.jsx)(S,{title:e,setting:d,NumberFieldSetting:t,settingsConfig:g,setSettingsConfig:m});default:return null}};return(0,l.jsxs)("div",{className:"flex justify-between items-start gap-5",children:[(0,l.jsxs)("div",{className:"hidden lg:flex lg:flex-col gap-5 lg:w-1/4",children:[(0,l.jsxs)("div",{className:"flex flex-col justify-center items-center gap-5",children:[(0,l.jsx)("p",{className:"md:text-base lg:text-lg text-text-alt-verba",children:"Settings"}),(0,l.jsxs)("div",{className:"flex flex-col w-full bg-bg-alt-verba p-5 rounded-lg shadow-lg gap-2",children:[(0,l.jsx)(_,{Icon:i._TT,iconSize:20,title:"Customize Verba",currentSetting:d,setSetting:x,setSettingString:"Customization"}),(0,l.jsx)(_,{Icon:n.utr,iconSize:20,title:"Chat Settings",currentSetting:d,setSetting:x,setSettingString:"Chat"})]})]}),""!=d&&(0,l.jsxs)("div",{className:"sm:hidden md:flex flex-col justify-center items-center gap-5",children:[(0,l.jsx)("p",{className:" md:text-base lg:text-lg text-text-alt-verba",children:"Description"}),(0,l.jsx)("div",{className:"flex flex-col w-full bg-bg-alt-verba p-5 rounded-lg shadow-lg gap-2",children:(0,l.jsxs)("p",{className:"sm:text-xs md:text-sm lg:text-base",children:[" ",p[t][d]?p[t][d].description:""]})})]})]}),(0,l.jsxs)("div",{className:"flex flex-col lg:justify-center justify-start lg:items-center items-start gap-5 w-full lg:w-3/4",children:[(0,l.jsxs)("div",{className:"flex flex-row gap-2 items-center justify-center w-full",children:[(0,l.jsx)("div",{className:"lg:hidden sm:flex md:ml-4 sm:mr-8",children:(0,l.jsx)("ul",{className:"menu menu-sm sm:menu-horizontal bg-base-200 rounded-box bg-bg-alt-verba z-40",children:(0,l.jsx)("li",{children:(0,l.jsxs)("details",{children:[(0,l.jsxs)("summary",{children:[(0,l.jsx)(c.bqP,{size:15})," Settings"]}),(0,l.jsxs)("ul",{className:"bg-bg-alt-verba",children:[(0,l.jsx)("li",{onClick:()=>{x("Customization")},children:(0,l.jsx)("a",{children:"Customize Verba"})}),(0,l.jsx)("li",{onClick:()=>{x("Chat")},children:(0,l.jsx)("a",{children:"Chat Settings"})})]})]})})})}),(0,l.jsx)("p",{className:"sm:hidden md:flex text-lg text-text-alt-verba",children:"Configuration"}),(0,l.jsx)("select",{value:t,onChange:e=>{s(e.target.value)},className:"select select-md lg:select-sm text-xs bg-bg-alt-verba text-text-verba",children:u.map(e=>(0,l.jsx)("option",{children:e},"Template"+e))})]}),(0,l.jsxs)("div",{className:"flex flex-col w-full bg-bg-alt-verba p-10 rounded-lg shadow-lg h-[70vh] gap-2 overflow-y-scroll",children:[(0,l.jsx)("p",{className:"font-bold text-2xl lg:mb-5",children:d}),""!=d&&(0,l.jsxs)("div",{className:"lg:hidden flex flex-col items-start gap-5 mb-5",children:[(0,l.jsx)("p",{className:" md:text-base lg:text-lg text-text-alt-verba",children:"Description"}),(0,l.jsx)("div",{className:"flex flex-col w-full gap-2",children:(0,l.jsxs)("p",{className:"sm:text-xs md:text-sm lg:text-base",children:[" ",p[t][d]?p[t][d].description:""]})})]}),(0,l.jsx)("div",{className:" flex-coll gap-4 grid sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3",children:d&&Object.entries(p[t][d].settings).map(e=>{let[t,s]=e;return b(t,s)})}),(0,l.jsxs)("div",{className:"flex justify-end gap-2 mt-3",children:[(0,l.jsxs)("button",{onClick:()=>{a(e=>{let s=JSON.parse(JSON.stringify(e));return s[t]=g,s})},className:"btn flex items-center justify-center border-none text-text-verba bg-secondary-verba hover:bg-button-hover-verba",children:[(0,l.jsx)(i.FJM,{}),(0,l.jsx)("p",{className:"",children:"Apply"})]}),(0,l.jsxs)("button",{onClick:()=>{m(JSON.parse(JSON.stringify(r[t])))},className:"btn flex items-center justify-center border-none text-text-verba bg-warning-verba hover:bg-button-hover-verba",children:[(0,l.jsx)(f.B4e,{}),(0,l.jsx)("p",{className:"",children:"Reset"})]})]})]})]})]})},A=s(15560),E=s.n(A);let T=()=>{let e="https:"===window.location.protocol?"wss:":"ws:",t=window.location.host;return"".concat(e,"//").concat(t,"/ws/generate_stream")};var F=s(13921),O=s(44025),P=s(38666),I=e=>{let{message:t,handleCopyToBillboard:s,settingConfig:o}=e;return(0,l.jsxs)("div",{className:"flex items-end gap-2 ".concat("user"===t.type?"justify-end":"justify-start"),children:[(0,l.jsxs)("div",{className:"flex flex-col items-start p-4 rounded-xl animate-press-in shadow-md sm:text-sm md:text-base ".concat("user"===t.type?"bg-primary-verba":"bg-bg-verba"),children:[t.cached&&(0,l.jsx)(i.i1q,{size:12,className:"text-text-verba"}),"system"===t.type?(0,l.jsx)(F.D,{className:"prose md:prose-base sm:prose-sm p-3 prose-pre:bg-bg-alt-verba",components:{code(e){let{node:t,inline:s,className:n,children:r,...a}=e,i=/language-(\w+)/.exec(n||"");return!s&&i?(0,l.jsx)(O.Z,{style:"dark"===o.Customization.settings.theme?P.vk:P.Yn,language:i[1],PreTag:"div",...a,children:String(r).replace(/\n$/,"")}):(0,l.jsx)("code",{className:n,...a,children:r})}},children:t.content}):(0,l.jsx)("div",{className:"whitespace-pre-wrap",children:t.content})]}),(0,l.jsx)("div",{className:"flex flex-col items-center justify-center",children:"system"===t.type&&(0,l.jsx)("button",{onClick:()=>s(t.content),className:"btn border-none shadow-none flex gap-1 bg-bg-alt-verba hover:bg-secondary-verba hover:text-text-verba text-text-alt-verba",children:(0,l.jsx)("p",{className:"text-xs",children:"Copy"})})})]})},R=s(61379),D=e=>{let{status:t,true_text:s,false_text:o}=e;return(0,l.jsx)("div",{className:"p-2 rounded-lg text-text-verba text-sm ".concat(t?"bg-secondary-verba":"bg-bg-alt-verba text-text-alt-verba"),children:(0,l.jsx)("p",{className:"text-xs ".concat(t?"text-text-verba":"text-text-alt-verba"),children:t?s:o})})},z=e=>{let{component_name:t,Icon:s,changeTo:o,changePage:n,disable:r}=e;return(0,l.jsxs)("button",{disabled:r,onClick:()=>n(o),className:"btn btn-sm w-full border-none p-2 rounded-lg text-text-verba text-sm bg-button-verba hover:bg-primary-verba }",children:[(0,l.jsx)("div",{className:"hidden md:flex",children:(0,l.jsx)(s,{size:15})}),(0,l.jsx)("p",{className:'text-xs "text-text-verba',children:t})]})},G=e=>{let{APIHost:t,settingConfig:s,setChunks:n,setChunkTime:r,setCurrentPage:i,setContext:c,production:d,RAGConfig:x}=e,[g,m]=(0,o.useState)(""),u=(0,o.useRef)(null),[h,b]=(0,o.useState)(null),[p,f]=(0,o.useState)(""),[v,j]=(0,o.useState)([]),y=(0,o.useRef)(!1),[N,C]=(0,o.useState)("DONE"),[w,S]=(0,o.useState)(!1),[_,k]=(0,o.useState)([]),[A,F]=(0,o.useState)(!1),[O,P]=(0,o.useState)(""),[G,B]=(0,o.useState)("GOOD"),V=e=>{navigator.clipboard.writeText(e).then(function(){J("Copied message")},function(e){console.error("Unable to copy text: ",e)})},J=(e,t)=>{if(t?B("BAD"):B("GOOD"),A){P(e);return}P(e),F(!0),setTimeout(()=>{F(!1),P("")},3e3)};(0,o.useEffect)(()=>{j(U("VERBA_CONVERSATION")),n(K("VERBA_CHUNKS")),c(X("VERBA_CONTEXT"));let e=T(),t=new WebSocket(e);return t.onopen=()=>{console.log("WebSocket connection opened to "+e),J("WebSocket Online")},t.onmessage=e=>{let t;if(!y.current){m("");return}try{t=JSON.parse(e.data)}catch(t){console.error("Received data is not valid JSON:",e.data);return}let s=t.message;if(m(e=>e+s),"stop"===t.finish_reason){y.current=!1,C("DONE");let e=t.full_text;if(t.cached){let s=t.distance;j(t=>[...t,{type:"system",content:e,cached:!0,distance:s}])}else j(t=>[...t,{type:"system",content:e}]);m("")}},t.onerror=e=>{console.error("WebSocket Error:",e),J("WebSocket Error: "+e,!0),y.current=!1,C("DONE")},t.onclose=e=>{e.wasClean?console.log("WebSocket connection closed cleanly, code=".concat(e.code,", reason=").concat(e.reason)):console.error("WebSocket connection died"),J("WebSocket Connection Offline",!0),y.current=!1,C("DONE")},b(t),()=>{t.readyState!==WebSocket.CLOSED&&t.close()}},[]),(0,o.useEffect)(()=>{v.length>1&&L("VERBA_CONVERSATION",v),u.current&&(v[v.length-1],u.current.scrollIntoView({behavior:"smooth"}))},[v]);let M=async e=>{f(e),k([])},H=(e,t)=>{if((null==h?void 0:h.readyState)===WebSocket.OPEN){let s=JSON.stringify({query:e,context:t,conversation:v});h.send(s)}else console.error("WebSocket is not open. ReadyState:",null==h?void 0:h.readyState)},L=(e,t)=>{localStorage.setItem(e,JSON.stringify(t))},W=(e,t)=>{localStorage.setItem(e,t)},U=e=>{{let t=localStorage.getItem(e);if(t&&JSON.parse(t).length>0)return JSON.parse(t)}return[{type:"system",content:s.Customization.settings.intro_message.text}]},q=e=>{localStorage.removeItem(e)},Z=(e,t)=>{localStorage.setItem(e,JSON.stringify(t))},K=e=>{try{{let t=localStorage.getItem(e);if(t&&JSON.parse(t).length>0)return JSON.parse(t)}}catch(e){console.error("Failed to load chunks from local storage:",e)}return[]},X=e=>{try{{let t=localStorage.getItem(e);if(t)return t}}catch(e){console.error("Failed to load context from local storage:",e)}return""},Y=e=>{localStorage.removeItem(e)},$=async e=>{if(null==e||e.preventDefault(),k([]),null===t){J("No connection to server");return}if(!y.current&&p.trim()){j(e=>[...e,{type:"user",content:p}]),f("");let e=document.getElementById("reset");null!==e?(e.style.height="",e.style.width=""):console.error('The element with ID "target" was not found in the DOM.');try{y.current=!0,C("CHUNKS");let e=await fetch(t+"/api/query",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:p})}),s=await e.json();if(s){if(""!==s.error){J(s.error,!0),y.current=!1,C("DONE");return}n(s.chunks),Z("VERBA_CHUNKS",s.chunks),k([]),r(s.took),s.context&&(H(p,s.context),c(s.context),W("VERBA_CONTEXT",s.context),C("RESPONSE"))}else J("Failed to fetch from API: No data received",!0),y.current=!1,C("DONE")}catch(e){console.error("Failed to fetch from API:",e),J("Failed to fetch from API: "+e,!0),y.current=!1,C("DONE")}}},Q=async e=>{if(w||""===e||y.current||!s.Chat.settings.suggestion.checked){k([]);return}try{S(!0);let s=await fetch(t+"/api/suggestions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e})}),l=await s.json();l&&k(l.suggestions),S(!1)}catch(e){console.error("Failed to fetch suggestions:",e),S(!1)}},ee=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),et=(e,t)=>{let s=ee(t),o=e.split(RegExp("(".concat(s,")"),"gi"));return(0,l.jsx)("div",{className:"flex flex-row gap-1",children:o.map((e,s)=>(0,l.jsx)("p",{className:e.toLowerCase()===t.toLowerCase()?"font-bold text-sm":"",children:e},s))})};return(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"flex flex-col bg-bg-alt-verba rounded-lg shadow-lg p-2 md:p-5 text-text-verba gap-5 h-[55vh] overflow-auto",children:[(0,l.jsxs)("div",{className:"flex gap-1 md:gap-2 items-center",children:[x&&(0,l.jsx)("div",{className:"flex gap-2 items-center",children:(0,l.jsx)(z,{disable:d,component_name:x?x.Generator.selected:"",Icon:R.VB9,changeTo:"RAG",changePage:i})}),(0,l.jsx)("div",{className:"hidden sm:block md:h-[3vh] lg:h-[2vh] bg-text-alt-verba w-px mx-0 md:mx-1"}),(0,l.jsx)(D,{status:null!==t&&null!==h&&h.readyState===WebSocket.OPEN,true_text:"Online",false_text:"Connecting..."}),(0,l.jsx)(D,{status:s.Chat.settings.caching.checked,true_text:"Caching",false_text:"No Caching"}),(0,l.jsx)(D,{status:s.Chat.settings.suggestion.checked,true_text:"Suggestions",false_text:"No Suggestions"})]}),(0,l.jsxs)("div",{className:"flex flex-col",children:[v.map((e,t)=>(0,l.jsx)("div",{ref:t===v.length-1?u:null,className:"mb-4 ".concat("user"===e.type?"text-right":""),children:(0,l.jsx)(I,{message:e,handleCopyToBillboard:V,settingConfig:s})},t)),g&&(0,l.jsx)(I,{settingConfig:s,message:{type:"system",content:g,cached:!1},handleCopyToBillboard:V})]}),y.current&&(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"flex items-center pl-4 mb-4 gap-3",children:[(0,l.jsx)(E(),{color:s.Customization.settings.text_color.color,loading:!0,size:10,speedMultiplier:.75}),(0,l.jsxs)("p",{children:["CHUNKS"===N&&"Retrieving chunks","RESPONSE"===N&&"Generating answer"]})]}),(0,l.jsx)("div",{className:"items-center justify-center flex",children:(0,l.jsx)("button",{onClick:()=>{J("Canceled Generation",!0),m(""),y.current=!1,C("DONE")},className:"btn btn-sm text-sm bg-button-verba hover:bg-button-hover-verba text-text-verba",children:"Cancel"})})]})]}),(0,l.jsx)("div",{className:"flex flex-col bg-bg-alt-verba rounded-lg shadow-lg p-5 text-text-verba gap-5 min-h-[9.3vh]",children:(0,l.jsxs)("form",{className:"flex justify-between w-full items-center gap-3",onSubmit:$,children:[(0,l.jsx)("textarea",{id:"reset",rows:1,cols:10,onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),$(e))},value:p,onChange:e=>{f(e.target.value),Q(e.target.value)},className:" bg-bg-alt-verba textarea textarea-xs p-2 text-sm md:text-base w-full",placeholder:"Ask ".concat(s.Customization.settings.title.text," anything")}),(0,l.jsx)("button",{type:"submit",className:"btn btn-circle border-none shadow-none bg-bg-alt-verba hover:bg-secondary-verba",children:(0,l.jsx)(a.ghy,{size:18})}),(0,l.jsx)("div",{className:"tooltip text-text-verba","data-tip":"Reset Conversation",children:(0,l.jsx)("button",{type:"button",onClick:()=>{q("VERBA_CONVERSATION"),Y("VERBA_CHUNKS"),Y("VERBA_CONTEXT"),n([]),j([{type:"system",content:s.Customization.settings.intro_message.text}]),f(""),k([]),c("")},className:"btn btn-circle border-none shadow-none bg-bg-alt-verba hover:bg-secondary-verba",children:(0,l.jsx)(a.oRX,{size:18})})})]})}),(0,l.jsx)("div",{className:"flex flex-col gap-2",children:_.map((e,t)=>(0,l.jsx)("button",{className:"btn sm:btn-sm md:btn-md border:none bg-button-verba hover:bg-button-hover-verba text-sm font-normal",onClick:()=>M(e),children:et(e,p)},t+e))}),(0,l.jsx)("div",{className:"animate-pop-in ".concat(A?"opacity-100":"opacity-0"," ").concat("GOOD"===G?"bg-secondary-verba":"bg-warning-verba"," text-text-verba p-3 rounded text-sm transition-opacity"),children:(0,l.jsx)("p",{children:O})})]})},B=s(77095),V=e=>{let{title:t,modal_id:s,text:o,triggerAccept:n,triggerString:r,triggerValue:a}=e;return(0,l.jsx)("dialog",{id:s,className:"modal",children:(0,l.jsxs)("div",{className:"modal-box",children:[(0,l.jsx)("h3",{className:"font-bold text-lg",children:t}),(0,l.jsx)("p",{className:"whitespace-pre-wrap",children:o}),(0,l.jsx)("div",{className:"modal-action",children:(0,l.jsxs)("form",{method:"dialog",children:[n&&a&&r&&(0,l.jsx)("button",{className:"btn text-text-verba bg-primary-verba border-none hover:bg-button-hover-verba",onClick:()=>{n(a)},children:r}),(0,l.jsx)("button",{className:"btn text-text-verba bg-warning-verba border-none hover:bg-button-hover-verba ml-2",children:"Cancel"})]})})]})})},J=e=>{let{chunks:t,selectedChunk:s,chunkTime:r,context:a,setSelectedChunk:c,setCurrentPage:d,RAGConfig:x,production:g}=e;return(0,o.useEffect)(()=>{t&&t.length>0?c(t[0]):c(null)},[t]),(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"flex flex-col bg-bg-alt-verba rounded-lg shadow-lg p-5 text-text-verba gap-3 md:h-[17vh] lg:h-[65vh] overflow-auto",children:[(0,l.jsxs)("div",{className:"flex md:flex-col gap-5",children:[(0,l.jsx)("div",{className:"flex md:flex-row lg:flex-col gap-2 justify-center md:justify-start items-center",children:x&&(0,l.jsxs)("div",{className:"flex flex-row lg:flex-col gap-2 items-center lg:w-full",children:[(0,l.jsx)(z,{disable:g,component_name:x?x.Embedder.selected:"",Icon:i.i1q,changeTo:"RAG",changePage:d}),(0,l.jsx)(z,{disable:g,component_name:x?x.Retriever.selected:"",Icon:i.U41,changeTo:"RAG",changePage:d})]})}),t&&t.length>0&&(0,l.jsx)("div",{className:"sm:hidden md:flex items-center justify-center",children:(0,l.jsxs)("p",{className:"items-center justify-center text-text-alt-verba text-xs",children:[t.length," chunks retrieved in ",r," seconds."]})})]}),(0,l.jsxs)("div",{className:"flex sm:flex-row lg:flex-col gap-2",children:[t&&t.map((e,t)=>(0,l.jsxs)("button",{onClick:()=>c(e),className:"btn md:btn-base bg-button-verba hover:bg-button-hover-verba border-none lg:btn-lg sm:w-2/3 md:w-1/3 lg:w-full flex justify-start items-center gap-5 ".concat((null==s?void 0:s.chunk_id)===e.chunk_id&&s.doc_uuid===e.doc_uuid?"bg-secondary-verba":"bg-button-verba"," hover:button-hover-verba"),children:[(0,l.jsx)("div",{className:"tooltip text-xs","data-tip":"Score: ".concat(Math.round(100*e.score)),children:(0,l.jsx)("button",{className:"btn btn-xs border-none text-xs btn-circle lg:btn-sm bg-bg-alt-verba hover:bg-primary-verba flex md:text-sm lg:text-base",children:(0,l.jsx)(B.ZP,{end:t+1,className:"text-sm text-text-verba"})})}),(0,l.jsxs)("div",{className:"flex flex-col items-start truncate sm:w-1/2",children:[(0,l.jsx)("p",{className:"text-xs lg:text-sm text-text-verba",children:e.doc_name}),(0,l.jsx)("p",{className:"text-xs text-text-alt-verba",children:e.doc_type})]})]},e.doc_name+t)),""!==a&&(0,l.jsxs)("button",{onClick:()=>{let e=document.getElementById("context_modal");e instanceof HTMLDialogElement&&e.showModal()},className:"btn flex gap-2 w-full border-none bg-button-verba text-text-verba hover:bg-button-hover-verba",children:[(0,l.jsx)(n.UTX,{className:"text-text-verba"}),(0,l.jsx)("p",{className:"text-text-verba text-xs",children:"See Context"})]})]})]}),(0,l.jsx)(V,{modal_id:"context_modal",title:"Context Used",text:a})]})},M=s(21794),H=e=>{let{APIhost:t,selectedChunk:s,settingConfig:n,selectedDocument:r,deletable:a,setSelectedChunk:c,setDocuments:d,setTriggerReset:x,production:g}=e,[m,u]=(0,o.useState)(null),[h,b]=(0,o.useState)(null),[p,v]=(0,o.useState)(!1),[j,y]=(0,o.useState)(!1),N=(0,o.useRef)(null);(0,o.useEffect)(()=>{null!=s&&null!=t?C():u(null)},[s]);let C=async()=>{if(null!=s&&null!=t)try{v(!0);let e=await fetch(t+"/api/get_document",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({document_id:s.doc_uuid})}),l=await e.json();l&&(""!==l.error?(u(null),console.error(l.error),b(null),v(!1),y(!1)):(u(l.document),b(function(e,t){if(null===t||""===t)return{beginning:e,substring:"",ending:""};let s=e.indexOf(t);if(-1===s)return{beginning:e,substring:"",ending:""};let l=s+t.length,o=e.substring(0,s),n=e.substring(s,l);return{beginning:o,substring:n,ending:e.substring(l)}}(l.document.text,s.text)),v(!1),N.current&&N.current.scrollIntoView({behavior:"smooth"}),""!==s.text&&l.document.text.length>n.Chat.settings.max_document_size.value?y(!1):y(!0)))}catch(e){console.error("Failed to fetch document:",e),v(!1)}},w=async e=>{try{console.log("DELETING "+e),fetch(t+"/api/delete_document",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({document_id:e})}),u(null),c(null),d&&d(null),x&&x(e=>!e)}catch(e){console.error("Failed to delete document:",e)}};return null===m||p?(0,l.jsx)("div",{className:"flex flex-col gap-2",children:(0,l.jsx)("div",{className:"flex flex-col bg-bg-alt-verba rounded-lg items-center justify-center shadow-lg p-5 text-text-verba gap-5 sm:h-[47vh] lg:h-[65vh] overflow-auto",children:p&&(0,l.jsxs)("div",{className:"flex items-center justify-center pl-4 mb-4 gap-3",children:[(0,l.jsx)(E(),{color:n.Customization.settings.text_color.color,loading:!0,size:10,speedMultiplier:.75}),(0,l.jsx)("p",{children:"Loading Document..."})]})})}):(0,l.jsxs)("div",{className:"flex flex-col bg-bg-alt-verba rounded-lg shadow-lg p-5 text-text-verba gap-5 sm:h-[53.5vh] lg:h-[65vh] overflow-auto",children:[(0,l.jsxs)("div",{className:"flex justify-between",children:[(0,l.jsxs)("div",{className:"flex flex-col",children:[(0,l.jsx)("p",{className:"sm:text-sm md:text-lg font-semibold",children:m.name}),(0,l.jsx)("p",{className:"sm:text-xs md:text-sm text-text-alt-verba",children:m.type})]}),(0,l.jsxs)("div",{className:"flex gap-3",children:[h&&""!==h.substring&&(0,l.jsx)("div",{className:"flex",children:(0,l.jsxs)("button",{onClick:()=>{y(e=>!e)},className:"btn border-none text-text-verba bg-button-verba hover:bg-button-hover-verba flex gap-2",children:[(0,l.jsx)(f.rQE,{}),(0,l.jsx)("p",{className:"sm:hidden md:flex text-xs text-text-verba",children:j?"Show Only Context":"Show Whole Document"})]})}),""!==m.link&&(0,l.jsx)("div",{className:"flex",children:(0,l.jsxs)("button",{onClick:()=>{window.open(null==m?void 0:m.link,"_blank","noopener,noreferrer")},className:"btn border-none text-text-verba bg-button-verba hover:bg-button-hover-verba flex gap-2",children:[(0,l.jsx)(i.CkN,{}),(0,l.jsx)("p",{className:"sm:hidden md:flex text-xs text-text-verba",children:"Go To Source"})]})}),a&&!g&&(0,l.jsx)("div",{className:"flex",children:(0,l.jsxs)("button",{onClick:()=>{let e=document.getElementById("delete_document_modal");e instanceof HTMLDialogElement&&e.showModal()},className:"btn border-none text-text-verba bg-warning-verba hover:bg-button-hover-verba flex gap-2",children:[(0,l.jsx)(f.ZkW,{}),(0,l.jsx)("p",{className:"sm:hidden md:flex text-xs text-text-verba",children:"Delete Document"})]})})]})]}),h&&(0,l.jsxs)("div",{className:"flex flex-col gap-5",children:[j&&""!==h.beginning&&(0,l.jsx)(F.D,{className:"prose max-w-prose md:prose-base sm:prose-sm p-3 prose-pre:bg-bg-alt-verba",components:{code(e){let{node:t,inline:s,className:o,children:r,...a}=e,i=/language-(\w+)/.exec(o||"");return!s&&i?(0,l.jsx)(O.Z,{style:"dark"===n.Customization.settings.theme?P.vk:P.Yn,language:i[1],PreTag:"div",...a,children:String(r).replace(/\n$/,"")}):(0,l.jsx)("code",{className:o,...a,children:r})}},children:h.beginning}),""!==h.substring&&(0,l.jsxs)("div",{ref:N,className:" border-secondary-verba border-2 rounded-lg shadow-lg flex gap-2 flex-col p-3",children:[(0,l.jsx)("div",{className:"flex w-1/3",children:(0,l.jsxs)("div",{className:"p-2 flex gap-1 rounded-lg text-text-verba text-sm bg-secondary-verba }",children:[(0,l.jsx)(M.drw,{}),(0,l.jsx)("p",{className:"text-xs text-text-verba}",children:"Context Used"})]})}),(0,l.jsx)(F.D,{className:"prose md:prose-base sm:prose-sm p-3 prose-pre:bg-bg-alt-verba",components:{code(e){let{node:t,inline:s,className:o,children:r,...a}=e,i=/language-(\w+)/.exec(o||"");return!s&&i?(0,l.jsx)(O.Z,{style:"dark"===n.Customization.settings.theme?P.vk:P.Yn,language:i[1],PreTag:"div",...a,children:String(r).replace(/\n$/,"")}):(0,l.jsx)("code",{className:o,...a,children:r})}},children:h.substring})]}),j&&""!==h.ending&&(0,l.jsx)(F.D,{className:"prose md:prose-base sm:prose-sm p-3 prose-pre:bg-bg-alt-verba",components:{code(e){let{node:t,inline:s,className:o,children:r,...a}=e,i=/language-(\w+)/.exec(o||"");return!s&&i?(0,l.jsx)(O.Z,{style:"dark"===n.Customization.settings.theme?P.vk:P.Yn,language:i[1],PreTag:"div",...a,children:String(r).replace(/\n$/,"")}):(0,l.jsx)("code",{className:o,...a,children:r})}},children:h.ending})]}),(0,l.jsx)(V,{modal_id:"delete_document_modal",title:"Delete Document",text:"Do you want to delete "+m.name+"?",triggerString:"Delete",triggerValue:s?s.doc_uuid:"",triggerAccept:w})]})},L=e=>{let{tooltip_text:t,display_text:s,settingConfig:o}=e;return(0,l.jsxs)("div",{className:"items-center gap-2 ".concat(o.Chat.settings.info_button.checked?"flex":"hidden"),children:[(0,l.jsx)("div",{className:"tooltip tooltip-right text-xs","data-tip":t,children:(0,l.jsx)("button",{className:"btn btn-circle btn-sm border-none bg-bg-verba hover:bg-secondary-verba text-text-verba",children:(0,l.jsx)(i.LL$,{})})}),(0,l.jsx)("p",{className:"text-sm text-text-alt-verba",children:s})]})},W=s(44287),U=s.n(W),q=s(13184),Z=s.n(q),K=s(81364),X=s.n(K),Y=s(26840),$=s.n(Y);let Q={Inter:U(),Plus_Jakarta_Sans:Z(),Open_Sans:X(),PT_Mono:$()};var ee=e=>{let{APIHost:t,settingConfig:s,setCurrentPage:n,RAGConfig:r,production:a}=e,[i,c]=(0,o.useState)([]),[d,x]=(0,o.useState)(""),[g,m]=(0,o.useState)(0),[u,h]=(0,o.useState)(null);return(0,l.jsxs)("div",{className:"flex sm:flex-col md:flex-row justify-between items-start md:gap-3 ",children:[(0,l.jsxs)("div",{className:"sm:w-full md:w-1/2 lg:w-2/6 flex flex-col gap-2",children:[(0,l.jsx)(L,{settingConfig:s,tooltip_text:"Use the Chat Interface to interact with your data. Your query will be used to retrieve relevant information and to construct a response. You can choose between different Large Language Models (LLM) to create a response.",display_text:"Chat Interface"}),(0,l.jsx)(G,{setContext:x,production:a,RAGConfig:r,settingConfig:s,APIHost:t,setChunks:c,setChunkTime:m,setCurrentPage:n})]}),(0,l.jsxs)("div",{className:"flex lg:flex-row sm:flex-col justify-between items-start sm:w-full md:w-1/2 lg:w-4/6 gap-3",children:[(0,l.jsxs)("div",{className:"sm:w-full lg:w-1/4 flex flex-col gap-2",children:[(0,l.jsx)(L,{settingConfig:s,tooltip_text:"Use the Chunk Interface to browse through relevant chunks of your data, based on your last query. You can choose between different embeddings and retrieval techniques.",display_text:"Relevant Context"}),(0,l.jsx)(J,{context:d,production:a,chunks:i,RAGConfig:r,selectedChunk:u,setSelectedChunk:h,chunkTime:g,setCurrentPage:n})]}),(0,l.jsxs)("div",{className:"sm:w-full lg:w-3/4 flex flex-col gap-2",children:[(0,l.jsx)(L,{settingConfig:s,tooltip_text:"Use the Document Viewer to inspect your data and extracts of context that were used to generate responses to your queries. You can switch between showing the whole document and only showing the specific extract.",display_text:"Document Viewer"}),(0,l.jsx)(H,{production:a,setSelectedChunk:h,selectedChunk:u,APIhost:t,settingConfig:s,deletable:!1,selectedDocument:null})]})]})]})},et=e=>{let{APIHost:t,selectedDocument:s,settingConfig:n,setSelectedDocument:r,documents:c,setDocuments:d,triggerReset:x,setCurrentPage:g,RAGConfig:m,production:u}=e,[h,b]=(0,o.useState)(""),[p,f]=(0,o.useState)(1),[v,j]=(0,o.useState)(0),[y,N]=(0,o.useState)([]),[C,w]=(0,o.useState)(null),[S,_]=(0,o.useState)(null),[k,A]=(0,o.useState)(!1),T=async e=>{try{A(!0);let s=await fetch(t+"/api/get_all_documents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e||"",doc_type:S||"",page:p,pageSize:100})}),l=await s.json();l&&(""!==l.error?(console.error(l.error),A(!1),d(null)):(d(l.documents),N(l.doc_types),w(l.current_embedder),j(l.took),A(!1)))}catch(e){console.error("Failed to fetch document:",e),A(!1)}};(0,o.useEffect)(()=>{null!=c&&null!=t?T(h):(d(null),A(!1))},[p,S]),(0,o.useEffect)(()=>{null!=t?T(h):(d(null),A(!1))},[x]);let F=()=>{T(h)},O=e=>{r({text:"",doc_name:e.name,chunk_id:0,doc_uuid:e.uuid,doc_type:e.type,score:0})};return(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsx)("div",{className:"flex flex-col bg-bg-alt-verba rounded-lg shadow-lg p-5 text-text-verba md:gap-5 min-h-[15vh] md:min-h-[9.3vh]",children:(0,l.jsxs)("form",{className:"flex flex-col lg:flex-row w-full items-center justify-between gap-2 lg:gap-3",onSubmit:F,children:[(0,l.jsx)("textarea",{rows:1,cols:10,onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),F())},value:h,onChange:e=>{b(e.target.value)},className:" bg-bg-alt-verba textarea textarea-xs p-2 text-sm md:text-base w-full",placeholder:"Search for documents"}),(0,l.jsxs)("div",{className:"flex justify-between items-center gap-2 lg:w-3/5",children:[(0,l.jsx)("div",{className:"flex w-full",children:(0,l.jsx)(z,{disable:u,component_name:m?m.Embedder.selected:"",Icon:i.i1q,changeTo:"RAG",changePage:g})}),(0,l.jsx)("button",{type:"button",onClick:F,className:"btn btn-sm md:btn-md btn-circle border-none shadow-none bg-bg-alt-verba hover:bg-secondary-verba",children:(0,l.jsx)(i.U41,{size:18})}),(0,l.jsx)("button",{type:"button",onClick:()=>{b(""),T("")},className:"btn btn-sm md:btn-md btn-circle border-none shadow-none bg-bg-alt-verba hover:bg-secondary-verba",children:(0,l.jsx)(a.oRX,{size:18})})]})]})}),(0,l.jsxs)("div",{className:"flex flex-col bg-bg-alt-verba rounded-lg shadow-lg p-5 text-text-verba gap-3 sm:h-[35vh] md:h-[40vh] lg:h-[55vh] overflow-auto",children:[(0,l.jsxs)("div",{className:"flex gap-2 items-center justify-center",children:[(0,l.jsx)("div",{className:"flex items-center justify-center",children:(0,l.jsxs)("select",{value:S||"All",onChange:e=>{_("All"===e.target.value?null:e.target.value)},className:"select select-sm bg-bg-verba",children:[(0,l.jsx)("option",{children:"All"},"Select_None"),y.map(e=>(0,l.jsx)("option",{children:e},"Select_"+e))]})}),(0,l.jsxs)("div",{className:"join justify-center items-center text-text-verba",children:[p>1&&(0,l.jsx)("button",{onClick:()=>{c&&(1==p?f(1):f(e=>e-1))},className:"join-item btn btn-sm border-none bg-button-verba hover:bg-secondary-verba",children:"\xab"}),(0,l.jsxs)("button",{className:"join-item btn btn-sm border-none bg-button-verba hover:bg-secondary-verba",children:["Page ",p]}),c&&c.length>=100&&(0,l.jsx)("button",{onClick:()=>{c&&(c.length<100?f(1):f(e=>e+1))},className:"join-item btn btn-sm border-none bg-button-verba hover:bg-secondary-verba",children:"\xbb"})]})]}),c&&c.length>0&&(0,l.jsx)("div",{className:"sm:hidden md:flex items-center justify-center",children:(0,l.jsxs)("p",{className:"items-center justify-center text-text-alt-verba text-xs",children:[c.length," documents retrieved in ",v," seconds with ",C,"."]})}),(0,l.jsx)("div",{className:"gap-2 grid grid-cols-1 lg:grid-cols-2",children:c&&c.map((e,t)=>(0,l.jsx)("button",{onClick:()=>O(e),className:"btn md:btn-md lg:btn-lg w-full flex justify-start gap-4 ".concat(s&&s.doc_uuid===e.uuid?"bg-secondary-verba":"bg-button-verba"," hover:button-hover-verba"),children:(0,l.jsxs)("div",{className:"flex flex-col items-start truncate",children:[(0,l.jsx)("p",{className:"text-xs lg:text-sm text-text-verba",children:e.name}),(0,l.jsx)("p",{className:"text-xs text-text-alt-verba",children:e.type})]})},e.name+t))}),k&&(0,l.jsxs)("div",{className:"flex items-center justify-center pl-4 mb-4 gap-3",children:[(0,l.jsx)(E(),{color:n.Customization.settings.text_color.color,loading:!0,size:10,speedMultiplier:.75}),(0,l.jsx)("p",{children:"Loading Document"})]})]})]})},es=e=>{let{APIHost:t,settingConfig:s,setCurrentPage:n,RAGConfig:r,production:a}=e,[i,c]=(0,o.useState)([]),[d,x]=(0,o.useState)(0),[g,m]=(0,o.useState)(null),[u,h]=(0,o.useState)(!1);return(0,l.jsxs)("div",{className:"flex sm:flex-col md:flex-row justify-center items-start gap-3 ",children:[(0,l.jsx)("div",{className:"sm:w-full md:w-2/4",children:(0,l.jsx)(et,{production:a,RAGConfig:r,setCurrentPage:n,triggerReset:u,documents:i,setDocuments:c,APIHost:t,setSelectedDocument:m,settingConfig:s,selectedDocument:g})}),(0,l.jsx)("div",{className:"sm:w-full md:w-2/4",children:(0,l.jsx)(H,{production:a,setTriggerReset:h,deletable:!0,setDocuments:c,setSelectedChunk:m,selectedChunk:g,APIhost:t,settingConfig:s,selectedDocument:null})})]})},el=e=>{let{title:t,value:s,checked:o}=e;return(0,l.jsx)("div",{className:"flex p-3 rounded-lg ".concat(o?"bg-secondary-verba":"bg-bg-verba"),children:(0,l.jsxs)("div",{className:"flex gap-2 text-text-verba items-center",children:[(0,l.jsx)("p",{children:t}),(0,l.jsx)("div",{className:"text-xs lg:text-sm text-text-verba",children:null!==s?(0,l.jsx)("p",{children:s}):(0,l.jsx)("p",{children:o?"Available":"Not Available"})})]})})},eo=e=>{let{type:t,connected:s,isFetching:o,schemas:n,settingConfig:r,reset_verba:a}=e;return(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"flex flex-col bg-bg-alt-verba rounded-lg shadow-lg p-5 text-text-verba gap-6 h-[65vh] overflow-auto",children:[(0,l.jsxs)("div",{className:"flex lg:flex-row flex-col gap-2",children:[(0,l.jsx)("p",{className:"text-text-verba font-bold text-lg",children:"Admin Console"}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(D,{status:null!==t,true_text:t||"",false_text:t||""}),(0,l.jsx)(D,{status:"Online"===s,true_text:s,false_text:"Connecting..."})]})]}),o&&(0,l.jsxs)("div",{className:"flex items-center justify-center pl-4 mb-4 gap-3",children:[(0,l.jsx)(E(),{color:r.Customization.settings.text_color.color,loading:!0,size:10,speedMultiplier:.75}),(0,l.jsx)("p",{children:"Loading Stats"})]}),"Online"===s&&(0,l.jsxs)("div",{className:"gap-2 grid grid-cols-2",children:[(0,l.jsxs)("button",{onClick:()=>{let e=document.getElementById("reset_verba_modal");e instanceof HTMLDialogElement&&e.showModal()},className:"btn bg-button-verba text-text-verba border-none hover:bg-warning-verba flex gap-2",children:[(0,l.jsx)("div",{className:"hidden lg:flex",children:(0,l.jsx)(f.ZkW,{})}),(0,l.jsx)("p",{className:"flex text-xs",children:"Reset Verba"})]}),(0,l.jsxs)("button",{onClick:()=>{let e=document.getElementById("reset_documents_modal");e instanceof HTMLDialogElement&&e.showModal()},className:"btn bg-button-verba text-text-verba border-none hover:bg-warning-verba flex gap-2",children:[(0,l.jsx)("div",{className:"hidden lg:flex",children:(0,l.jsx)(f.ZkW,{})}),(0,l.jsx)("p",{className:"flex text-xs",children:"Reset Documents"})]}),(0,l.jsxs)("button",{onClick:()=>{let e=document.getElementById("reset_cache_modal");e instanceof HTMLDialogElement&&e.showModal()},className:"btn bg-button-verba text-text-verba border-none hover:bg-warning-verba flex gap-2",children:[(0,l.jsx)("div",{className:"hidden lg:flex",children:(0,l.jsx)(f.ZkW,{})}),(0,l.jsx)("p",{className:"flex text-xs",children:"Reset Cache"})]}),(0,l.jsxs)("button",{onClick:()=>{let e=document.getElementById("reset_suggestions_modal");e instanceof HTMLDialogElement&&e.showModal()},className:"btn bg-button-verba text-text-verba border-none hover:bg-warning-verba flex gap-2",children:[(0,l.jsx)("div",{className:"hidden lg:flex",children:(0,l.jsx)(f.ZkW,{})}),(0,l.jsx)("p",{className:"flex text-xs",children:"Reset Suggestion"})]}),(0,l.jsxs)("button",{onClick:()=>{let e=document.getElementById("reset_config_modal");e instanceof HTMLDialogElement&&e.showModal()},className:"btn bg-button-verba text-text-verba border-none hover:bg-warning-verba flex gap-2",children:[(0,l.jsx)("div",{className:"hidden lg:flex",children:(0,l.jsx)(f.ZkW,{})}),(0,l.jsx)("p",{className:"flex text-xs",children:"Reset Config"})]})]}),(0,l.jsx)("div",{className:"flex flex-col gap-2",children:n&&Object.entries(n).map(e=>{let[t,s]=e;return(0,l.jsx)(el,{title:t,value:s,checked:!1},t+"SCHEMA")})})]}),(0,l.jsx)(V,{modal_id:"reset_verba_modal",title:"Reset Verba",text:"Do you want to delete all data Verba data?",triggerString:"Reset",triggerValue:"VERBA",triggerAccept:a}),(0,l.jsx)(V,{modal_id:"reset_documents_modal",title:"Reset Documents",text:"Do you want to delete all documents?",triggerString:"Reset",triggerValue:"DOCUMENTS",triggerAccept:a}),(0,l.jsx)(V,{modal_id:"reset_cache_modal",title:"Reset Cache",text:"Do you want to delete all cached data?",triggerString:"Reset",triggerValue:"CACHE",triggerAccept:a}),(0,l.jsx)(V,{modal_id:"reset_suggestions_modal",title:"Reset Suggestions",text:"Do you want to delete all autocompletion suggestions?",triggerString:"Reset",triggerValue:"SUGGESTIONS",triggerAccept:a}),(0,l.jsx)(V,{modal_id:"reset_config_modal",title:"Reset Configuration",text:"Do you want to reset your Verba configuration?",triggerString:"Reset",triggerValue:"CONFIG",triggerAccept:a})]})},en=e=>{let{title:t,status:s,isFetching:o,settingConfig:n}=e;return(0,l.jsx)("div",{className:"flex flex-col gap-2",children:(0,l.jsxs)("div",{className:"flex flex-col bg-bg-alt-verba rounded-lg shadow-lg p-5 text-text-verba gap-6 h-[65vh] overflow-auto",children:[(0,l.jsx)("div",{className:"flex gap-2",children:(0,l.jsx)("p",{className:"text-text-verba font-bold text-lg",children:t})}),o&&(0,l.jsx)("div",{className:"flex items-center justify-center pl-4 mb-4 gap-3",children:(0,l.jsx)(E(),{color:n.Customization.settings.text_color.color,loading:!0,size:10,speedMultiplier:.75})}),(0,l.jsx)("div",{className:"flex flex-col gap-2",children:s&&Object.entries(s).map(e=>{let[t,s]=e;return(0,l.jsx)(el,{title:t,value:null,checked:s},"Status_"+t)})})]})})},er=e=>{let{APIHost:t,settingConfig:s,fetchHost:n}=e,[r,a]=(0,o.useState)(null),[i,c]=(0,o.useState)("Offline"),[d,x]=(0,o.useState)(null),[g,m]=(0,o.useState)(null),[u,h]=(0,o.useState)(null),[b,p]=(0,o.useState)(!1);(0,o.useEffect)(()=>{null!=t?f():(console.warn("Missing API Host for retrieving status"),c("Offline"),a(null),x(null),m(null),h(null),p(!1))},[]);let f=async()=>{if(t)try{p(!0);let e=await fetch(t+"/api/get_status",{method:"GET"}),s=await e.json();s?(s.error&&console.log(s.error),a(s.type),c("Online"),x(s.libraries),m(s.variables),h(s.schemas),p(!1)):console.warn("Status could not be retrieved")}catch(e){console.error("Failed to fetch document:",e),c("Offline"),a(null),x(null),m(null),h(null),p(!1)}},v=e=>{localStorage.removeItem(e)},j=async e=>{try{a(null),x(null),m(null),h(null),p(!0),v("VERBA_CONVERSATION"),v("VERBA_CHUNKS"),v("VERBA_CONTEXT"),await fetch(t+"/api/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resetMode:e})})&&(await n(),await f())}catch(e){console.error("Failed to delete document:",e)}};return(0,l.jsxs)("div",{className:"flex sm:flex-col md:flex-row justify-center items-start gap-3 ",children:[(0,l.jsx)("div",{className:"w-full md:w-1/3",children:(0,l.jsx)(eo,{reset_verba:j,settingConfig:s,type:r,isFetching:b,connected:i,schemas:u})}),(0,l.jsx)("div",{className:"w-full md:w-1/3",children:(0,l.jsx)(en,{settingConfig:s,title:"Libraries",isFetching:b,status:d})}),(0,l.jsx)("div",{className:"w-full md:w-1/3",children:(0,l.jsx)(en,{settingConfig:s,title:"Variables",isFetching:b,status:g})})]})},ea=e=>{let{title:t,TextFieldSetting:s,RAGConfig:o,RAGConfigTitle:n,RAGComponentTitle:r,setRAGConfig:a}=e;return(0,l.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,l.jsx)("div",{className:"flex items-center justify-center lg:text-base text-sm",children:(0,l.jsx)("p",{children:s.description})}),(0,l.jsx)("div",{className:"flex items-center justify-center",children:(0,l.jsx)("label",{className:"input input-bordered flex items-center gap-2 w-full lg:text-base text-sm bg-bg-verba",children:(0,l.jsx)("input",{type:"text",className:"grow",placeholder:t,value:o[n].components[r].config[t].text,onChange:e=>{let s=e.target.value;a(e=>{let l=JSON.parse(JSON.stringify(e));return console.log(l[n].components[r]),l[n].components[r].config[t].text=s,l})}})})})]},t)},ei=e=>{let{title:t,NumberFieldSetting:s,RAGConfig:o,RAGConfigTitle:n,RAGComponentTitle:r,setRAGConfig:a}=e;return(0,l.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,l.jsx)("div",{className:"flex items-center justify-center lg:text-base text-sm",children:(0,l.jsx)("p",{children:s.description})}),(0,l.jsx)("div",{className:"flex items-center justify-center",children:(0,l.jsx)("label",{className:"input input-bordered flex items-center gap-2 w-full lg:text-base text-sm bg-bg-verba",children:(0,l.jsx)("input",{type:"number",className:"grow",placeholder:t,value:o[n].components[r].config[t].value,onChange:e=>{let s=e.target.value;a(e=>{let l=JSON.parse(JSON.stringify(e));return console.log(l[n].components[r]),l[n].components[r].config[t].value=s,l})}})})})]},t)},ec=e=>{let{APIHost:t,files:s,settingConfig:n,textValues:r,RAGConfig:a,RAGConfigTitle:c,RAGComponents:d,setRAGConfig:x,setFiles:g,setTextValues:m}=e,[u,h]=(0,o.useState)(r?r[0]:""),b=e=>{x(t=>{let s=JSON.parse(JSON.stringify(t));return s[c].selected=e,s})},p=(e,t)=>{if(!a)return null;switch(t.type){case"text":return(0,l.jsx)(ea,{title:e,RAGConfig:a,TextFieldSetting:t,RAGComponentTitle:d.selected,RAGConfigTitle:c,setRAGConfig:x});case"number":return(0,l.jsx)(ei,{title:e,RAGConfig:a,NumberFieldSetting:t,RAGComponentTitle:d.selected,RAGConfigTitle:c,setRAGConfig:x});default:return null}};return(0,l.jsx)("div",{className:"flex sm:flex-col md:flex-row justify-center items-start gap-3 w-full",children:(0,l.jsxs)("div",{className:"flex flex-col bg-bg-alt-verba rounded-lg shadow-lg p-5 text-text-verba gap-5 h-[65vh] overflow-auto w-full",children:[(0,l.jsx)("div",{className:"flex flex-col",children:(0,l.jsxs)("p",{className:"text-lg",children:["Select a ",c]})}),(0,l.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-2",children:d&&Object.entries(d.components).map(e=>{let[t,s]=e;return(0,l.jsx)("button",{disabled:!s.available,onClick:()=>{b(t)},className:"btn border-none ".concat(s.available?"flex":"hidden"," ").concat(t===d.selected?"bg-secondary-verba text-text-verba":"bg-button-verba text-text-alt-verba"," hover:bg-button-hover-verba "),children:(0,l.jsx)("p",{children:t})},"Component_"+t)})}),(0,l.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,l.jsxs)("div",{className:"flex lg:flex-row flex-col gap-1",children:[(0,l.jsx)("p",{className:"lg:text-base text-xs",children:"You selected: "}),(0,l.jsx)("p",{className:"font-bold lg:text-base text-sm",children:d.selected})]}),(0,l.jsx)("p",{className:"text-sm text-text-alt-verba",children:d.components[d.selected].description})]}),(0,l.jsx)("div",{className:" flex-col gap-4 grid grid-cols-1 lg:grid-cols-1",children:a&&Object.entries(d.components[d.selected].config).map(e=>{let[t,s]=e;return p(t,s)})}),"UPLOAD"===d.components[d.selected].type&&(0,l.jsxs)("div",{className:"flex lg:flex-row flex-col gap-3",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2 items-center",children:[(0,l.jsxs)("div",{className:"flex",children:[(0,l.jsx)("button",{onClick:()=>{var e;return null===(e=document.getElementById(c+d.selected+"_upload"))||void 0===e?void 0:e.click()},className:"btn border-none bg-button-verba hover:bg-secondary-verba text-text-verba",children:"Add Files"}),(0,l.jsx)("input",{id:c+d.selected+"_upload",type:"file",value:s?void 0:"",onChange:e=>{e.target.files&&e.target.files[0]&&g(e.target.files)},className:"hidden",multiple:!0})]}),s&&(0,l.jsx)("div",{className:"flex",children:(0,l.jsx)("button",{onClick:()=>{g(null)},className:"btn text-sm border-none bg-warning-verba hover:bg-button-hover-verba ",children:"Clear Files"})})]}),s&&(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("p",{className:"flex text-text-alt-verba text-sm ",children:"Files:"}),(0,l.jsx)("div",{className:"flex flex-col gap-1 overflow-y-auto h-[15vh] border-2 p-2 rounded-lg border-bg-verba",children:s&&Array.from(s).map((e,t)=>(0,l.jsx)("p",{children:e.name},t+e.name))})]})]}),"URL"===d.components[d.selected].type&&(0,l.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,l.jsx)("div",{className:"flex items-center justify-center",children:r.length>0&&u!==r[0]||""!=u&&r.length<=0?(0,l.jsx)("p",{children:"*Enter URL"}):(0,l.jsx)("p",{children:"Enter URL"})}),(0,l.jsxs)("div",{className:"flex flex-row gap-2 w-full items-center justify-center",children:[(0,l.jsx)("div",{className:"flex flex-col items-center justify-center gap-1 w-full",children:(0,l.jsx)("label",{className:"input input-bordered flex items-center w-full bg-bg-verba",children:(0,l.jsx)("input",{type:"text",className:"grow",value:u,onChange:e=>{h(e.target.value)}})})}),(0,l.jsx)("button",{onClick:()=>{m([u])},className:"btn bg-bg-verba border-none hover:bg-secondary-verba",children:(0,l.jsx)(i.l_A,{})})]})]}),(0,l.jsx)("div",{})]})})},ed=e=>{let{APIHost:t,setCurrentPage:s,settingConfig:n,RAGConfig:r,setRAGConfig:a,showComponents:c,buttonTitle:d,baseSetting:x,settingTemplate:g}=e,[m,u]=(0,o.useState)(JSON.parse(JSON.stringify(r))),[h,b]=(0,o.useState)(null),[p,v]=(0,o.useState)([]),[j,y]=(0,o.useState)(!1),[N,C]=(0,o.useState)([]),w=async()=>{if(y(!0),!h&&p.length<=0){y(!1);return}try{_("INFO","Importing...");let e=h?await Promise.all(Array.from(h).map(e=>new Promise((t,s)=>{let l=new FileReader;l.onload=()=>{let s=function(e){let t="",s=new Uint8Array(e),l=s.byteLength;for(let e=0;es(l.error),l.readAsArrayBuffer(e)}))):[];if(b(null),e){let s=await fetch(t+"/api/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:{RAG:m,SETTING:{selectedTheme:g,themes:x}},data:e,textValues:p})}),l=await s.json();if(l){for(let e=0;e[...t,l.logging[e]]);y(!1)}else y(!1)}else y(!1)}catch(e){console.error("Failed to fetch from API:",e),y(!1)}},S=async()=>{if(t){y(!0);try{let e=await fetch(t+"/api/set_config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:{RAG:m,SETTING:{selectedTheme:g,themes:x}}})}),s=await e.json();s&&console.log(s),y(!1)}catch(e){console.error("Failed to fetch from API:",e),y(!1)}}},_=(e,t)=>{let s={type:e,message:t};C(e=>[...e,s])};return(0,l.jsxs)("div",{className:"flex sm:flex-col md:flex-row justify-between gap-3 ",children:[m&&Object.entries(m).map(e=>{let[s,o]=e;return c.includes(s)&&(0,l.jsx)("div",{className:"w-full md:w-1/4",children:(0,l.jsx)(ec,{textValues:p,setTextValues:v,files:h,setFiles:b,settingConfig:n,APIHost:t,RAGConfig:m,RAGConfigTitle:s,RAGComponents:o,setRAGConfig:u},s)},"RAGButton_"+s)}),m?(0,l.jsxs)("div",{className:"flex flex-col gap-2 w-full md:w-1/4 items-end",children:[(0,l.jsxs)("div",{className:"flex flex-row gap-2 w-full",children:[(0,l.jsx)("button",{disabled:j,onClick:()=>{a(m),"Import"===d?w():(S(),s("CHAT"))},className:"btn w-1/2 btn-lg text-base flex gap-2 bg-secondary-verba hover:bg-button-hover-verba text-text-verba",children:j?(0,l.jsx)("div",{children:(0,l.jsx)("div",{className:"flex items-center",children:(0,l.jsx)(E(),{color:n.Customization.settings.text_color.color,loading:!0,size:10,speedMultiplier:.75})})}):(0,l.jsxs)("div",{className:"flex gap-2 items-center justify-center",children:[(0,l.jsx)(i.Xur,{}),d,h&&(0,l.jsxs)("p",{className:"text-sm",children:["(",h.length,")"]})]})}),(0,l.jsxs)("button",{disabled:j,onClick:()=>{u(JSON.parse(JSON.stringify(r))),C([]),v([]),b(null)},className:"btn w-1/2 btn-lg text-base text-text-verba bg-warning-verba hover:bg-button-hover-verba",children:[(0,l.jsx)(f.B4e,{}),"Clear"]})]}),"Import"===d&&N.length>0&&(0,l.jsx)("div",{className:"bg-bg-console-verba h-[58vh] overflow-auto w-full p-5 flex flex-col gap-1 rounded-lg",children:N&&N.map((e,t)=>(0,l.jsx)("pre",{className:"text-xs font-mono ".concat("INFO"===e.type?"text-text-console-verba":"WARNING"===e.type?"text-primary-verba":"SUCCESS"===e.type?"text-secondary-verba":"ERROR"===e.type?"text-warning-verba":""),children:(0,l.jsxs)("code",{children:["(",e.type,") ",e.message]})},"console_message_"+t))})]}):(0,l.jsx)("div",{className:"flex items-center justify-center",children:(0,l.jsxs)("div",{className:"flex items-center justify-center",children:[(0,l.jsx)(E(),{color:n.Customization.settings.text_color.color,loading:!0,size:10,speedMultiplier:.75}),(0,l.jsx)("p",{children:"Loading Components..."})]})})]})};let ex=async()=>{let e=async e=>{try{let t=await fetch(e);if(!t.ok)throw Error("HTTP status ".concat(t.status));return!0}catch(t){return console.error("Failed to fetch from ".concat(e,":"),t),!1}};if(await e("http://localhost:8000/api/health"))return"http://localhost:8000";if(await e("/api/health"))return window.location.origin;throw Error("Both health checks failed, please check the Verba Server")};var eg=s(9881);function em(){var e;let[t,s]=(0,o.useState)("CHAT"),[n,r]=(0,o.useState)(!1),[a,i]=(0,o.useState)(""),[c,d]=(0,o.useState)("Default"),[x,g]=(0,o.useState)(null),u=x?x[c].Customization.settings.font.value:null,h=u&&(null===(e=Q[u])||void 0===e?void 0:e.className)||"",[b,f]=(0,o.useState)(null),[v,j]=(0,o.useState)(null),y=async()=>{try{let e=await ex();if(j(e),e)try{let t=await fetch(e+"/api/health",{method:"GET"}),s=await t.json();s?(r(s.production),i(s.gtag)):console.warn("Could not retrieve health data");let l=await fetch(e+"/api/config",{method:"GET"}),o=await l.json();o?(o.error&&console.error(o.error),o.data.RAG&&f(o.data.RAG),o.data.SETTING.themes?(g(o.data.SETTING.themes),d(o.data.SETTING.selectedTheme)):(g(p),d("Default"))):console.warn("Configuration could not be retrieved")}catch(e){console.error("Failed to fetch configuration:",e),f(null)}}catch(e){console.error("Error detecting host:",e),j(null)}};(0,o.useEffect)(()=>{y()},[]);let N=async()=>{if(v&&x)try{await fetch(v+"/api/set_config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:{RAG:b,SETTING:{selectedTheme:c,themes:x}}})})}catch(e){console.error("Failed to update config:",e)}};return(0,o.useEffect)(()=>{N()},[x,c]),(0,o.useEffect)(()=>{x&&(document.documentElement.style.setProperty("--primary-verba",x[c].Customization.settings.primary_color.color),document.documentElement.style.setProperty("--secondary-verba",x[c].Customization.settings.secondary_color.color),document.documentElement.style.setProperty("--warning-verba",x[c].Customization.settings.warning_color.color),document.documentElement.style.setProperty("--bg-verba",x[c].Customization.settings.bg_color.color),document.documentElement.style.setProperty("--bg-alt-verba",x[c].Customization.settings.bg_alt_color.color),document.documentElement.style.setProperty("--text-verba",x[c].Customization.settings.text_color.color),document.documentElement.style.setProperty("--text-alt-verba",x[c].Customization.settings.text_alt_color.color),document.documentElement.style.setProperty("--button-verba",x[c].Customization.settings.button_color.color),document.documentElement.style.setProperty("--button-hover-verba",x[c].Customization.settings.button_hover_color.color),document.documentElement.style.setProperty("--bg-console-verba",x[c].Customization.settings.bg_console.color),document.documentElement.style.setProperty("--text-console-verba",x[c].Customization.settings.text_console.color))},[x,c]),(0,l.jsxs)("main",{className:"min-h-screen p-5 bg-bg-verba text-text-verba ".concat(h),"data-theme":x?x[c].Customization.settings.theme:"light",children:[""!==a&&(0,l.jsx)(eg.GoogleAnalytics,{gaId:a}),x?(0,l.jsxs)("div",{children:[(0,l.jsx)(m,{APIHost:v,production:n,title:x[c].Customization.settings.title.text,subtitle:x[c].Customization.settings.subtitle.text,imageSrc:x[c].Customization.settings.image.src,version:"v1.0.3",currentPage:t,setCurrentPage:s}),"CHAT"===t&&(0,l.jsx)(ee,{production:n,settingConfig:x[c],APIHost:v,RAGConfig:b,setCurrentPage:s}),"DOCUMENTS"===t&&(0,l.jsx)(es,{RAGConfig:b,production:n,setCurrentPage:s,settingConfig:x[c],APIHost:v}),"STATUS"===t&&!n&&(0,l.jsx)(er,{fetchHost:y,settingConfig:x[c],APIHost:v}),"ADD"===t&&!n&&(0,l.jsx)(ed,{baseSetting:x,settingTemplate:c,buttonTitle:"Import",settingConfig:x[c],APIHost:v,RAGConfig:b,setRAGConfig:f,setCurrentPage:s,showComponents:["Reader","Chunker","Embedder"]}),"RAG"===t&&!n&&(0,l.jsx)(ed,{baseSetting:x,settingTemplate:c,buttonTitle:"Save",settingConfig:x[c],APIHost:v,RAGConfig:b,setRAGConfig:f,setCurrentPage:s,showComponents:["Embedder","Retriever","Generator"]}),"SETTINGS"===t&&!n&&(0,l.jsx)(k,{settingTemplate:c,setSettingTemplate:d,baseSetting:x,setBaseSetting:g})]}):(0,l.jsxs)("div",{className:"flex items-center justify-center h-screen gap-2",children:[(0,l.jsx)(E(),{loading:!0,size:12,speedMultiplier:.75}),(0,l.jsx)("p",{children:"Loading Verba"})]}),(0,l.jsx)("footer",{className:"footer footer-center p-4 mt-8 bg-bg-verba text-text-alt-verba",children:(0,l.jsx)("aside",{children:(0,l.jsx)("p",{children:"Build with ♥ and Weaviate \xa9 2024"})})}),(0,l.jsx)("img",{referrerPolicy:"no-referrer-when-downgrade",src:"https://static.scarf.sh/a.png?x-pxid=ec666e70-aee5-4e87-bc62-0935afae63ac"})]})}}},function(e){e.O(0,[429,582,33,190,400,61,982,420,712,558,971,23,744],function(){return e(e.s=87094)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/goldenverba/server/frontend/out/_next/static/r62UW8KQC1fPCNdqKDsS_/_buildManifest.js b/goldenverba/server/frontend/out/_next/static/r62UW8KQC1fPCNdqKDsS_/_buildManifest.js new file mode 100644 index 0000000000..fc86f486ad --- /dev/null +++ b/goldenverba/server/frontend/out/_next/static/r62UW8KQC1fPCNdqKDsS_/_buildManifest.js @@ -0,0 +1 @@ +self.__BUILD_MANIFEST={__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/_error":["static/chunks/pages/_error-6ae619510b1539d6.js"],sortedPages:["/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/goldenverba/server/frontend/out/_next/static/r62UW8KQC1fPCNdqKDsS_/_ssgManifest.js b/goldenverba/server/frontend/out/_next/static/r62UW8KQC1fPCNdqKDsS_/_ssgManifest.js new file mode 100644 index 0000000000..5b3ff592fd --- /dev/null +++ b/goldenverba/server/frontend/out/_next/static/r62UW8KQC1fPCNdqKDsS_/_ssgManifest.js @@ -0,0 +1 @@ +self.__SSG_MANIFEST=new Set([]);self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB() \ No newline at end of file diff --git a/goldenverba/server/frontend/out/index.html b/goldenverba/server/frontend/out/index.html index 05352b407d..533abda1c5 100644 --- a/goldenverba/server/frontend/out/index.html +++ b/goldenverba/server/frontend/out/index.html @@ -1,2 +1 @@ -Verba

Loading Verba

- +Verba

Loading Verba

\ No newline at end of file diff --git a/goldenverba/server/frontend/out/index.txt b/goldenverba/server/frontend/out/index.txt index 2b8df0514b..d3801364cf 100644 --- a/goldenverba/server/frontend/out/index.txt +++ b/goldenverba/server/frontend/out/index.txt @@ -1,7 +1,7 @@ 2:I[66513,[],"ClientPageRoot"] -3:I[14923,["582","static/chunks/bc9c3264-d07564fa5e9c78e4.js","33","static/chunks/737dfa3e-71fd4aa07f7d84a6.js","190","static/chunks/ec3863c0-51ee858d5ca1a7f6.js","400","static/chunks/12038df7-6e0eda258325d644.js","61","static/chunks/39aecf79-4a889f14de9b85cb.js","982","static/chunks/93854f56-29cce777bbb44957.js","420","static/chunks/9081a741-61a1020146c5d975.js","712","static/chunks/3627521c-57ae5a9df6c7e5b9.js","558","static/chunks/558-ac85fa7667d15ac6.js","931","static/chunks/app/page-7910eb29b01cebb8.js"],"default"] +3:I[14923,["582","static/chunks/bc9c3264-d07564fa5e9c78e4.js","33","static/chunks/737dfa3e-71fd4aa07f7d84a6.js","190","static/chunks/ec3863c0-51ee858d5ca1a7f6.js","400","static/chunks/12038df7-6e0eda258325d644.js","61","static/chunks/39aecf79-4a889f14de9b85cb.js","982","static/chunks/93854f56-29cce777bbb44957.js","420","static/chunks/9081a741-61a1020146c5d975.js","712","static/chunks/3627521c-57ae5a9df6c7e5b9.js","558","static/chunks/558-ac85fa7667d15ac6.js","931","static/chunks/app/page-d7176c87f5190890.js"],"default"] 4:I[39275,[],""] 5:I[61343,[],""] -0:["-l5NVPsojpvgufhA-W6jv",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}]],null],null]},[["$","html",null,{"lang":"en","children":[["$","link",null,{"rel":"icon","href":"icon.ico"}],["$","link",null,{"rel":"icon","href":"static/icon.ico"}],["$","body",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":[["$","link","0",{"rel":"stylesheet","href":"/static/_next/static/css/7af5f0c0467cb98b.css","precedence":"next","crossOrigin":"$undefined"}]]}]}]]}],null],null],[[["$","link","0",{"rel":"stylesheet","href":"/static/_next/static/css/172a34703121a5c4.css","precedence":"next","crossOrigin":"$undefined"}]],"$L6"]]]] +0:["r62UW8KQC1fPCNdqKDsS_",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}]],null],null]},[["$","html",null,{"lang":"en","children":[["$","link",null,{"rel":"icon","href":"icon.ico"}],["$","link",null,{"rel":"icon","href":"static/icon.ico"}],["$","body",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"styles":[["$","link","0",{"rel":"stylesheet","href":"/static/_next/static/css/7af5f0c0467cb98b.css","precedence":"next","crossOrigin":"$undefined"}]]}]}]]}],null],null],[[["$","link","0",{"rel":"stylesheet","href":"/static/_next/static/css/172a34703121a5c4.css","precedence":"next","crossOrigin":"$undefined"}]],"$L6"]]]] 6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"Verba"}],["$","meta","3",{"name":"description","content":"The GoldenRAGtriever"}],["$","meta","4",{"name":"next-size-adjust"}]] 1:null