components-js
components-js copied to clipboard
useDataChannel not sending messages to agent
Select which package(s) are affected
@livekit/components-react
Describe the bug
I am trying to pass previous text chat conversations as context to the agent and found on the docs only useDataChannel as the way to do pass context but it is not working.
Is this the intended use of the hook? is there another way to pass context or previous messages to voice agent?
Reproduction
ref usage:
const { send } = useDataChannel("chat", (msg) => { console.log(">> msg sent", msg);
});
useEffect(() => {
if (isAgentConnected) {
send(new TextEncoder().encode("my name is rodrigo"), {
// destinationIdentities: ["agent"],
});
}
}, [isAgentConnected]);
Logs
System Info
System:
OS: macOS 14.3.1
CPU: (12) arm64 Apple M2 Pro
Memory: 136.95 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
Yarn: 1.22.21 - /opt/homebrew/bin/yarn
npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
pnpm: 9.5.0 - ~/.nvm/versions/node/v20.11.1/bin/pnpm
bun: 1.0.30 - ~/.bun/bin/bun
Watchman: 2024.10.14.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 134.0.6998.166
Safari: 17.3.1
Severity
blocking all usage of LiveKit
Additional Information
No response
the easiest way to send chat messages to the agent is to use the send method of the useChat hook!