New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update nextjs app router guide to use ai/rsc #1189
base: main
Are you sure you want to change the base?
Conversation
fa74975
to
d42c6da
Compare
import OpenAI from 'openai'; | ||
import { OpenAIStream, StreamingTextResponse } from 'ai'; | ||
import { useState } from 'react'; | ||
import { generate } from './actions'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we call this generate? given generateText
coming?
import OpenAI from 'openai'; | ||
import { OpenAIStream, StreamingTextResponse } from 'ai'; | ||
import { useState } from 'react'; | ||
import { generate } from './actions'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we call this generate? given generateText
coming?
// Creates a wrapped, changable value that can be streamed to the client. | ||
const stream = createStreamableValue(''); | ||
|
||
render({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not have const ui = render()
and then return ui
from the action?
</form> | ||
</div> | ||
); | ||
return { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing other APIs and or links to them.
|
||
<div>{generation}</div> | ||
</div> | ||
); | ||
} | ||
``` | ||
|
||
Note that using the Edge Runtime is optional but highly recommended due to [longer streaming timeouts on Vercel](https://vercel.com/docs/concepts/functions/edge-functions/limitations#maximum-initial-response-time), no cold starts, and lower latency. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this
No description provided.