diff --git a/docs/adapters/elevenlabs.md b/docs/adapters/elevenlabs.md index dab794aa5..c560b4e71 100644 --- a/docs/adapters/elevenlabs.md +++ b/docs/adapters/elevenlabs.md @@ -78,7 +78,7 @@ const token = await realtimeToken({ ### React (useRealtimeChat) -```typescript +```tsx import { useRealtimeChat } from '@tanstack/ai-react' import { elevenlabsRealtime } from '@tanstack/ai-elevenlabs' diff --git a/docs/api/ai-preact.md b/docs/api/ai-preact.md index a3c2390f7..8951e8e71 100644 --- a/docs/api/ai-preact.md +++ b/docs/api/ai-preact.md @@ -24,7 +24,7 @@ npm install @tanstack/ai-preact Main hook for managing chat state in Preact with full type safety. -```typescript +```tsx import { useChat, fetchServerSentEvents } from "@tanstack/ai-preact"; import { clientTools, @@ -119,7 +119,7 @@ import { ## Example: Basic Chat -```typescript +```tsx import { useState } from "preact/hooks"; import { useChat, fetchServerSentEvents } from "@tanstack/ai-preact"; @@ -177,7 +177,7 @@ export function Chat() { ## Example: Tool Approval -```typescript +```tsx import { useChat, fetchServerSentEvents } from "@tanstack/ai-preact"; export function ChatWithApproval() { @@ -230,7 +230,7 @@ export function ChatWithApproval() { ## Example: Client Tools with Type Safety -```typescript +```tsx import { useChat, fetchServerSentEvents } from "@tanstack/ai-preact"; import { clientTools, diff --git a/docs/api/ai-react.md b/docs/api/ai-react.md index d6d1e123b..e8ef2a62c 100644 --- a/docs/api/ai-react.md +++ b/docs/api/ai-react.md @@ -30,7 +30,7 @@ npm install @tanstack/ai-react Main hook for managing chat state in React with full type safety. -```typescript +```tsx import { useChat, fetchServerSentEvents } from "@tanstack/ai-react"; import { clientTools, @@ -144,7 +144,7 @@ For error narrowing, import `UnsupportedResponseStreamError` and ## Example: Basic Chat -```typescript +```tsx import { useState } from "react"; import { useChat, fetchServerSentEvents } from "@tanstack/ai-react"; @@ -202,7 +202,7 @@ export function Chat() { ## Example: Tool Approval -```typescript +```tsx import { useChat, fetchServerSentEvents } from "@tanstack/ai-react"; export function ChatWithApproval() { @@ -255,7 +255,7 @@ export function ChatWithApproval() { ## Example: Client Tools with Type Safety -```typescript +```tsx import { useChat, fetchServerSentEvents } from "@tanstack/ai-react"; import { clientTools, diff --git a/docs/api/ai-solid.md b/docs/api/ai-solid.md index 6365ed5a2..20c49f089 100644 --- a/docs/api/ai-solid.md +++ b/docs/api/ai-solid.md @@ -25,7 +25,7 @@ npm install @tanstack/ai-solid Main primitive for managing chat state in SolidJS with full type safety. -```typescript +```tsx import { useChat, fetchServerSentEvents } from "@tanstack/ai-solid"; import { clientTools, @@ -122,7 +122,7 @@ import { ## Example: Basic Chat -```typescript +```tsx import { createSignal, For } from "solid-js"; import { useChat, fetchServerSentEvents } from "@tanstack/ai-solid"; @@ -184,7 +184,7 @@ export function Chat() { ## Example: Tool Approval -```typescript +```tsx import { For, Show } from "solid-js"; import { useChat, fetchServerSentEvents } from "@tanstack/ai-solid"; @@ -241,7 +241,7 @@ export function ChatWithApproval() { ## Example: Client Tools with Type Safety -```typescript +```tsx import { useChat, fetchServerSentEvents } from "@tanstack/ai-solid"; import { clientTools, diff --git a/docs/code-mode/client-integration.md b/docs/code-mode/client-integration.md index ff16d96e9..8ddc86c2f 100644 --- a/docs/code-mode/client-integration.md +++ b/docs/code-mode/client-integration.md @@ -93,7 +93,7 @@ Events are keyed by `toolCallId` so each `execute_typescript` call gets its own When rendering messages, check for `execute_typescript` tool calls and display their events: -```typescript +```tsx function MessageList({ messages, toolCallEvents, @@ -142,7 +142,7 @@ function MessageList({ Here's a complete `CodeExecutionPanel` component that shows the generated code, live event stream, and final result: -```typescript +```tsx function CodeExecutionPanel({ code, events, diff --git a/docs/getting-started/quick-start.md b/docs/getting-started/quick-start.md index 0cccc6256..79c136ce7 100644 --- a/docs/getting-started/quick-start.md +++ b/docs/getting-started/quick-start.md @@ -142,7 +142,7 @@ export async function POST(request: Request) { To use the chat API from your React frontend, create a `Chat` component: -```typescript +```tsx // components/Chat.tsx import { useState } from "react"; import { useChat, fetchServerSentEvents } from "@tanstack/ai-react"; diff --git a/docs/media/realtime-chat.md b/docs/media/realtime-chat.md index d67eee05e..b625d5189 100644 --- a/docs/media/realtime-chat.md +++ b/docs/media/realtime-chat.md @@ -58,7 +58,7 @@ const getRealtimeToken = createServerFn({ method: 'POST' }) ### 2. Connect from the Client (React) -```typescript +```tsx import { useRealtimeChat } from '@tanstack/ai-react' import { openaiRealtime } from '@tanstack/ai-openai' @@ -194,7 +194,7 @@ const { startListening, stopListening, vadMode, setVADMode } = useRealtimeChat({ With `manual` VAD mode, use push-to-talk style interactions: -```typescript +```tsx @@ -283,13 +283,13 @@ The `inputLevel` and `outputLevel` values update on every animation frame while **Simple level meter:** -```typescript +```tsx
``` **Pulsing audio indicator:** -```typescript +```tsx function AudioIndicator({ level }: { level: number }) { return (