Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jeremyphilemon
Copy link
Contributor

No description provided.

import OpenAI from 'openai';
import { OpenAIStream, StreamingTextResponse } from 'ai';
import { useState } from 'react';
import { generate } from './actions';
Copy link
Collaborator

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';
Copy link
Collaborator

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({
Copy link
Collaborator

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 {
Copy link
Collaborator

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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants