Skip to content

Commit 8061e13

Browse files
committed
feat(examples): update search API to use server-sent events streaming
- Migrated from `toStreamResponse` to `toServerSentEventsResponse` for improved streaming - Updated OpenAI adapter to use `openaiText` with model specification - Updated multiple dependencies including React, TanStack Router, and TailwindCSS
1 parent e9abfa2 commit 8061e13

2 files changed

Lines changed: 14 additions & 15 deletions

File tree

examples/ts-react-search/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,33 @@
1010
},
1111
"dependencies": {
1212
"@radix-ui/react-slot": "^1.2.4",
13-
"@tailwindcss/vite": "^4.1.17",
13+
"@tailwindcss/vite": "^4.1.18",
1414
"@tanstack/ai": "workspace:*",
1515
"@tanstack/ai-openai": "workspace:*",
1616
"@tanstack/ai-react": "workspace:*",
1717
"@tanstack/query-db-collection": "^1.0.6",
1818
"@tanstack/react-db": "^0.1.55",
1919
"@tanstack/react-devtools": "^0.8.2",
2020
"@tanstack/react-query": "^5.90.12",
21-
"@tanstack/react-router": "^1.139.7",
21+
"@tanstack/react-router": "^1.141.1",
2222
"@tanstack/react-router-devtools": "^1.139.7",
2323
"@tanstack/react-router-ssr-query": "^1.139.7",
24-
"@tanstack/react-start": "^1.139.8",
24+
"@tanstack/react-start": "^1.141.1",
2525
"@tanstack/router-plugin": "^1.139.7",
2626
"@tanstack/zod-adapter": "^1.140.1",
2727
"class-variance-authority": "^0.7.1",
2828
"clsx": "^2.1.1",
29-
"lucide-react": "^0.555.0",
29+
"lucide-react": "^0.561.0",
3030
"nitro": "latest",
3131
"radix-ui": "^1.4.3",
32-
"react": "^19.2.0",
32+
"react": "^19.2.3",
3333
"react-day-picker": "^9.12.0",
34-
"react-dom": "^19.2.0",
34+
"react-dom": "^19.2.3",
3535
"tailwind-merge": "^3.4.0",
36-
"tailwindcss": "^4.1.17",
36+
"tailwindcss": "^4.1.18",
3737
"tw-animate-css": "^1.4.0",
3838
"vite-tsconfig-paths": "^5.1.4",
39-
"zod": "^4.1.13"
39+
"zod": "^4.2.0"
4040
},
4141
"devDependencies": {
4242
"@tanstack/devtools-vite": "^0.3.11",
@@ -45,10 +45,10 @@
4545
"@types/node": "^24.10.1",
4646
"@types/react": "^19.2.7",
4747
"@types/react-dom": "^19.2.3",
48-
"@vitejs/plugin-react": "^5.1.1",
48+
"@vitejs/plugin-react": "^5.1.2",
4949
"jsdom": "^27.2.0",
5050
"typescript": "5.9.3",
51-
"vite": "^7.2.4",
51+
"vite": "^7.2.7",
5252
"vitest": "^4.0.14",
5353
"web-vitals": "^5.1.0"
5454
}

examples/ts-react-search/src/routes/api/search.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createFileRoute } from '@tanstack/react-router'
2-
import { chat, toStreamResponse } from '@tanstack/ai'
3-
import { openai } from '@tanstack/ai-openai'
2+
import { chat, toServerSentEventsResponse } from '@tanstack/ai'
3+
import { openaiText } from '@tanstack/ai-openai'
44
import type { ISO8601UTC } from '@/types'
55
import {
66
ORDER_STATUS_MAP,
@@ -102,14 +102,13 @@ export const Route = createFileRoute('/api/search')({
102102

103103
try {
104104
const stream = chat({
105-
adapter: openai(),
105+
adapter: openaiText('gpt-5-nano'),
106106
messages,
107-
model: 'gpt-5-nano',
108107
conversationId,
109108
systemPrompts: [SYSTEM_PROMPT],
110109
})
111110

112-
return toStreamResponse(stream)
111+
return toServerSentEventsResponse(stream)
113112
} catch (error: any) {
114113
return new Response(
115114
JSON.stringify({

0 commit comments

Comments
 (0)