@chatpanel/gateway 0.121.5 → 0.133.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/native/darwin-arm64/chatpanel-apple-model +0 -0
- package/package.json +2 -2
- package/src/capabilities.js +1 -1
- package/src/capability-config.js +1 -0
- package/src/capability-proxy.js +1 -1
- package/src/configstore.js +1 -1
- package/src/egress.js +2 -2
- package/src/engine-tunings.js +1 -1
- package/src/gguf-meta.js +1 -0
- package/src/inference-engines.js +1 -1
- package/src/kb.js +2 -2
- package/src/llama-arch.js +1 -0
- package/src/llama-builds.js +1 -0
- package/src/model-pull.js +1 -1
- package/src/providers.js +1 -1
- package/src/router.js +1 -1
- package/src/runtime.js +6 -6
- package/src/server.js +22 -22
- package/src/transfer-rate.js +1 -0
- package/src/tts-remote.js +1 -1
- package/src/version.js +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const h=1e4,f=1e3;function S({total:u=0}={}){let t=[];return(a,{now:l=Date.now(),skipped:M=!1,total:s=u}={})=>{(M||t.length&&a<t.at(-1).bytes)&&(t=[]);const e=t.at(-1);for((!e||l-e.at>=1e3)&&t.push({at:l,bytes:a});t.length>2&&l-t[0].at>1e4;)t.shift();const r=t[0],o=(l-r.at)/1e3,n=o>=1?Math.max(0,(a-r.bytes)/o):null,c=n&&s>a?Math.round((s-a)/n):n&&s?0:null;return{rate:n===null?null:Math.round(n),etaS:c}}}export{S as transferRate};
|
package/src/tts-remote.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{secureFetch as k}from"./secure-fetch.js";import{redactSegments as w,segment as S}from"./redact.js";const
|
|
1
|
+
import{secureFetch as k}from"./secure-fetch.js";import{redactSegments as w,segment as S}from"./redact.js";import{primaryProvider as $}from"./capability-config.js";const _=["local","openai","elevenlabs"];function b(e){return _.includes(String(e||""))}function E(e={}){const r=e.tts||{},t=$(e.capabilities?.tts,"tts");if(t&&typeof t=="object"){if(t.provider==="embedded")return null;const n=t.adapter||"openai";if(t.url&&b(n)){const c=r.remote||{};return{kind:n,baseUrl:String(t.url).replace(/\/+$/,""),model:t.model||c.model||(n==="elevenlabs"?"eleven_multilingual_v2":"tts-1"),voice:c.voice||(n==="elevenlabs"?"21m00Tcm4TlvDq8ikWAM":"alloy"),redact:t.redact!==!1,token:t.token||""}}}const i=r.provider||"local";if(i==="local"||!b(i))return null;const a=r.remote||{};return{kind:i,baseUrl:String(a.baseUrl||(i==="elevenlabs"?"https://api.elevenlabs.io/v1":"https://api.openai.com/v1")).replace(/\/+$/,""),model:a.model||(i==="elevenlabs"?"eleven_multilingual_v2":"tts-1"),voice:a.voice||(i==="elevenlabs"?"21m00Tcm4TlvDq8ikWAM":"alloy"),redact:a.redact!==!1}}function U(e){return/^[A-Za-z0-9_-]{1,64}$/.test(String(e||""))}async function V({dest:e,text:r,voice:t,speed:i=1,auth:a,redaction:n,isPro:c=!0,onEgress:h=null,fetchImpl:y=null}={}){const l=a||e?.token||"";if(!e)throw new Error("no remote TTS destination configured");const u=t||e.voice;if(!U(u))throw new Error(`invalid remote voice id: ${u}`);let m=String(r),v=0;if(e.redact&&n){const o={text:m},T=await w([S(()=>o.text,g=>{o.text=g})],n,{isPro:c,onEgress:h});m=o.text,v=T?.count||0}const x=y||k,d={"Content-Type":"application/json"};let p,f;if(e.kind==="elevenlabs"){p=`${e.baseUrl}/text-to-speech/${encodeURIComponent(u)}`,f={text:m,model_id:e.model};const o=B(l);o&&(d["xi-api-key"]=o)}else p=`${e.baseUrl}/audio/speech`,f={model:e.model,input:m,voice:u,response_format:"wav",speed:i},l&&(d.Authorization=l.startsWith("Bearer ")?l:`Bearer ${l}`);const s=await x(p,{method:"POST",headers:d,body:JSON.stringify(f)});if(!s.ok){let o=`HTTP ${s.status}`;try{o=(await s.text()).slice(0,300)||o}catch{}throw new Error(`remote tts failed: ${o}`)}return{audio:Buffer.from(await s.arrayBuffer()),contentType:s.headers.get("content-type")||"audio/mpeg",redacted:v}}function B(e){const r=String(e||"").trim();return r.toLowerCase().startsWith("bearer ")?r.slice(7).trim():r}export{_ as TTS_PROVIDERS,U as isValidRemoteVoice,b as isValidTtsProvider,V as synthesizeRemote,E as ttsDestination};
|
package/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const o="0.
|
|
1
|
+
const o="0.133.3";export{o as VERSION};
|