import{j as t,S as r,h as n,s as c,H as i,a6 as b,o as g}from"./vendor-ClLR6ncd.js";import{d as v}from"./Add-CLrXAvOx.js";import{d as y}from"./model-Dfrorm_S.js";import{d as B}from"./Edit-Bg-98YAB.js";import{d as D}from"./Delete-BD9BsoWc.js";import{R as w}from"./RefreshDataButton-BMv_Vwgi.js";import{L as S,u as A,a as I,b as P}from"./index-OtVJl4GC.js";import{E as L}from"./Messages-BRmQDxrZ.js";import{C as W}from"./CreateDialogContext-Buan56-U.js";import{D as k}from"./index-DY-IkI-n.js";import"./lodash-ZyeDnt0e.js";import{D as a}from"./ui-DEn7LX9m.js";import{u as E,a as f,b as R,n as h,c as T}from"./model-B1_e74fU.js";import{u as $}from"./model-BBaroEiB.js";import{L as x}from"./Link-BLwKPJFF.js";import{C as Q}from"./Card-DCyqxUVE.js";import{C as U}from"./CardContent-B36bxiGw.js";import{A as _,a as q,b as z}from"./AccordionDetails-Bqc4B-Ut.js";import{C as F}from"./CardActions-DbEyUhB8.js";import"./highlightSearch-BTHB3jgf.js";import"./WithMeasure-BDk9QPMF.js";import"./TableRow-CGDSOtFZ.js";import"./TableSortLabel-BJFq2axQ.js";import"./Box-Co2WcNPC.js";import"./TypographyWithTooltip-BFAG3Va9.js";import"./DialogContent-DR8Wx7Lo.js";import"./DialogTitle-i0lt2jWQ.js";import"./WarningMessage-4TK5GdCH.js";import"./Warning-DsmyDRzF.js";import"./model-BneMh0-t.js";import"./model-DgFcCvKB.js";import"./model-C9Idzwgo.js";import"./model-DAvH-x8m.js";import"./model-Cx9iH8L7.js";import"./index-PJ52zw2m.js";import"./model-CvVGVe3F.js";function u({label:e,value:o}){return t.jsxs(r,{direction:"row",gap:1,flexWrap:"wrap",alignItems:"center",children:[t.jsxs(n,{fontWeight:"bold",children:[e,":"]}),o?t.jsx(n,{children:o}):t.jsx(n,{color:"text.secondary",fontStyle:"italic",children:"Empty"})]})}const H=T.filter(e=>e!=="id"&&e!=="evdb");function M(e){const o=A(),{open:d,openParameter:l}=p(),{addChatBotQuery:j}=I(),{repoConnection:C}=P(),s=!!l;return t.jsxs(Q,{sx:{width:450},children:[t.jsx(b,{title:e.id}),t.jsxs(U,{sx:{pt:0,pb:0,display:"flex",flexDirection:"column",gap:1},children:[t.jsx(u,{label:h.evdb,value:e.evdb}),t.jsxs(_,{children:[t.jsx(q,{expandIcon:t.jsx(g,{}),children:"Advanced Settings"}),t.jsx(z,{children:H.map(m=>t.jsx(u,{label:h[m],value:e[m]},m))})]})]}),t.jsxs(F,{disableSpacing:!0,children:[t.jsx(i,{disabled:s,sx:{pl:1,pr:1,mr:1,ml:1},variant:"contained",onClick:()=>{o(j(C,e.id))},children:"Chat"}),t.jsx(a,{Component:i,componentProps:{disabled:s,component:c,to:"./new",relative:"path",state:e,startIcon:t.jsx(y,{})},children:"copy"}),t.jsx(a,{Component:i,componentProps:{disabled:s,component:c,to:`./edit/${encodeURI(e.id)}`,relative:"path",startIcon:t.jsx(B,{})},children:"edit"}),t.jsx(a,{Component:i,componentProps:{disabled:s,color:"error",startIcon:t.jsx(D,{}),onClick:()=>{d(e.id)}},children:"delete"})]})]})}function N(){const e=f();return e.isSuccess?e.data.chatBots.length===0?t.jsx(n,{children:"No chatbots defined yet"}):t.jsxs(t.Fragment,{children:[t.jsxs(r,{style:{marginTop:0},children:[t.jsx(n,{fontWeight:"bold",children:"To chat with a bot do one of the following:"}),t.jsx(n,{fontSize:"0.9rem",children:'1. click on the "CHAT" button located in a ChatBot card.'}),t.jsx(n,{fontSize:"0.9rem",children:'2. navigate to the "Query" link found below the Repository section on the left pane. From there, open the queries menu by clicking on the "NEW QUERY" button and select the "ChatBot" item from the dropdown list.'})]}),t.jsx(r,{direction:"row",gap:2,flexWrap:"wrap",children:e.data.chatBots.map(o=>t.jsx(M,{...o},o.id))})]}):t.jsx(S,{})}const{useDialogContext:p,DialogContextProvider:G}=W();function O({mutation:e}){const o=p();return t.jsx(k,{...o,dialogTitle:"Delete chatbot",dialogBodyMessage:`Do you want to delete chatbot ${o.openParameter} permanently?`,submitTitle:"Delete",onSubmit:e.mutate})}function Y(){const e=$("llm-chat-state.html"),o=E({useDeleteChatBotContext:p}),d=f(),l=R();return t.jsxs(r,{spacing:1,sx:{flexGrow:1},children:[t.jsx(O,{mutation:o}),t.jsxs(r,{direction:"row",justifyContent:"space-between",children:[t.jsx(n,{variant:"h4",children:"ChatBots"}),t.jsxs(r,{direction:"row",spacing:2,children:[t.jsx(w,{disabled:d.isFetching||o.isLoading,onClick:()=>l({resetIndexesList:!0})}),t.jsx(a,{Component:i,componentProps:{variant:"contained",sx:{alignSelf:"flex-start"},component:c,to:"./new",relative:"path",startIcon:t.jsx(v,{})},children:"Add new chatbot"})]})]}),t.jsx(L,{error:o.error,resetError:o.reset}),t.jsxs(n,{variant:"subtitle1",fontSize:"0.9rem",children:[t.jsx(n,{fontWeight:"bold",component:"span",children:"Prerequisite:"})," ","an existing expertise vector database. It can be created on"," ",t.jsx(x,{component:c,to:"../llm-embedding",relative:"path",children:"Create LLM Embedding"})," ","page."," ",t.jsx(x,{href:e,target:"documentation",children:"Documentation"})," ","explains on the creation process."]}),t.jsx(N,{})]})}function Wt(){return t.jsx(G,{children:t.jsx(Y,{})})}export{Wt as default};
