PageSourceSearch

https://app.snapto.ai/assets/AiDefaultConfigs-CWlimJN3.js

js snapto.ai collected 2026-10-05 15:08:44 UTC 5,122 bytes, 1 lines download raw bytes

1import{C as F,r as l,p as e,L as C,T as I,v as u,B as o,x as R,N as g,ba as E,bF as M,af as z,z as N}from"./index-C9IH3k-2.js";import{N as b,W as a,T as r,g as P,J as L}from"./TemplateUtil-D1DzmWLm.js";import{P as U}from"./PageDescription-BrOUsEZE.js";import{F as $}from"./Table-isZ0WXp4.js";import"./Wrapper-ChjuDa3w.js";import"./HelperMethods-C-ewwU_x.js";import"./index-BOwvFOZJ.js";import"./Pagination-D1z-xPUv.js";import"./HolderOutlined-YOHjCGKZ.js";const{Text:s}=I,B=[{key:"CHAT_SUMMARY",label:"Chat Summary",where:"Inbox — Summarize button"},{key:"CHAT_REPLY",label:"Chat Reply",where:"Inbox — AI Assist button"},{key:"CHAT_BUILDER",label:"AI Chatbot Builder",where:"Advance Chatbot — AI builder"}],k=c=>c?.config?.input?.find(h=>h.role==="system")?.content||c?.config?.instructions||"",Q=()=>{const c=F(),[h,w]=l.useState([]),[A,d]=l.useState(!1),[i,y]=l.useState(null),[T,p]=l.useState(!1),x=async()=>{try{d(!0);const n=await R("/api/v1/admin/ai/defaultConfig");n&&n.status===200&&w(n.data||[])}catch{g.error("Failed to fetch default configurations. Please try again.")}finally{d(!1)}};l.useEffect(()=>{x()},[]);const v=B.map(n=>({...n,config:h.find(t=>(t.feature||[]).includes(n.key))||null})),f=n=>{c(n.config?"/AiDefaultConfigs/UpdateConfig":"/AiDefaultConfigs/CreateConfig",{state:{config:n.config||void 0,adminDefault:!0,feature:n.key}})},S=n=>{b.confirm({title:"Delete Default Configuration",content:e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Are you sure you want to delete the default configuration for ",e.jsx("b",{children:n.label}),"?"]}),e.jsx("b",{children:"Warning:"})," Customers without their own selection will have no fallback config for this feature until a new default is created."]}),okText:"Yes, Delete",okType:"danger",cancelText:"Cancel",onOk:async()=>{try{d(!0);const t=await N(`/api/v1/admin/ai/defaultConfig/${n.key}`);t&&t.status===200?(g.success(`Default configuration for "${n.label}" deleted successfully!`),x()):g.error("Failed to delete configuration. Please try again.")}catch{g.error("Failed to delete configuration. Please try again.")}finally{d(!1)}}})},m=()=>{p(!1),y(null)},D=[{title:"Feature",key:"feature",render:(n,t)=>e.jsxs(u,{orientation:"vertical",size:0,children:[e.jsx(s,{strong:!0,children:t.label}),e.jsx(s,{type:"secondary",style:{fontSize:12},children:t.where})]})},{title:"Name",key:"name",render:(n,t)=>t.config?e.jsx(o,{type:"link",onClick:()=>f(t),children:t.config.name||"Unnamed"}):e.jsx(r,{children:"Not configured"})},{title:"Model",key:"model",render:(n,t)=>t.config?.config?.model?e.jsx(r,{color:"blue",children:t.config.config.model}):null},{title:"Tools",key:"tools",render:(n,t)=>e.jsx(u,{wrap:!0,children:t.config?.config?.tools?.map((j,_)=>e.jsx(r,{color:j.type==="file_search"?"green":"orange",children:j.type},_))})},{title:"System Instructions",key:"instructions",render:(n,t)=>e.jsx(s,{ellipsis:!0,style:{maxWidth:200},children:k(t.config)})},{title:"Actions",key:"actions",render:(n,t)=>t.config?e.jsxs(u,{children:[e.jsx(o,{type:"text",icon:e.jsx(E,{}),size:"small",onClick:()=>{y(t),p(!0)},children:"View"}),e.jsx(o,{type:"text",icon:e.jsx(M,{}),size:"small",onClick:()=>f(t),children:"Edit"}),e.jsx(o,{type:"text",icon:e.jsx(L,{}),size:"small",danger:!0,onClick:()=>S(t),children:"Delete"})]}):e.jsx(o,{type:"primary",ghost:!0,icon:e.jsx(z,{}),size:"small",onClick:()=>f(t),children:"Create"})}];return e.jsxs(C,{vertical:!0,gap:"large",children:[e.jsx(C,{justify:"space-between",wrap:!0,children:e.jsx(I.Title,{level:4,style:{margin:0},children:"Default AI Configurations"})}),e.jsx(U,{children:"Platform-wide default OpenAI configuration for each AI feature. It applies automatically whenever a customer hasn't selected their own configuration for that feature. Defaults never carry an API key — the platform key is used at call time."}),e.jsx($,{columns:D,dataSource:v,loading:A,rowKey:"key",pagination:!1,scroll:{x:"max-content"}}),e.jsx(b,{title:"Configuration Details",open:T,onCancel:m,footer:[e.jsx(o,{type:"primary",onClick:()=>{m(),f(i)},children:"Edit Configuration"},"edit"),e.jsx(o,{onClick:m,children:"Close"},"close")],width:800,styles:{body:{maxHeight:"70vh",overflowY:"auto"}},children:i?.config&&e.jsxs(a,{bordered:!0,column:1,children:[e.jsx(a.Item,{label:"Feature",children:e.jsx(s,{strong:!0,children:i.label})}),e.jsx(a.Item,{label:"Name",children:e.jsx(s,{strong:!0,children:i.config.name})}),e.jsx(a.Item,{label:"Model",children:e.jsx(r,{color:"blue",children:i.config.config?.model})}),e.jsx(a.Item,{label:"System Instructions",children:e.jsx(s,{style:{whiteSpace:"pre-wrap"},children:k(i.config)||"No system instructions"})}),e.jsx(a.Item,{label:"Tools",children:e.jsx(u,{wrap:!0,children:i.config.config?.tools?.map((n,t)=>e.jsxs(r,{color:n.type==="file_search"?"green":"orange",children:[n.type,n.vector_store_ids&&` (${n.vector_store_ids.length} stores)`]},t))||e.jsx(s,{type:"secondary",children:"No tools configured"})})}),e.jsx(a.Item,{label:"Created",children:e.jsx(s,{type:"secondary",children:i.config.creationTime?P(i.config.creationTime):"Unknown"})})]})})]})};export{Q as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.