import{_ as p}from"./BoDFvG8T.js";import{_ as c}from"./DAt0rlIx.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"./dgvVcRbD.js";import{u as B}from"./BtWIKuWo.js";import{F as y}from"./k_JGKJJP.js";import"./CVKV6eJo.js";import"./Dc4I8EvL.js";import"./B62TEBIi.js";import"./DX3tX3Y8.js";import"./Dq8znpD1.js";import"./Dz8Swvod.js";import"./COpoDM1M.js";import"./D6j-iADt.js";import"./wWRSdjR0.js";import"./asafqq8u.js";import"./BOr0jPkT.js";import"./PjxHOgst.js";import"./PBSS8bwl.js";import"./C7c-EcZg.js";import"./BrAY5X9P.js";import"./BLJJlJXh.js";import"./DjjPF25_.js";import"./ClvrI8Td.js";import"./BxLYNdF4.js";import"./Cuh_dt_A.js";import"./Dcv3SB2f.js";import"./BIMr8OGX.js";import"./Dlg-EP8N.js";import"./DBAxjluF.js";import"./C1qmphIB.js";import"./CFn42afA.js";import"./IQohyGZ0.js";import"./DowcPyIv.js";import"./BnobUxhI.js";import"./JhstNoj0.js";import"./CDo3WHWP.js";import"./B1N1Egs6.js";import"./DjY5_9nl.js";import"./Bw0uuBPj.js";import"./XTzszJDu.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};
