Răsfoiți Sursa

fix ai sdk examples

Chris Tate 5 luni în urmă
părinte
comite
27273c73e9

+ 1 - 2
apps/web/app/api/generate/route.ts

@@ -1,5 +1,4 @@
 import { streamText } from 'ai';
-import { gateway } from '@ai-sdk/gateway';
 
 export const maxDuration = 30;
 
@@ -86,7 +85,7 @@ export async function POST(req: Request) {
   const sanitizedPrompt = String(prompt || '').slice(0, MAX_PROMPT_LENGTH);
 
   const result = streamText({
-    model: gateway('anthropic/claude-haiku-4.5'),
+    model: 'anthropic/claude-opus-4.5',
     system: SYSTEM_PROMPT,
     prompt: sanitizedPrompt,
     temperature: 0.7,

+ 2 - 14
apps/web/app/docs/ai-sdk/page.tsx

@@ -14,12 +14,11 @@ export default function AiSdkPage() {
       </p>
 
       <h2 className="text-xl font-semibold mt-12 mb-4">Installation</h2>
-      <Code lang="bash">npm install ai @ai-sdk/openai</Code>
+      <Code lang="bash">npm install ai</Code>
 
       <h2 className="text-xl font-semibold mt-12 mb-4">API Route Setup</h2>
       <Code lang="typescript">{`// app/api/generate/route.ts
 import { streamText } from 'ai';
-import { openai } from '@ai-sdk/openai';
 import { generateCatalogPrompt } from '@json-render/core';
 import { catalog } from '@/lib/catalog';
 
@@ -34,7 +33,7 @@ export async function POST(req: Request) {
     : '';
 
   const result = streamText({
-    model: openai('gpt-4o'),
+    model: 'anthropic/claude-opus-4.5',
     system: systemPrompt + contextPrompt,
     prompt,
   });
@@ -47,17 +46,6 @@ export async function POST(req: Request) {
   });
 }`}</Code>
 
-      <h2 className="text-xl font-semibold mt-12 mb-4">Using Gateway</h2>
-      <p className="text-sm text-muted-foreground mb-4">
-        For multi-provider support, use the AI Gateway:
-      </p>
-      <Code lang="typescript">{`import { gateway } from '@ai-sdk/gateway';
-
-const result = streamText({
-  model: gateway('openai/gpt-4o'),
-  // ...
-});`}</Code>
-
       <h2 className="text-xl font-semibold mt-12 mb-4">Client-Side Hook</h2>
       <p className="text-sm text-muted-foreground mb-4">
         Use <code className="text-foreground">useUIStream</code> on the client:

+ 1 - 1
apps/web/app/docs/installation/page.tsx

@@ -41,7 +41,7 @@ bun add @json-render/core @json-render/react`}</Code>
       <p className="text-sm text-muted-foreground mb-4">
         To use json-render with AI models, you&apos;ll also need the Vercel AI SDK:
       </p>
-      <Code lang="bash">npm install ai @ai-sdk/openai</Code>
+      <Code lang="bash">npm install ai</Code>
 
       <div className="flex gap-3 mt-12">
         <Button size="sm" asChild>

+ 1 - 2
apps/web/app/docs/quick-start/page.tsx

@@ -87,7 +87,6 @@ export const registry = {
       </p>
       <Code lang="typescript">{`// app/api/generate/route.ts
 import { streamText } from 'ai';
-import { openai } from '@ai-sdk/openai';
 import { generateCatalogPrompt } from '@json-render/core';
 import { catalog } from '@/lib/catalog';
 
@@ -96,7 +95,7 @@ export async function POST(req: Request) {
   const systemPrompt = generateCatalogPrompt(catalog);
 
   const result = streamText({
-    model: openai('gpt-4o'),
+    model: 'anthropic/claude-opus-4.5',
     system: systemPrompt,
     prompt,
   });

+ 1 - 1
apps/web/app/docs/streaming/page.tsx

@@ -67,7 +67,7 @@ function App() {
   const { prompt } = await req.json();
   
   const result = streamText({
-    model: openai('gpt-4o'),
+    model: 'anthropic/claude-opus-4.5',
     system: generateCatalogPrompt(catalog),
     prompt,
   });

+ 0 - 1
apps/web/tsconfig.json

@@ -6,7 +6,6 @@
         "name": "next"
       }
     ],
-    "baseUrl": ".",
     "paths": {
       "@/*": ["./*"]
     }

+ 1 - 2
examples/dashboard/app/api/generate/route.ts

@@ -1,5 +1,4 @@
 import { streamText } from 'ai';
-import { gateway } from '@ai-sdk/gateway';
 import { componentList } from '@/lib/catalog';
 
 export const maxDuration = 30;
@@ -70,7 +69,7 @@ export async function POST(req: Request) {
   }
 
   const result = streamText({
-    model: gateway('openai/gpt-4o'),
+    model: 'anthropic/claude-opus-4.5',
     system: SYSTEM_PROMPT,
     prompt: fullPrompt,
     temperature: 0.7,