|
| 1 | +<div align="center"> |
| 2 | + <img src="./media/header_ai.png" > |
| 3 | +</div> |
| 4 | + |
| 5 | +<br /> |
| 6 | + |
| 7 | +<div align="center"> |
| 8 | +<a href="https://npmjs.com/package/@tanstack/ai" target="\_parent"> |
| 9 | + <img alt="" src="https://img.shields.io/npm/dm/@tanstack/ai.svg" /> |
| 10 | +</a> |
| 11 | +<a href="https://github.com/TanStack/ai" target="\_parent"> |
| 12 | + <img alt="" src="https://img.shields.io/github/stars/TanStack/ai.svg?style=social&label=Star" alt="GitHub stars" /> |
| 13 | +</a> |
| 14 | +<a href="https://bundlephobia.com/result?p=@tanstack/ai@latest" target="\_parent"> |
| 15 | + <img alt="" src="https://badgen.net/bundlephobia/minzip/@tanstack/ai@latest" /> |
| 16 | +</a> |
| 17 | +</div> |
| 18 | + |
| 19 | +<div align="center"> |
| 20 | +<a href="#badge"> |
| 21 | + <img alt="semantic-release" src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg"> |
| 22 | +</a> |
| 23 | + <a href="#badge"> |
| 24 | + <img src="https://img.shields.io/github/v/release/tanstack/ai" alt="Release"/> |
| 25 | + </a> |
| 26 | +<a href="https://twitter.com/tan_stack"> |
| 27 | + <img src="https://img.shields.io/twitter/follow/tan_stack.svg?style=social" alt="Follow @TanStack"/> |
| 28 | +</a> |
| 29 | +</div> |
| 30 | + |
| 31 | +<div align="center"> |
| 32 | + |
| 33 | +### [Become a Sponsor!](https://github.com/sponsors/tannerlinsley/) |
| 34 | +</div> |
| 35 | + |
| 36 | +# TanStack Preact AI Devtools |
| 37 | + |
| 38 | +Developer tools for TanStack AI in Preact applications. |
| 39 | + |
| 40 | +## Installation |
| 41 | + |
| 42 | +```bash |
| 43 | +npm install @tanstack/preact-ai-devtools |
| 44 | +# or |
| 45 | +pnpm add @tanstack/preact-ai-devtools |
| 46 | +# or |
| 47 | +yarn add @tanstack/preact-ai-devtools |
| 48 | +``` |
| 49 | + |
| 50 | +## Usage |
| 51 | + |
| 52 | +### Using the Panel Component |
| 53 | + |
| 54 | +Add the `AiDevtoolsPanel` component to your app: |
| 55 | + |
| 56 | +```tsx |
| 57 | +import { AiDevtoolsPanel } from '@tanstack/preact-ai-devtools' |
| 58 | + |
| 59 | +function App() { |
| 60 | + return ( |
| 61 | + <> |
| 62 | + <YourApp /> |
| 63 | + <AiDevtoolsPanel /> |
| 64 | + </> |
| 65 | + ) |
| 66 | +} |
| 67 | +``` |
| 68 | + |
| 69 | +### Using the Plugin |
| 70 | + |
| 71 | +You can also use the devtools as a plugin: |
| 72 | + |
| 73 | +```tsx |
| 74 | +import { aiDevtoolsPlugin } from '@tanstack/preact-ai-devtools' |
| 75 | +import { useAIProvider } from '@tanstack/ai-preact' |
| 76 | + |
| 77 | +function App() { |
| 78 | + const ai = useAIProvider({ |
| 79 | + // your config |
| 80 | + plugins: [aiDevtoolsPlugin()], |
| 81 | + }) |
| 82 | + |
| 83 | + return <YourApp /> |
| 84 | +} |
| 85 | +``` |
| 86 | + |
| 87 | +## Production Builds |
| 88 | + |
| 89 | +For production builds, import from the production entry point to exclude devtools code: |
| 90 | + |
| 91 | +```tsx |
| 92 | +import { AiDevtoolsPanel } from '@tanstack/preact-ai-devtools/production' |
| 93 | +``` |
| 94 | + |
| 95 | +The devtools will automatically be disabled in production environments when using the main entry point. |
| 96 | + |
| 97 | +## Get Involved |
| 98 | + |
| 99 | +- [Join the Discord](https://tlinz.com/discord) |
| 100 | +- [Read the docs](https://tanstack.com/ai) |
| 101 | +- [Report an issue](https://github.com/TanStack/ai/issues) |
0 commit comments