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
import{openai}from'@ai-sdk/openai';import{streamText}from'ai';// Allow streaming responses up to 30 secondsexportconstmaxDuration=30;exportasyncfunctionPOST(req: Request){const{ messages }=awaitreq.json();constresult=streamText({model: openai('gpt-4-turbo'),system: 'You are a helpful assistant.',
messages,});console.log(result.response);returnresult.toDataStreamResponse();}
Description
and nothing repond i try to console reponce give me that
and nothing repond i try to console reponce give me that
Response {
status: 200,
statusText: '',
headers: Headers {
'Content-Type': 'text/plain; charset=utf-8',
'X-Vercel-AI-Data-Stream': 'v1'
},
body: ReadableStream { locked: false, state: 'readable', supportsBYOB: false },
bodyUsed: false,
ok: true,
redirected: false,
type: 'default',
url: ''
}
Code example
app/api/chat/route.tsx :
https://www.codebin.cc/code/cm6ow886c0001jl03nr6bvtuv:5vUaFjyKdGLEUhgcqHYrDCkd1MccVkL5W69vWkoXe6sc
app/chat/page.tsx:
https://www.codebin.cc/code/cm6ow97iv0001l2031qix4xb2:Cu13SzXkuQwwsS96pUSVdXk7B17jNEGM7hgteLe188zD
AI provider
"@ai-sdk/openai": "^1.1.9",
Additional context
No response
The text was updated successfully, but these errors were encountered: