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

For Fastapi example, please consider have a server-side NextJs API #4658

Open
BlakeQG opened this issue Feb 1, 2025 · 0 comments
Open

For Fastapi example, please consider have a server-side NextJs API #4658

BlakeQG opened this issue Feb 1, 2025 · 0 comments
Labels
docs Improvements or additions to documentation enhancement New feature or request

Comments

@BlakeQG
Copy link

BlakeQG commented Feb 1, 2025

Feature Description

For useChat, if we need to pass the Authorization: Bearer ${token} to it, given we should not have auth code on the client side, I presume (1) either have useChat on the server side; or (2) have a customized API like /api/custom-chat on the vercel servide, that API invokes the fastapi API /fastapi/custom-chat .

But I don't see any example nor discussion about it. Please illustrate.

 useChat({
    api: chatEndpoint,
    headers: {
      "Content-Type": "application/json",
      Authorization: `Bearer ${token}`,
    },
...

https://github.com/vercel/ai/blob/main/examples/next-fastapi/app/(examples)/01-chat-text/page.tsx

Use Cases

No response

Additional context

No response

@BlakeQG BlakeQG added the enhancement New feature or request label Feb 1, 2025
@lgrammel lgrammel added the docs Improvements or additions to documentation label Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants