Skip to content

Commit

Permalink
docs: v0.3 migration (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonom authored Jul 2, 2024
1 parent 7427b09 commit 4d13a90
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
7 changes: 7 additions & 0 deletions apps/www/pages/docs/migrations/_meta.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const meta = {
"v0.3": "Migration to v0.3",
"v0.2": "Migration to v0.2",
"v0.1": "Migration to v0.1",
};

export default meta;
50 changes: 50 additions & 0 deletions apps/www/pages/docs/migrations/v0.3.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
title: Migration to v0.3
---

## Changes to the `Thread.tsx` template

### Removal of `MessagePrimitive.InProgress`

Remove `MessagePrimitive.InProgress` from `Thread.tsx`.

```diff
const AssistantMessage = () => {
return (
<MessagePrimitive.Root>
...
- <MessagePrimitive.InProgress className="..." />
...
</MessagePrimitive.Root>
);
};
```

#### Custom loading indicator

In case you want a custom loading indicator (other than the dot), create a custom Text component and pass it to the `MessagePrimitive.Content` component.

```tsx {1,7,13-22}
import { ContentPartPrimitive } from "@assistant-ui/react";

const AssistantMessage = () => {
return (
<MessagePrimitive.Root>
...
<MessagePrimitive.Content components={{ Text }} />
...
</MessagePrimitive.Root>
);
};

const Text: FC = ({ children }) => {
return (
<ContentPartPrimitive.InProgress>
<ContentPartPrimitive.Text className="whitespace-pre-line">
{children}
</ContentPartPrimitive.Text>
<ContentPartPrimitive.InProgress>...</ContentPartPrimitive.InProgress>
</ContentPartPrimitive.InProgress>
);
};
```

0 comments on commit 4d13a90

Please sign in to comment.