Skip to content

Commit c866ef2

Browse files
authored
[widget] add attributes for worklet scripts (#399)
1 parent 7d44ce4 commit c866ef2

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

packages/convai-widget-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@elevenlabs/convai-widget-core",
3-
"version": "0.5.3",
3+
"version": "0.5.4",
44
"description": "The common library for the Conversational AI Widget.",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",

packages/convai-widget-core/src/contexts/session-config.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SessionConfig } from "@elevenlabs/client";
1+
import { SessionConfig, AudioWorkletConfig } from "@elevenlabs/client";
22
import { ReadonlySignal, useComputed } from "@preact/signals";
33
import { ComponentChildren } from "preact";
44
import { createContext } from "preact/compat";
@@ -59,6 +59,12 @@ export function SessionConfigProvider({
5959
return undefined;
6060
});
6161

62+
const rawAudioProcessor = useAttribute("worklet-path-raw-audio-processor");
63+
const audioConcatProcessor = useAttribute(
64+
"worklet-path-audio-concat-processor"
65+
);
66+
const libsamplerate = useAttribute("worklet-path-libsamplerate");
67+
6268
const { webSocketUrl } = useServerLocation();
6369
const agentId = useAttribute("agent-id");
6470
const signedUrl = useAttribute("signed-url");
@@ -72,7 +78,12 @@ export function SessionConfigProvider({
7278
connectionDelay: { default: 300 },
7379
textOnly: textOnly.value,
7480
userId: userId.value || undefined,
75-
};
81+
libsampleratePath: libsamplerate.value,
82+
workletPaths: {
83+
rawAudioProcessor: rawAudioProcessor.value,
84+
audioConcatProcessor: audioConcatProcessor.value,
85+
},
86+
} as const satisfies Partial<SessionConfig | AudioWorkletConfig>;
7687

7788
if (agentId.value) {
7889
if (isWebRTC) {

packages/convai-widget-core/src/types/attributes.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ export const CustomAttributeList = [
4040
"user-id",
4141
"use-rtc",
4242
"collect-feedback",
43+
"worklet-path-raw-audio-processor",
44+
"worklet-path-audio-concat-processor",
45+
"worklet-path-libsamplerate",
4346
] as const;
4447

4548
export type CustomAttributes = {

packages/convai-widget-embed/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@elevenlabs/convai-widget-embed",
3-
"version": "0.5.2",
3+
"version": "0.5.4",
44
"description": "The Conversational AI Widget bundled with all dependencies for easy embedding.",
55
"main": "./dist/index.js",
66
"unpkg": "./dist/index.js",

0 commit comments

Comments
 (0)