You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: fix all chapter documentation to match actual code
- CHAPTER-0: Updated to show createUIMessageStream pattern, full useChat
config with transport, correct systemPrompt signature
- CHAPTER-2: Fixed agent types (UIMessageStreamWriter), gateway.languageModel
pattern, tutor params (depth/context), route handler structure
- CHAPTER-3: Rewrote quiz-master and planner to show artifact creation with
dataStream.write(), correct models (artifact-model), DB save, error handling
- CHAPTER-4: Fixed CustomUIDataTypes, added focusAreas param, artifact-model
- CHAPTER-5: Added analyst.ts to file structure, fixed inputSchema usage,
updated architecture diagrams, added analyst to orchestrator tools
All code snippets are now copy-paste ready and match the actual implementation.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
> 💡 **React Parallel**: `useChat` is like combining `useState` for messages, `useReducer` for state transitions, and `useSWR` for the API call - all in one hook.
172
212
173
213
The `useChat` hook handles:
174
-
- Managing message history
175
-
- Sending messages to the API
176
-
- Streaming response updates
177
-
-Input state management
214
+
- Managing message history with proper typing
215
+
- Sending messages via custom transport
216
+
- Streaming response updates with throttling
217
+
-Request/response transformation
178
218
179
219
## Message Format
180
220
@@ -192,17 +232,43 @@ type Message = {
192
232
193
233
## The System Prompt
194
234
195
-
The system prompt shapes the AI's personality and behavior:
235
+
The system prompt shapes the AI's personality and behavior. It takes the selected model and geolocation hints as parameters:
196
236
197
237
<details>
198
238
<summary>📄 <strong>Code: System Prompt</strong> (click to expand)</summary>
199
239
200
240
```typescript
201
241
// lib/ai/prompts.ts
202
-
exportconst systemPrompt = () =>`
203
-
You are a helpful AI assistant. Be concise and helpful.
204
-
Today's date is ${newDate().toLocaleDateString()}.
242
+
importtype { Geo } from"@vercel/functions";
243
+
244
+
exportconst regularPrompt =
245
+
"You are a friendly study buddy assistant! Keep your responses concise and helpful.";
0 commit comments