Remote chat messages missing attributes and attachedFiles when using useChat()
### Description
When sending a chat message using `useChat()` with an attachment, the **sender (local)** receives a message object that contains:
- `attachedFiles`
- `attributes` (if provided)
However, the receiver (remote) does not receive these fields at all.
They are completely missing, not even present as `undefined`.
Remote message object does not contain `attachedFiles` or `attributes` keys.
### Steps to Reproduce
Start two clients connected to the same LiveKit room.
In one client (sender), call:
```typescript
import { useChat } from '@livekit/components-react';
const { chatMessages, isSending, send } = useChat();
const handleSendMessage = async () => {
try {
setMessageText('');
await send(messageText, { attachments: [file] });
} catch {}
}
```
Log `chatMessages` from `useChat()` on both clients.
### Expected Behavior
Both the sender and receiver should receive identical message structure, including:
```typescript
{
message: "...",
attachedFiles: [...],
attributes: {...},
...
}
```
### Actual Behavior
Sender (local) message object includes both fields:
```typescript
{
message: "hello",
attachedFiles: [File],
attributes: { foo: "bar" },
...
}
```
Receiver (remote) message object does not include either field:
```typescript
{
message: "hello",
// attachedFiles → missing
// attributes → missing
...
}
```
Both fields are entirely absent from the remote message object.
### Code Snippet
```typescript
import { useChat } from '@livekit/components-react';
const { chatMessages, send } = useChat();
await send(messageText, {
attachments: [file] ,
attributes: { foo: 'bar' }
});
```
Logging messages:
`console.log(chatMessages);`
Remote logs show no `attachedFiles` or `attributes` properties at all.
### Describe the proposed solution
**Include `attachedFiles` and `attributes` in the chat message** so remote users receive the same structure.
### Alternatives considered
_No response_
### Importance
I cannot use LiveKit without it
### Additional Information
_No response_
关闭于 2026-02-06 3 条评论