PageSourceSearch

https://telenow.ai/assets/AdminTtsModelsPage-HBzQSpHY.js

js telenow.ai collected 2026-10-05 13:58:20 UTC 8,876 bytes, 1 lines download raw bytes

1import{i as K,j as e}from"./react-vendor-Dv2rzRgw.js";import{nq as E,np as P,nn as N,mh as m,f7 as y,cF as $,dc as S,cE as w,db as T,cQ as I,cP as O,bn as U,bb as R,e2 as i,bC as A,c9 as L,fw as F}from"./index-Pg-MI9ur.js";import{d as o,C as v}from"./CatalogEnableToggle-CVLQkfCi.js";import{P as q}from"./pencil-Dds4KNkE.js";const D={tts:"Price $/1M chars",stt:"Price $/min"};function G(){var f,g;const h=E(),x=P({queryKey:["admin","catalog"],queryFn:()=>F(!0)}),k=((f=x.data)==null?void 0:f.tts)??[],C=((g=x.data)==null?void 0:g.stt)??[],[t,n]=K.useState(null),u=()=>{h.invalidateQueries({queryKey:["admin","catalog"]}),h.invalidateQueries({queryKey:["catalog"]})},p=N({mutationFn:async s=>{const r=s.price===""?null:Number(s.price);if(s.kind==="tts"){const d={providerId:s.providerId,modelKey:s.modelKey.trim(),name:s.name.trim(),configKey:s.configKey.trim()||"model",perMillionCharsUsd:r,sortOrder:Number(s.sortOrder)||0,recommended:s.recommended};return s.mode==="create"?$(d):S(d)}const a={providerId:s.providerId,modelKey:s.modelKey.trim(),name:s.name.trim(),configKey:s.configKey.trim()||"model",perMinuteUsd:r,sortOrder:Number(s.sortOrder)||0,recommended:s.recommended};return s.mode==="create"?w(a):T(a)},onSuccess:()=>{u(),n(null),m.success("Model saved")},onError:s=>m.error(y(s))}),b=N({mutationFn:({kind:s,providerId:r,modelKey:a})=>s==="tts"?I(r,a):O(r,a),onSuccess:()=>{u(),m.success("Model removed")},onError:s=>m.error(y(s))}),M=(s,r,a)=>n({kind:s,mode:"create",providerId:r,providerName:a,modelKey:"",name:"",configKey:"model",price:"",sortOrder:"0",recommended:!1}),j=(s,r)=>r.map(a=>{const d=s==="tts"?a.perMillionCharsUsd:a.perMinuteUsd;return e.jsxs("div",{className:"card overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-slate-200 px-4 py-2",children:[e.jsxs("div",{className:i(o(a.enabled)),children:[e.jsx("span",{className:"text-sm font-semibold text-slate-800",children:a.name}),e.jsx("span",{className:"ml-2 font-mono text-[11px] text-slate-400",children:a.id}),e.jsxs("span",{className:"ml-2 text-[11px] text-slate-400",children:["provider fallback: ",d!=null?`$${d}${s==="tts"?"/1M chars":"/min"}`:"unpriced"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(v,{kind:s,providerId:a.id,enabled:a.enabled,label:a.name}),e.jsxs("button",{className:"btn-secondary",onClick:()=>M(s,a.id,a.name),children:[e.jsx(A,{size:14})," Add model"]})]})]}),e.jsxs("table",{className:"min-w-full divide-y divide-slate-200 text-sm",children:[e.jsx("thead",{className:"bg-slate-50 text-xs uppercase tracking-wide text-slate-500",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2 text-left",children:"Model"}),e.jsx("th",{className:"px-4 py-2 text-left",children:"Offered"}),e.jsx("th",{className:"px-4 py-2 text-left",children:"Config field"}),e.jsx("th",{className:"px-4 py-2 text-left",children:s==="tts"?"$/1M chars":"$/min"}),e.jsx("th",{className:"px-4 py-2 text-left",children:"Rec."}),e.jsx("th",{className:"px-4 py-2"})]})}),e.jsxs("tbody",{className:"divide-y divide-slate-100",children:[(!a.models||a.models.length===0)&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-3 text-xs text-slate-400",children:"No models yet — calls rate at the provider fallback."})}),(a.models??[]).map(l=>{const c=s==="tts"?l.perMillionCharsUsd:l.perMinuteUsd;return e.jsxs("tr",{className:"hover:bg-slate-50",children:[e.jsxs("td",{className:i("px-4 py-2",o(l.enabled)),children:[e.jsx("div",{className:"text-slate-800",children:l.name}),e.jsx("div",{className:"font-mono text-[11px] text-slate-400",children:l.key})]}),e.jsx("td",{className:"px-4 py-2",children:e.jsx(v,{kind:s,providerId:a.id,modelKey:l.key,enabled:l.enabled,label:l.name})}),e.jsx("td",{className:i("px-4 py-2 font-mono text-slate-600",o(l.enabled)),children:l.configKey}),e.jsx("td",{className:i("px-4 py-2 text-slate-600",o(l.enabled)),children:c!=null?`$${c}`:e.jsx("span",{className:"text-slate-400",title:"Inherits the provider fallback",children:"inherit"})}),e.jsx("td",{className:i("px-4 py-2",o(l.enabled)),children:l.recommended?e.jsx("span",{className:"rounded bg-emerald-100 px-1.5 py-0.5 text-[11px] font-semibold text-emerald-700",children:"Rec"}):e.jsx("span",{className:"text-slate-300",children:"—"})}),e.jsx("td",{className:"px-4 py-2 text-right",children:e.jsxs("div",{className:"inline-flex gap-1",children:[e.jsx("button",{className:"btn-ghost p-1",title:"Edit",onClick:()=>n({kind:s,mode:"edit",providerId:a.id,providerName:a.name,modelKey:l.key,name:l.name,configKey:l.configKey,price:c!=null?String(c):"",sortOrder:"0",recommended:!!l.recommended}),children:e.jsx(q,{size:14})}),e.jsx("button",{className:"btn-ghost p-1 text-rose-600",title:"Delete",disabled:b.isPending,onClick:()=>{confirm(`Remove model "${l.name}"?`)&&b.mutate({kind:s,providerId:a.id,modelKey:l.key})},children:e.jsx(L,{size:14})})]})})]},l.key)})]})]})]},`${s}:${a.id}`)});return e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold text-slate-900",children:"Voice models (TTS + STT)"}),e.jsxs("p",{className:"text-sm text-slate-500",children:["Model options offered per provider in the agent builder, with the MODEL-level price the billing rater uses (vendors price per model — ElevenLabs Flash ≠ Multilingual, Aura-1 ≠ Aura-2). A blank price inherits the provider fallback. The model id is the value sent to the provider; “config field” is which agent setting it drives — usually"," ",e.jsx("span",{className:"font-mono",children:"model"}),", ",e.jsx("span",{className:"font-mono",children:"modelId"})," for ElevenLabs, ",e.jsx("span",{className:"font-mono",children:"engine"})," for Polly."]}),e.jsx("p",{className:"mt-1 text-sm text-slate-500",children:"Each switch controls whether that provider or model is offered in the agent builder. Turning one off keeps its price and rate history, and does not interrupt agents already running on it — a switched-off PROVIDER hides all of its models regardless of theirs."})]}),x.isLoading?e.jsx(U,{}):e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-slate-500",children:"Text to speech"}),j("tts",k),e.jsx("h2",{className:"pt-2 text-sm font-semibold uppercase tracking-wide text-slate-500",children:"Speech to text"}),j("stt",C)]}),t&&e.jsx(R,{open:!0,onClose:()=>n(null),title:t.mode==="create"?`Add ${t.kind.toUpperCase()} model · ${t.providerName}`:`Edit ${t.kind.toUpperCase()} model · ${t.providerName}`,footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn-secondary",onClick:()=>n(null),children:"Cancel"}),e.jsx("button",{className:"btn-primary",disabled:p.isPending||!t.modelKey.trim()||!t.name.trim(),onClick:()=>p.mutate(t),children:p.isPending?"Saving…":"Save"})]}),children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"label",children:"Model id (sent to the provider)"}),e.jsx("input",{className:"input font-mono",value:t.modelKey,disabled:t.mode==="edit",placeholder:t.kind==="tts"?"bulbul:v2":"nova-3",onChange:s=>n({...t,modelKey:s.target.value})})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"label",children:"Display name"}),e.jsx("input",{className:"input",value:t.name,placeholder:t.kind==="tts"?"Bulbul v2":"Nova 3",onChange:s=>n({...t,name:s.target.value})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"label",children:"Config field"}),e.jsx("input",{className:"input font-mono",value:t.configKey,placeholder:"model",onChange:s=>n({...t,configKey:s.target.value})}),e.jsx("span",{className:"mt-0.5 block text-[10px] text-slate-400",children:"Usually “model”; “modelId” for ElevenLabs; “engine” for Polly."})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"label",children:D[t.kind]}),e.jsx("input",{className:"input",type:"number",step:t.kind==="tts"?"1":"0.0001",value:t.price,placeholder:"blank = provider fallback",onChange:s=>n({...t,price:s.target.value})})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"label",children:"Sort order"}),e.jsx("input",{className:"input",type:"number",value:t.sortOrder,onChange:s=>n({...t,sortOrder:s.target.value})})]})]}),e.jsxs("label",{className:"flex items-start gap-2",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:t.recommended,onChange:s=>n({...t,recommended:s.target.checked})}),e.jsxs("span",{children:[e.jsx("span",{className:"label !mb-0",children:"Recommended"}),e.jsx("span",{className:"block text-xs text-slate-500",children:"Badges this model in the agent builder and floats it to the top, ahead of sort order."})]})]})]})})]})}export{G as AdminTtsModelsPage};

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.