import{_ as p}from"./hcYt5xb6.js";import{_ as c}from"./C-jt9Ih2.js";import{h as u,e as g,a7 as k,E as w,k as n,i as h,c as f,o as _,b}from"./BzhixHsn.js";import{u as B}from"./G5O1m7ek.js";import{F as y}from"./DkVjT0nP.js";import"./4isL45Eu.js";import"./C9XbPd6k.js";import"./BTANIQ8V.js";import"./Di109XjC.js";import"./CRjpF7qy.js";import"./IgXGHcdR.js";import"./COjiOs1v.js";import"./Bp3-KBkO.js";import"./DKMWZZOl.js";import"./XCOtPLqC.js";import"./Bi0Cqvs9.js";import"./C56gk0qC.js";import"./BmCC6msl.js";import"./vJ3Jskde.js";import"./BYr6U6oc.js";import"./C-zlyDS5.js";import"./KyMCIHQI.js";import"./C8B8ONuC.js";import"./CW7RC7pq.js";import"./DhvzP0AS.js";import"./DzpHhHXI.js";import"./2RVX2kid.js";import"./C-9Ampo3.js";import"./C-xhCs27.js";import"./Le8goM6p.js";import"./_XME2JEy.js";import"./BkS3akZz.js";import"./BLw_G03o.js";import"./B9I6JWJy.js";import"./CHh9YBUH.js";import"./zIw-xwcH.js";import"./BVAf69h5.js";import"./EdM3CJ8e.js";import"./BmLyE0U0.js";import"./CMS48I6h.js";const F={class:"space-y-6"},pe=u({__name:"index",setup(v){const{t:e}=g(),t=k();w("knowledge-bases");const{data:s}=B("/v1/admin/all-models?capabilities=embedding",{server:!1}),i=n(()=>(s.value??[]).map(a=>({label:a.display_name,value:a.id}))),d=n(()=>{const a={};return(s.value??[]).forEach(o=>{a[o.id]=o}),a}),l=n(()=>({title:e("admin.pages.knowledgeBases.title"),description:e("admin.pages.knowledgeBases.description"),apiEndpoint:"/v1/admin/rag/knowledge-bases",columns:[{accessorKey:"name",header:e("admin.pages.knowledgeBases.columns.name"),cell:a=>{const o=a.row.original;return h(p,{to:`/admin/kbs/${o.id}`,class:"text-primary font-medium cursor-pointer text-left focus:outline-none focus:ring-2 focus:ring-primary/40 rounded-full bg-muted/30 hover:bg-muted/60 hover:underline px-2 py-0.5 transition-colors"},()=>o.name)}},{accessorKey:"description",header:e("common.description")},{accessorKey:"created_at",header:e("admin.pages.knowledgeBases.columns.createdAt"),cell:a=>new Date(a.getValue()).toLocaleString()}],detailFields:[{name:"id",label:e("common.id"),type:"text"},{name:"name",label:e("admin.pages.knowledgeBases.detailFields.name"),type:"text"},{name:"description",label:e("common.description"),type:"textarea"},{name:"embedding_model_id",label:e("admin.pages.knowledgeBases.detailFields.embeddingModel"),type:"text",render:a=>a?d.value[a]?.display_name||a:e("admin.pages.knowledgeBases.notSet")},{name:"chunk_size",label:e("admin.pages.knowledgeBases.detailFields.chunkSize"),type:"text",render:a=>a?e("admin.pages.knowledgeBases.charactersCount",{count:a}):e("admin.pages.knowledgeBases.useDefault")},{name:"chunk_overlap",label:e("admin.pages.knowledgeBases.detailFields.chunkOverlap"),type:"text",render:a=>a?e("admin.pages.knowledgeBases.charactersCount",{count:a}):e("admin.pages.knowledgeBases.useDefault")},{name:"created_at",label:e("admin.pages.knowledgeBases.columns.createdAt"),type:"datetime"},{name:"updated_at",label:e("admin.pages.knowledgeBases.columns.updatedAt"),type:"datetime"}],formFields:[{name:"name",label:e("admin.pages.knowledgeBases.formFields.name"),type:"text",required:!0,placeholder:e("admin.pages.knowledgeBases.formFields.namePlaceholder")},{name:"description",label:e("common.description"),type:"textarea",placeholder:e("admin.pages.knowledgeBases.formFields.descriptionPlaceholder")},{name:"embedding_model_id",label:e("admin.pages.knowledgeBases.formFields.embeddingModel"),type:"select",required:!0,options:i.value,placeholder:e("admin.pages.knowledgeBases.formFields.embeddingModelPlaceholder")},{name:"chunk_size",label:e("admin.pages.knowledgeBases.formFields.chunkSize"),type:"number",required:!0,placeholder:e("admin.pages.knowledgeBases.formFields.chunkSizePlaceholder"),help:e("admin.pages.knowledgeBases.formFields.chunkSizeHelp")},{name:"chunk_overlap",label:e("admin.pages.knowledgeBases.formFields.chunkOverlap"),type:"number",required:!0,placeholder:e("admin.pages.knowledgeBases.formFields.chunkOverlapPlaceholder"),help:e("admin.pages.knowledgeBases.formFields.chunkOverlapHelp")}],customActions:[{key:"view-documents",label:e("admin.pages.knowledgeBases.viewDocuments"),icon:y,variant:"default"}],canCreate:!0,canEdit:!0,canDelete:!0,canView:!0,showFilters:!0,emptyMessage:e("admin.pages.knowledgeBases.emptyMessage"),pageSize:20})),r=(a,o)=>{a.key==="view-documents"&&t.push(`/admin/kbs/${o.id}`)};return(a,o)=>{const m=c;return _(),f("div",F,[b(m,{config:l.value,onRowAction:r},null,8,["config"])])}}});export{pe as default};
