Skip to content

Commit

Permalink
docs: add examples tab (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonom authored Jun 20, 2024
1 parent c23e9ba commit b33d7f5
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 8 deletions.
2 changes: 1 addition & 1 deletion apps/www/components/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function Home() {

<div className="mb-8 flex justify-center gap-2">
<Button asChild>
<Link href="/onboarding">Get Started</Link>
<Link href="/docs/getting-started">Get Started</Link>
</Button>
</div>
<div className="mx-auto flex w-full max-w-screen-xl flex-col">
Expand Down
7 changes: 7 additions & 0 deletions apps/www/pages/_meta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,11 @@ export default {
breadcrumb: false,
},
},
examples: {
title: "Examples",
type: "page",
theme: {
breadcrumb: false,
},
},
};
2 changes: 1 addition & 1 deletion apps/www/pages/docs/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import architecture from "../../assets/docs/architecture.png";

<Image src={architecture} height={300} className="dark:invert dark:hue-rotate-180 my-2 mx-auto" />

The Runtime and UI Components each require independent setup and both must be set up.

## Setup


The recommended way to get started is with the following stack:

- NextJS
Expand Down
36 changes: 36 additions & 0 deletions apps/www/pages/examples.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: Examples
---

### RSC Example

This is an example of how to use the Vercel AI SDK RSC Runtime.

- [RSC Example App](https://assistant-ui-rsc-example.vercel.app/)
- [Code](https://github.com/Yonom/assistant-ui-rsc-example)

### eCommerce Example

This is an example of an eCommerce chatbot that can help users find products. Built with Vercel AI SDK RSC Runtime.

- [Demo](https://x.com/MatthewHeartful/status/1803317502933606698)
- [Code](https://github.com/Yonom/assistant-ui/tree/main/examples/search-agent-for-e-commerce)

### React Hook Form Example

This is an example of how to use `@assistant-ui/react-hook-form`.

- [React Hook Form Example App](https://assistant-ui-form-demo.vercel.app/)
- [Code](https://github.com/Yonom/assistant-ui/tree/main/examples/with-react-hook-form)

### Custom REST API Example

This is an example of how to use `@assistant-ui/react` with a custom REST API.

- [Code](https://github.com/Yonom/assistant-ui-custom-api)

### Thread History Persistence example

This is an example of how to restore the thread history using `@assistant-ui/react-ai-sdk` and Vercel AI SDK.

- [Code](https://github.com/Yonom/assistant-ui-assistant-api-history)
4 changes: 0 additions & 4 deletions apps/www/pages/onboarding.mdx

This file was deleted.

2 changes: 1 addition & 1 deletion apps/www/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
"strictNullChecks": true,
"jsx": "preserve"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "pages/examples.mdx"],
"exclude": ["node_modules"]
}
3 changes: 2 additions & 1 deletion packages/react/src/primitives/composer/ComposerInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const ComposerInput = forwardRef<
const focus = useCallback(() => {
const textarea = textareaRef.current;
if (!textarea || !autoFocusEnabled) return;

console.log("focus");
textarea.focus();
textarea.setSelectionRange(
textareaRef.current.value.length,
Expand All @@ -85,6 +85,7 @@ export const ComposerInput = forwardRef<
value={value}
{...rest}
ref={ref}
autoFocus={autoFocus}
disabled={disabled}
onChange={composeEventHandlers(onChange, (e) => {
const composerState = useComposer.getState();
Expand Down

0 comments on commit b33d7f5

Please sign in to comment.