PageSourceSearch

https://app.voxhealth.ai/assets/OrganizationAssistants-Ca84cQHB.js

js voxhealth.ai collected 2026-10-05 13:15:33 UTC 34,176 bytes, 1 lines download raw bytes

1import{Ct as h,F as Se,G as C,Jt as d,T as V,U as n,V as Ve,Wt as U,_,b as E,d as W,et as G,h as Ke,ht as m,i as pe,j as me,jt as ge,l as H,m as S,nt as J,o as re,p as ce,rt as b,st as fe,u as D,v as a,w as Y,x as o,y as de}from"./vue.runtime.esm-bundler-DYdOdNtL.js";import{t as Le}from"./userStore-CqpYUtu8.js";import{Bt as Ie,Et as Te,Rt as Me,Vt as ve,wt as Be,zt as ze}from"./main-DnpaWVIM.js";import{c as Pe}from"./format-CDnuUStP.js";import{t as Oe}from"./useConfirmationModal-BDWudYJL.js";import{t as $e}from"./useEscapeKey-BaJLOwW5.js";import{t as Ue}from"./LoadingSpinner-BhEBpkYZ.js";import{t as De}from"./ConfirmationModal-Cc440lln.js";import{t as ye}from"./useToast-m1WG9pkD.js";import{t as Ne}from"./DataTable-C4kXiRNW.js";import{a as be,i as Fe,n as je,o as Re,r as qe,t as We}from"./voice-providers-CFB6EnvC.js";import{a as Ge,i as He,n as Je,o as Ye,r as Xe,t as Qe}from"./assistants-BOa6rbRN.js";import{n as Ze}from"./assistant_templates-Csnh24xb.js";import{r as ea}from"./knowledgebases-DPPT_wYU.js";var X=[{formKey:"schedulingEnabled",column:"scheduling_enabled",label:"Appointment Access",shortLabel:"Appointments",description:"Looks up and reads back a caller's own appointments. The sub-toggles control booking, cancelling, and confirming — with all three off, appointment access is read-only.",default:!0},{formKey:"bookingEnabled",column:"booking_enabled",label:"Book Appointments",shortLabel:"Book",de
1scription:"Checks availability and books new appointments. Only active while Appointment Access is on.",default:!0,parent:"schedulingEnabled"},{formKey:"cancelEnabled",column:"cancel_enabled",label:"Cancel Appointments",shortLabel:"Cancel",description:"Cancels existing appointments. Rescheduling also needs Book Appointments on. Only active while Appointment Access is on.",default:!0,parent:"schedulingEnabled"},{formKey:"confirmEnabled",column:"confirm_enabled",label:"Confirm Appointments",shortLabel:"Confirm",description:"Marks a caller as confirmed for an existing appointment. Only active while Appointment Access is on.",default:!0,parent:"schedulingEnabled"},{formKey:"transferEnabled",column:"transfer_enabled",label:"Call Transfer",shortLabel:"Transfer",description:"Transfers callers to a person when call routing is set up.",default:!0},{formKey:"intakeEnabled",column:"intake_enabled",label:"New Patient Intake",shortLabel:"Intake",description:"Registers new patients over the phone: collects the details configured under New Patient Intake and hands the registration to the office.",default:!0},{formKey:"messagesEnabled",column:"messages_enabled",label:"Take a Message",shortLabel:"Messages",description:"Takes messages for the office.",default:!0},{formKey:"billingEnabled",column:"billing_enabled",label:"Billing & Payments",shortLabel:"Billing",description:"Looks up account balances and billing history, and sends payment links.",default:!0},{formKey:"profileEnabled",column:"profile_enabled",label:"Profile & Records Lookup",shortLabel:"Profile",description:"Looks up a caller's profile and records. Identity verification needs this or scheduling, billing, or registration on.",default:!0},{formKey:"locationEnabled",column:"location_enabled",label:"Locations & Directions",shortLabel:"Locations",description:"Lists office locations and gives travel time and directions.",default:!0},{formKey:"waitlistEnabled",column:"waitlist_enabled",label:"Appointment Waitlist",shortLabel:"Waitlist",description:"Offers to add callers to the waitlist when no slot works, and texts them when one opens up. Only active while Booking is on and the Waitlist feature is enabled for the organization.",default:!1,parent:"bookingEnabled"},{formKey:"sendLinksEnabled",column:"send_links_enabled",label:"Send Links",shortLabel:"Send Links",description:"Texts or emails links to the practice's forms and policy documents, and sends an office's address, hours and map link to callers who ask for it.",default:!1},{formKey:"pharmacyEnabled",column:"pharmacy_enabled",label:"Pharmacy",shortLabel:"Pharmacy",description:"Looks up the caller's prescriptions. Requires a pharmacy integration in Settings → Integrations.",default:!1},{formKey:"refillsEnabled",column:"refills_enabled",label:"Prescription Refills",shortLabel:"Refills",description:"Checks refill status and whether prescriptions are ready for pickup. Only active while Pharmacy is on.",default:!0,parent:"pharmacyEnabled"}];function _e(v,k){const l=v[k.column],x=l==null?k.default:l===!0;if(!x||!k.parent)return x;const A=X.find(K=>K.formKey===k.parent);return A?_e(v,A):x}function aa(){return X.filter(v=>!v.parent).map(v=>({...v,children:X.filter(k=>k.parent===v.formKey)}))}ge(),me(),fe(),pe();var ta={key:0,id:"assistantModal",tabindex:"-1","aria-hidden":"true",class:"fixed top-0 left-0 right-0 z-50 flex justify-center items-center w-full h-full p-4 overflow-x-hidden overflow-y-auto bg-gray-900 bg-opacity-50"},sa={class:"relative w-full max-w-2xl max-h-full"},la={class:"card-base p-5 relative"},ia={class:"card-header border-b border-gray-200 dark:border-gray-600"},na={class:"modal-title"},ra={class:"border-b border-gray-200 dark:border-gray-600 mb-4 overflow-x-auto"},oa={class:"flex flex-nowrap -mb-px text-xs font-medium text-center whitespace-nowrap"},da={class:"mr-2"},ua={class:"mr-2"},ca={class:"mr-2"},va={class:"mr-2"},ba={class:"grid grid-cols-2 gap-4 p-3 bg-gray-50 dark:bg-gray-800 rounded-lg"},pa={key:0,class:"col-span-2 flex items-start gap-2 rounded-md border border-amber-200 dark:border-amber-800/40 bg-amber-50 dark:bg-amber-900/20 px-3 py-2 text-sm text-amber-800 dark:text-amber-300"},ma={class:"space-y-3"},ga=["disabled"],fa=["disabled"],ya=["value"],_a=["disabled"],ha={value:""},ka=["value"],xa={key:0,disabled:""},wa={class:"space-y-3"},Ea={class:"flex items-center h-[38px]"},Aa=["disabled"],Ca={class:"p-3 bg-gray-50 dark:bg-gray-800 rounded-lg"},Sa={key:0,class:"max-h-72 overflow-y-auto rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 p-2 space-y-1"},Va=["value","checked","onChange"],Ka={class:"flex-1 min-w-0"},La={class:"block truncate"},Ia=["title"],Ta={key:1,class:"block text-xs italic text-amber-700 dark:text-amber-400"},Ma={key:1,class:"text-sm text-gray-500 dark:text-gray-400 italic rounded border border-gray-300 dark:border-gray-600 px-3 py-2"},Ba={class:"grid grid-cols-2 gap-3 p-3 bg-gray-50 dark:bg-gray-800 rounded-lg"},za={value:""},Pa=["value"],Oa=["disabled"],$a={value:""},Ua=["value"],Da={key:0},Na=["disabled"],Fa={value:""},ja=["value"],Ra=["disabled"],qa={key:1},Wa={class:"flex items-center gap-2"},Ga=["min","max","step","disabled"],Ha={class:"w-10 shrink-0 text-right text-sm tabular-nums text-gray-700 dark:text-gray-300"},Ja={class:"text-xs text-gray-500 dark:text-gray-400 mt-1"},Ya={class:"col-span-2"},Xa={class:"space-y-2"},Qa={class:"flex items-center justify-between gap-3"},Za={class:"shrink-0 text-xs font-medium text-gray-500 dark:text-gray-400"},et={class:"grid grid-cols-1 gap-1.5 sm:grid-cols-2"},at=["for","title"],tt={class:"min-w-0 truncate text-sm font-medium text-gray-900 dark:text-white"},st={class:"relative inline-flex shrink-0 items-center"},lt=["id","onUpdate:modelValue"],it=["for","title"],nt={class:"min-w-0 truncate text-sm text-gray-700 dark:text-gray-300"},rt={class:"relative inline-flex shrink-0 items-center"},ot=["id","onUpdate:modelValue","disabled"],dt={class:"space-y-3 p-3 bg-gray-50 dark:bg-gray-800 rounded-lg"},ut={class:"form-footer mt-4"},ct=["disabled"],vt={__name:"AssistantModal",props:{modelValue:{type:Boolean,default:!1},templates:{type:Array,default:()=>[]},knowledgeBases:{type:Array,default:()=>[]},organizationId:{type:String,required:!0},assistant:{type:Object,default:null},isEditing:{type:Boolean,default:!1}},emits:["update:modelValue","saved","close"],setup(v,{emit:k}){const l=v,x=k,{showSuccess:A,showError:K,showWarning:T}=ye();$e(()=>{l.modelValue&&te()},()=>l.modelValue);const M=X,Q=aa(),B=_(()=>M.filter(i=>e.value[i.formKey]&&(!i.parent||e.value[i.parent])).length),e=m({name:"",assistant_type:"",template_id:"",organization_id:l.organizationId,knowledge_base_ids:[],enableToolMessages:!0,voice_provider:"",voice_model:"",voice_id:"",voice_speed:null,first_message:"",schedulingEnabled:!0,bookingEnabled:!0,cancelEnabled:!0,confirmEnabled:!0,transferEnabled:!0,intakeEnabled:!0,messagesEnabled:!0,billingEnabled:!0,profileEnabled:!0,locationEnabled:!0,sendLinksEnabled:!1,pharmacyEnabled:!1,refillsEnabled:!0,waitlistEnabled:!1,scheduling_policy:"",office_policies:"",custom_instructions:""}),p=m("settings"),f={settings:["name","assistant_type","template_id","enableToolMessages"],knowledge:["knowledge_base_ids"],voice:["voice_provider","voice_model","voice_id","voice_speed","first_message"],capabilities:M.map(i=>i.formKey),instructions:["scheduling_policy","office_policies","custom_instructions"]},Z=m({}),L=()=>{Z.value=JSON.parse(JSON.stringify(e.value))},z=i=>{const t=e.value[i],s=Z.value[i];return Array.isArray(t)||Array.isArray(s)?!he(t||[],s||[]):t!==s},N=i=>(f[i]||[]).some(z),P=_(()=>N(p.value)),O=i=>{if(i!==p.value){if(l.isEditing&&P.value){T("Please save your changes before switching tabs");return}p.value=i}},se=[{value:"fhir",label:"FHIR"},{value:"sikka",label:"Sikka"},{value:"ezderm",label:"Ezderm"},{value:"modmed",label:"ModMed"}],ee=je(),$=_(()=>l.templates.find(i=>i.id===e.value.template_id)??{}),y=_(()=>e.value.voice_provider||$.value.voice_provider||""),F=_(()=>We(y.value)),ae=_(()=>Fe(y.value)),j=_(()=>{const i=$.value,t=y.value===i.voice_provider,s=(g,q,Ae)=>q?`Template default (${g.find(Ce=>Ce.value===q)?.name||q})`:Ae;return{provider:s(ee,i.voice_provider,"Select provider"),voice:s(ae.value,t&&i.voice_id,"Select voice"),model:s(F.value,t&&i.voice_model,"Select model")}}),w=_(()=>qe(y.value)),le=()=>{const i=be(y.value,$.value.voice_settings);e.value.voice_speed=e.value.voice_speed===null?i??w.value.normal:null},u=()=>Re(y.value,l.assistant?.voice_settings,e.value.voice_speed),r=m(""),c=m(!1),I=m(!1),R=m(!1),ue=_(()=>e.value.assistant_type?l.templates.filter(i=>i.assistant_type===e.value.assistant_type):[]),ie=m([]),ne=m(!1),he=(i,t)=>{if(i.length!==t.length)return!1;const s=new Set(i);return t.every(g=>s.has(g))},ke=(i,t)=>{t?e.value.knowledge_base_ids.includes(i)||(e.value.knowledge_base_ids=[...e.value.knowledge_base_ids,i]):e.value.knowledge_base_ids=e.value.knowledge_base_ids.filter(s=>s!==i)},xe=async()=>
1{if(R.value=!0,I.value=!1,l.isEditing&&l.assistant){const i=l.templates.find(s=>s.id===l.assistant.template_id);let t=[];ne.value=!0;try{t=await Xe(l.assistant.id)}catch(s){console.warn("Failed to load assistant knowledge bases:",s)}finally{ne.value=!1}ie.value=[...t],e.value={name:l.assistant.name,assistant_type:i?.assistant_type||"",template_id:l.assistant.template_id||"",organization_id:l.organizationId,knowledge_base_ids:t,enableToolMessages:l.assistant.enable_tool_messages??!0,voice_provider:l.assistant.voice_provider||"",voice_model:l.assistant.voice_model||"",voice_id:l.assistant.voice_id||"",voice_speed:be(l.assistant.voice_provider||i?.voice_provider||"",l.assistant.voice_settings),first_message:l.assistant.first_message||"",schedulingEnabled:l.assistant.scheduling_enabled??!0,bookingEnabled:l.assistant.booking_enabled??!0,cancelEnabled:l.assistant.cancel_enabled??!0,confirmEnabled:l.assistant.confirm_enabled??!0,transferEnabled:l.assistant.transfer_enabled??!0,intakeEnabled:l.assistant.intake_enabled??!0,messagesEnabled:l.assistant.messages_enabled??!0,billingEnabled:l.assistant.billing_enabled??!0,profileEnabled:l.assistant.profile_enabled??!0,locationEnabled:l.assistant.location_enabled??!0,sendLinksEnabled:l.assistant.send_links_enabled??!1,pharmacyEnabled:l.assistant.pharmacy_enabled??!1,refillsEnabled:l.assistant.refills_enabled??!0,waitlistEnabled:l.assistant.waitlist_enabled??!1,scheduling_policy:l.assistant.scheduling_policy||"",office_policies:l.assistant.office_policies||"",custom_instructions:l.assistant.custom_instructions||""},p.value="settings",r.value=l.assistant.voice_id||""}else ie.value=[],e.value={name:"",assistant_type:"",template_id:"",organization_id:l.organizationId,knowledge_base_ids:[],enableToolMessages:!0,voice_provider:"",voice_model:"",voice_id:"",voice_speed:null,first_message:"",schedulingEnabled:!0,bookingEnabled:!0,cancelEnabled:!0,confirmEnabled:!0,transferEnabled:!0,intakeEnabled:!0,messagesEnabled:!0,billingEnabled:!0,profileEnabled:!0,locationEnabled:!0,sendLinksEnabled:!1,pharmacyEnabled:!1,refillsEnabled:!0,waitlistEnabled:!1,scheduling_policy:"",office_policies:"",custom_instructions:""},p.value="settings",r.value="";L(),await Se(),R.value=!1},we=_(()=>{if(l.isEditing)return!!e.value.template_id;const i=e.value.knowledge_base_ids.length>0;return!!e.value.name&&!!e.value.template_id&&i}),te=()=>{x("update:modelValue",!1),x("close")},Ee=async()=>{try{if(c.value=!0,l.isEditing&&l.assistant)p.value==="knowledge"?(await Ge(l.assistant.id,e.value.knowledge_base_ids),ie.value=[...e.value.knowledge_base_ids]):await Ye(l.assistant.id,{voice_provider:e.value.voice_provider||null,voice_model:e.value.voice_model||null,voice_id:e.value.voice_id||null,voice_settings:u(),first_message:e.value.first_message||null,scheduling_enabled:e.value.schedulingEnabled,booking_enabled:e.value.bookingEnabled,cancel_enabled:e.value.cancelEnabled,confirm_enabled:e.value.confirmEnabled,transfer_enabled:e.value.transferEnabled,intake_enabled:e.value.intakeEnabled,messages_enabled:e.value.messagesEnabled,billing_enabled:e.value.billingEnabled,profile_enabled:e.value.profileEnabled,location_enabled:e.value.locationEnabled,send_links_enabled:e.value.sendLinksEnabled,pharmacy_enabled:e.value.pharmacyEnabled,refills_enabled:e.value.refillsEnabled,waitlist_enabled:e.value.waitlistEnabled,scheduling_policy:e.value.scheduling_policy||null,office_policies:e.value.office_policies||null,custom_instructions:e.value.custom_instructions||null}),L(),I.value=!0,A("Changes saved"),x("saved");else{const i={...e.value,enable_tool_messages:e.value.enableToolMessages,scheduling_enabled:e.value.schedulingEnabled,booking_enabled:e.value.bookingEnabled,cancel_enabled:e.value.cancelEnabled,confirm_enabled:e.value.confirmEnabled,transfer_enabled:e.value.transferEnabled,intake_enabled:e.value.intakeEnabled,messages_enabled:e.value.messagesEnabled,billing_enabled:e.value.billingEnabled,profile_enabled:e.value.profileEnabled,location_enabled:e.value.locationEnabled,send_links_enabled:e.value.sendLinksEnabled,pharmacy_enabled:e.value.pharmacyEnabled,refills_enabled:e.value.refillsEnabled,waitlist_enabled:e.value.waitlistEnabled,voice_provider:e.value.voice_provider||null,voice_model:e.value.voice_model||null,voice_id:e.value.voice_id||null,voice_settings:u(),first_message:e.value.first_message||null,scheduling_policy:e.value.scheduling_policy||null,office_policies:e.value.office_policies||null,custom_instructions:e.value.custom_instructions||null};await Qe({...i,knowledge_base_ids:e.value.knowledge_base_ids},l.organizationId),A("Assistant created successfully"),te(),x("saved")}}catch(i){console.error("Error saving assistant:",i),K("Error saving assistant")}finally{c.value=!1}};return G(()=>e.value.assistant_type,(i,t)=>{!R.value&&t!==void 0&&i!==t&&(e.value.template_id="")}),G(()=>e.value.template_id,(i,t)=>{if(!R.value&&t!==void 0&&i!==t&&i){const s=l.templates.find(g=>g.id===i);s&&(e.value.voice_provider=s.voice_provider||"",e.value.voice_model=s.voice_model||"",e.value.voice_id=s.voice_id||"",e.value.first_message=s.first_message||"",r.value=s.voice_id||"")}}),G(()=>e.value.voice_provider,(i,t)=>{!R.value&&t!==void 0&&i!==t&&(e.value.voice_model="",e.value.voice_id="",e.value.voice_speed=null,r.value="")}
1),G(()=>r.value,i=>{R.value||(e.value.voice_id=i)}),G(()=>l.modelValue,i=>{i&&xe()},{immediate:!0}),(i,t)=>(n(),de(Ke,{to:"body"},[v.modelValue?(n(),o("div",ta,[a("div",sa,[a("div",la,[a("div",ia,[a("h3",na,d(v.isEditing?"Edit Assistant":"Add Assistant"),1),a("button",{type:"button",class:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white",onClick:te},[V(h(Ie),{class:"w-3 h-3","aria-hidden":"true"}),t[18]||(t[18]=a("span",{class:"sr-only"},"Close modal",-1))])]),a("div",ra,[a("ul",oa,[a("li",da,[a("button",{type:"button",class:U(["inline-block px-3 py-2 rounded-t-lg border-b-2 transition-colors",p.value==="settings"?"text-primary-600 border-primary-600 dark:text-primary-400 dark:border-primary-400":"text-gray-500 border-transparent hover:text-gray-600 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"]),onClick:t[0]||(t[0]=s=>O("settings"))}," Settings ",2)]),a("li",ua,[a("button",{type:"button",class:U(["inline-block px-3 py-2 rounded-t-lg border-b-2 transition-colors",p.value==="capabilities"?"text-primary-600 border-primary-600 dark:text-primary-400 dark:border-primary-400":"text-gray-500 border-transparent hover:text-gray-600 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"]),onClick:t[1]||(t[1]=s=>O("capabilities"))}," Capabilities ",2)]),a("li",ca,[a("button",{type:"button",class:U(["inline-block px-3 py-2 rounded-t-lg border-b-2 transition-colors",p.value==="knowledge"?"text-primary-600 border-primary-600 dark:text-primary-400 dark:border-primary-400":"text-gray-500 border-transparent hover:text-gray-600 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"]),onClick:t[2]||(t[2]=s=>O("knowledge"))}," Knowledge ",2)]),a("li",va,[a("button",{type:"button",class:U(["inline-block px-3 py-2 rounded-t-lg border-b-2 transition-colors",p.value==="voice"?"text-primary-600 border-primary-600 dark:text-primary-400 dark:border-primary-400":"text-gray-500 border-transparent hover:text-gray-600 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"]),onClick:t[3]||(t[3]=s=>O("voice"))}," Voice ",2)]),a("li",null,[a("button",{type:"button",class:U(["inline-block px-3 py-2 rounded-t-lg border-b-2 transition-colors",p.value==="instructions"?"text-primary-600 border-primary-600 dark:text-primary-400 dark:border-primary-400":"text-gray-500 border-transparent hover:text-gray-600 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"]),onClick:t[4]||(t[4]=s=>O("instructions"))}," Instructions ",2)])])]),b(a("div",ba,[v.isEditing?(n(),o("div",pa,[V(h(Te),{class:"h-4 w-4 mt-0.5 flex-shrink-0","aria-hidden":"true"}),t[19]||(t[19]=a("span",null," These settings are locked after creation. Knowledge, Voice, Capabilities, and Instructions can still be edited in their tabs. ",-1))])):E("",!0),a("div",ma,[a("div",null,[t[20]||(t[20]=a("label",{for:"name",class:"form-label mb-1"},[Y(" Name "),a("span",{class:"text-red-500"},"*")],-1)),b(a("input",{id:"name","onUpdate:modelValue":t[5]||(t[5]=s=>e.value.name=s),type:"text",class:"form-input",disabled:v.isEditing,placeholder:"Assistant name","data-1p-ignore":"",required:""},null,8,ga),[[D,e.value.name]])]),a("div",null,[t[22]||(t[22]=a("label",{for:"assistant_type",class:"form-label mb-1"},[Y("PMS Connector "),a("span",{class:"text-red-500"},"*")],-1)),b(a("select",{id:"assistant_type","onUpdate:modelValue":t[6]||(t[6]=s=>e.value.assistant_type=s),class:"form-select",disabled:v.isEditing,required:""},[t[21]||(t[21]=a("option",{value:""},"Select PMS Connector",-1)),(n(),o(S,null,C(se,s=>a("option",{key:s.value,value:s.value},d(s.label),9,ya)),64))],8,fa),[[H,e.value.assistant_type]])]),a("div",null,[t[23]||(t[23]=a("label",{for:"template",class:"form-label mb-1"},[Y("AI Agent "),a("span",{class:"text-red-500"},"*")],-1)),b(a("select",{id:"template","onUpdate:modelValue":t[7]||(t[7]=s=>e.value.template_id=s),class:"form-select",disabled:v.isEditing||!e.value.assistant_type,required:""},[a("option",ha,d(e.value.assistant_type?"Select an AI Agent":"Select PMS Connector first"),1),(n(!0),o(S,null,C(ue.value,s=>(n(),o("option",{key:s.id,value:s.id},d(s.name),9,ka))),128)),e.value.assistant_type&&ue.value.length===0?(n(),o("option",xa," No AI agents available for this type ")):E("",!0)],8,_a),[[H,e.value.template_id]])])]),a("div",wa,[t[25]||(t[25]=a("label",{class:"form-label mb-1"},"Options",-1)),a("div",Ea,[b(a("input",{id:"enable_tool_messages","onUpdate:modelValue":t[8]||(t[8]=s=>e.value.enableToolMessages=s),type:"checkbox",class:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dar
1k:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600",disabled:v.isEditing},null,8,Aa),[[re,e.value.enableToolMessages]]),t[24]||(t[24]=a("label",{for:"enable_tool_messages",class:"ms-2 text-xs font-medium text-gray-900 dark:text-white"}," Enable Tool Messages ",-1))])])],512),[[W,p.value==="settings"]]),b(a("div",Ca,[a("div",null,[t[26]||(t[26]=a("label",{class:"form-label mb-1"},[Y(" Knowledge Bases "),a("span",{class:"text-red-500"},"*")],-1)),v.knowledgeBases&&v.knowledgeBases.length>0?(n(),o("div",Sa,[(n(!0),o(S,null,C(v.knowledgeBases,s=>(n(),o("label",{key:s.id,class:"flex items-start gap-2 text-xs text-gray-900 dark:text-white cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-600 rounded px-1 py-0.5"},[a("input",{type:"checkbox",value:s.id,checked:e.value.knowledge_base_ids.includes(s.id),class:"mt-0.5 w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500",onChange:g=>ke(s.id,g.target.checked)},null,40,Va),a("span",Ka,[a("span",La,d(s.name),1),s.description?(n(),o("span",{key:0,class:"block text-xs text-gray-500 dark:text-gray-400 truncate",title:s.description},d(s.description),9,Ia)):(n(),o("span",Ta," No description — needed to route between KBs when more than one is selected. "))])]))),128))])):(n(),o("div",Ma," No knowledge bases available ")),t[27]||(t[27]=a("p",{class:"text-xs text-gray-500 dark:text-gray-400 mt-1"}," Select one or more. With multiple, each KB's description is what the voice agent uses to pick which one to search per question — write specific descriptions. ",-1))])],512),[[W,p.value==="knowledge"]]),b(a("div",Ba,[a("div",null,[t[28]||(t[28]=a("label",{for:"voice_provider",class:"form-label"},"Voice Provider",-1)),b(a("select",{id:"voice_provider","onUpdate:modelValue":t[9]||(t[9]=s=>e.value.voice_provider=s),class:"form-select"},[a("option",za,d(j.value.provider),1),(n(!0),o(S,null,C(h(ee),s=>(n(),o("option",{key:s.value,value:s.value},d(s.name),9,Pa))),128))],512),[[H,e.value.voice_provider]])]),a("div",null,[t[29]||(t[29]=a("label",{for:"voice_selection",class:"form-label"},"Voice",-1)),b(a("select",{id:"voice_selection","onUpdate:modelValue":t[10]||(t[10]=s=>r.value=s),class:"form-select",disabled:!y.value},[a("option",$a,d(j.value.voice),1),(n(!0),o(S,null,C(ae.value,s=>(n(),o("option",{key:s.value,value:s.value},d(s.name),9,Ua))),128))],8,Oa),[[H,r.value]])]),F.value&&F.value.length>0?(n(),o("div",Da,[t[30]||(t[30]=a("label",{for:"voice_model",class:"form-label"},"Voice Model",-1)),b(a("select",{id:"voice_model","onUpdate:modelValue":t[11]||(t[11]=s=>e.value.voice_model=s),class:"form-select",disabled:!y.value},[a("option",Fa,d(j.value.model),1),(n(!0),o(S,null,C(F.value,s=>(n(),o("option",{key:s.value,value:s.value},d(s.name),9,ja))),128))],8,Na),[[H,e.value.voice_model]])])):E("",!0),a("div",null,[t[31]||(t[31]=a("label",{for:"voice_id",class:"form-label"},"Voice ID",-1)),b(a("input",{id:"voice_id","onUpdate:modelValue":t[12]||(t[12]=s=>e.value.voice_id=s),type:"text",class:"form-input",disabled:!y.value,placeholder:"Custom ID (optional)"},null,8,Ra),[[D,e.value.voice_id]])]),w.value?(n(),o("div",qa,[t[32]||(t[32]=a("label",{for:"voice_speed",class:"form-label"},"Speaking Speed",-1)),a("div",Wa,[b(a("input",{id:"voice_speed","onUpdate:modelValue":t[13]||(t[13]=s=>e.value.voice_speed=s),type:"range",class:"flex-1 accent-primary-600",min:w.value.min,max:w.value.max,step:w.value.step,disabled:e.value.voice_speed===null},null,8,Ga),[[D,e.value.voice_speed,void 0,{number:!0}]]),a("span",Ha,d(e.value.voice_speed===null?"—":e.value.voice_speed.toFixed(2)),1),a("button",{type:"button",class:"shrink-0 text-xs text-primary-600 hover:underline dark:text-primary-400",onClick:le},d(e.value.voice_speed===null?"Override":"Reset"),1)]),a("p",Ja,d(w.value.normal.toFixed(1))+" is normal; "+d(w.value.min)+"–"+d(w.value.max)+" allowed. Unset inherits the template. ",1)])):E("",!0),a("div",Ya,[t[33]||(t[33]=a("label",{for:"first_message",class:"form-label"},"First Message",-1)),b(a("textarea",{id:"first_message","onUpdate:modelValue":t[14]||(t[14]=s=>e.value.first_message=s),class:"form-input",rows:"2",placeholder:"Leave empty for template default"},null,512),[[D,e.value.first_message]])])],512),[[W,p.value==="voice"]]),b(a("div",Xa,[a("div",Qa,[t[34]||(t[34]=a("p",{class:"text-xs text-gray-500 dark:text-gray-400"},"Turn off any task you don't want this assistant to handle. Hover a row for details.",-1)),a("span",Za,d(B.value)+" / "+d(h(M).length)+" on",1)]),a("div",et,[(n(!0),o(S,null,C(h(Q),s=>(n(),o("div",{key:s.formKey,class:"space-y-1"},[a("label",{for:s.column,title:s.description,class:U(["flex items-center justify-between gap-2 py-1.5 px-2.5 rounded-md border cursor-pointer transition-colors",e.value[s.formKey]?"border-blue-300 bg-blue-50/60 dark:border-blue-500/40 dark:bg-blue-900/10":"border-gray-200 bg-white hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-800/40 dark:hover:bg-gray-800"])},[a("span",tt,d(s.label),1),a("span",st,[b(a("input",{id:s.column,"onUpdate:modelValue":g=>e.value[s.formKey]=g,type:"checkbox",class:"peer sr-only"},null,8,lt),[[re,e.value[s.formKey]]]),t[35]||(t[35]=a("span",{class:"h-5 w-9 rounded-full bg-gray-300 transition-colors peer-checked:bg-blue-600 peer-focus-visible:ring-2 peer-focus-visible:ring-blue-500 peer-focus-visible:ring-offset-2 dark:bg-gray-600 dark:peer-focus-visible:ring-offset-gray-800"},null,-1)),t[36]||(t[36]=a("span",{class:"absolute left-0.5 h-4 w-4 roun
1ded-full bg-white shadow transition-transform peer-checked:translate-x-4"},null,-1))])],10,at),(n(!0),o(S,null,C(s.children,g=>(n(),o("label",{key:g.formKey,for:g.column,title:g.description,class:U(["ml-5 flex items-center justify-between gap-2 py-1 px-2.5 rounded-md border transition-colors",[e.value[s.formKey]?"cursor-pointer":"cursor-not-allowed opacity-50",e.value[s.formKey]&&e.value[g.formKey]?"border-blue-200 bg-blue-50/40 dark:border-blue-500/30 dark:bg-blue-900/5":"border-gray-200 bg-white hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-800/40 dark:hover:bg-gray-800"]])},[a("span",nt,d(g.label),1),a("span",rt,[b(a("input",{id:g.column,"onUpdate:modelValue":q=>e.value[g.formKey]=q,type:"checkbox",disabled:!e.value[s.formKey],class:"peer sr-only"},null,8,ot),[[re,e.value[g.formKey]]]),t[37]||(t[37]=a("span",{class:"h-5 w-9 rounded-full bg-gray-300 transition-colors peer-checked:bg-blue-600 peer-focus-visible:ring-2 peer-focus-visible:ring-blue-500 peer-focus-visible:ring-offset-2 dark:bg-gray-600 dark:peer-focus-visible:ring-offset-gray-800"},null,-1)),t[38]||(t[38]=a("span",{class:"absolute left-0.5 h-4 w-4 rounded-full bg-white shadow transition-transform peer-checked:translate-x-4"},null,-1))])],10,it))),128))]))),128))])],512),[[W,p.value==="capabilities"]]),b(a("div",dt,[a("div",null,[t[39]||(t[39]=a("label",{for:"scheduling_policy",class:"form-label"},"Scheduling Policy",-1)),b(a("textarea",{id:"scheduling_policy","onUpdate:modelValue":t[15]||(t[15]=s=>e.value.scheduling_policy=s),class:"form-input",rows:"3",placeholder:"Define what types of appointments the AI can schedule (e.g., exams only, specific procedure codes)"},null,512),[[D,e.value.scheduling_policy]])]),a("div",null,[t[40]||(t[40]=a("label",{for:"office_policies",class:"form-label"},"Office Policies",-1)),b(a("textarea",{id:"office_policies","onUpdate:modelValue":t[16]||(t[16]=s=>e.value.office_policies=s),class:"form-input",rows:"3",placeholder:"Office-specific policies (e.g., cancellation policy, payment requirements)"},null,512),[[D,e.value.office_policies]])]),a("div",null,[t[41]||(t[41]=a("label",{for:"custom_instructions",class:"form-label"},"Custom Instructions",-1)),b(a("textarea",{id:"custom_instructions","onUpdate:modelValue":t[17]||(t[17]=s=>e.value.custom_instructions=s),class:"form-input",rows:"3",placeholder:"Additional instructions for the AI assistant"},null,512),[[D,e.value.custom_instructions]])])],512),[[W,p.value==="instructions"]]),a("div",ut,[a("button",{type:"button",class:"btn btn-secondary",onClick:te},d(I.value?"Close":"Cancel"),1),a("button",{type:"button",class:"btn btn-primary",disabled:c.value||ne.value||(v.isEditing?!P.value:!we.value),onClick:Ee},[c.value?(n(),de(Ue,{key:0,size:"small","custom-class":"text-white"})):E("",!0),Y(" "+d(c.value?"Saving...":"Save"),1)],8,ct)])])])])):E("",!0)]))}};ge(),me(),fe(),pe();var bt={class:"space-y-4"},pt={key:0,class:"rounded-lg border border-red-200 bg-red-50 dark:bg-red-900/20 dark:border-red-800/40 text-red-700 dark:text-red-300 p-4 text-sm"},mt={class:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between"},gt={class:"mt-0.5 text-sm text-gray-500 dark:text-gray-400"},ft={class:"text-xs font-medium text-gray-900 dark:text-white"},yt={class:"text-xs"},_t=["title"],ht={key:0,class:"inline-flex items-center rounded px-1.5 py-0.5 text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300"},kt={key:1,class:"text-xs text-gray-400 dark:text-gray-500"},xt={class:"text-xs"},wt=["onClick"],Et=["onClick"],At={key:1,class:"rounded-lg border border-dashed border-gray-300 dark:border-gray-700 p-12 text-center"},oe=4,Dt={__name:"OrganizationAssistants",setup(v){const{showSuccess:k,showError:l}=ye(),x=Oe(),A=Le(),K=m(null),T=m([]),M=m([]),Q=m([]),B=m(!0),e=m(!1),p=_(()=>!e.value),f=m(null),Z=[{field:"name",label:"Name"},{field:"template_id",label:"AI Agent"},{field:"capabilities",label:"Capabilities"},{field:"created_at",label:"Created"}],L=u=>X.filter(r=>_e(u,r)).map(r=>r.shortLabel),z=m(!1),N=m(!1),P=m(null),O=()=>{$()},se=()=>{P.value=null,N.value=!1},ee=async()=>{try{B.value=!0,f.value=null,A.user||await A.setUser();const u=A.user?.user_metadata?.organization_id;if(!u){console.error("Organization ID not available from user metadata"),f.value="Unable to load organization data. Please try again later.",B.value=!1,e.value=!0;return}K.value=u,await Promise.all([$(),y(),F()])}catch(u){console.error("Error initializing assistants data:",u),f.value="Failed to load assistants data",B.value=!1,e.value=!0}};Ve(()=>{ee()});const $=async()=>{try{B.value=!0,f.value=null;const{data:u}=await He(K.value);T.value=u||[]}catch(u){console.error("Error fetching assistants:",u),f.value="Failed to load assistants",l("Failed to load assistants")}finally{B.value=!1,e.value=!0}},y=async()=>{try{const{data:u}=await Ze(1,1e3,!1);M.value=u||[]}catch(u){console.error("Error fetching templates:",u),f.value="Failed to load templates"}},F=async()=>{try{const{knowledgeBases:u,error:r}=await ea(K.value,0,100);if(r)throw r;Q.value=u||[]}catch(u){console.error("Error fetching knowledge bases:",u)}},ae=u=>{if(!u)return null;const r=M.value.find(c=>c.id===u);return r?r.name:null},j=()=>{N.value=!1,P.value=null,z.value=!0},w=u=>{N.value=!0,P.value=u,z.value=!0},le=u=>{x.show({title:"Delete Assistant",message:`Are you sure you want to delete the assistant "${u.name}"?`,confirmText:"Yes, delete it",cancelText:"Cancel",variant:"danger",onConfirm:async()=>{try{await Je(u.id),k("Assistant deleted successfully"),await $()}catch(r){throw console.error("Error deleting assistant:",r),l("Failed to delete assistant"),r}}})};return(u,r)=>(n(),o("div",bt,[f.value?(n(),o("div",pt,d(f.value),1)):E("",!0),a("div",mt,[a("div",null,[r[1]||(r[1]=a("h2",{class:"text-lg font-semibold text-gray-900 dark:text-white"}
1,"Assistants",-1)),a("p",gt,d(T.value.length.toLocaleString())+" "+d(T.value.length===1?"assistant":"assistants"),1)]),a("button",{type:"button",class:"btn btn-primary",onClick:j},[V(h(ve),{class:"h-3.5 w-3.5"}),r[2]||(r[2]=a("span",null,"Add Assistant",-1))])]),V(Ne,{columns:Z,rows:T.value,loading:p.value,"row-clickable":!1},{"cell-name":J(({row:c})=>[a("span",ft,d(c.name||"Unnamed Assistant"),1)]),"cell-template_id":J(({row:c})=>[a("span",yt,d(ae(c.template_id)||"—"),1)]),"cell-capabilities":J(({row:c})=>[L(c).length?(n(),o("div",{key:0,class:"flex flex-wrap items-center gap-1",title:L(c).join(", ")},[(n(!0),o(S,null,C(L(c).slice(0,oe),I=>(n(),o("span",{key:I,class:"inline-flex items-center rounded px-1.5 py-0.5 text-xs font-medium bg-green-50 text-green-700 dark:bg-green-900/30 dark:text-green-400"},d(I),1))),128)),L(c).length>oe?(n(),o("span",ht,"+"+d(L(c).length-oe),1)):E("",!0)],8,_t)):(n(),o("span",kt,"None on"))]),"cell-created_at":J(({row:c})=>[a("span",xt,d(h(Pe)(c.created_at)),1)]),actions:J(({row:c})=>[a("button",{type:"button",title:"Edit assistant",class:"btn btn-ghost btn-xs",onClick:ce(I=>w(c),["stop"])},[V(h(Me),{class:"h-4 w-4"})],8,wt),a("button",{type:"button",title:"Delete assistant",class:"btn btn-ghost btn-xs text-red-600 hover:bg-red-50 hover:text-red-700 dark:text-red-400 dark:hover:bg-red-900/30",onClick:ce(I=>le(c),["stop"])},[V(h(ze),{class:"h-4 w-4"})],8,Et)]),_:1},8,["rows","loading"]),!p.value&&T.value.length===0&&!f.value?(n(),o("div",At,[V(h(Be),{class:"h-10 w-10 mx-auto text-gray-400"}),r[4]||(r[4]=a("h3",{class:"mt-3 text-base font-semibold text-gray-900 dark:text-white"}," No assistants yet ",-1)),r[5]||(r[5]=a("p",{class:"mt-1 text-sm text-gray-600 dark:text-gray-400 max-w-md mx-auto"}," Create an assistant for this organization to wire up AI agents to phone numbers. ",-1)),a("button",{type:"button",class:"mt-5 btn btn-primary",onClick:j},[V(h(ve),{class:"h-3.5 w-3.5"}),r[3]||(r[3]=a("span",null,"Add Assistant",-1))])])):E("",!0),z.value?(n(),de(vt,{key:2,modelValue:z.value,"onUpdate:modelValue":r[0]||(r[0]=c=>z.value=c),templates:M.value,"knowledge-bases":Q.value,"organization-id":K.value,assistant:P.value,"is-editing":N.value,onSaved:O,onClose:se},null,8,["modelValue","templates","knowledge-bases","organization-id","assistant","is-editing"])):E("",!0),V(De)]))}};export{Dt 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.