Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # 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
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
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant