-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
}; | ||
``` |