Next.js Discord

Discord Forum

Vercel AI SDK: `useChat()` does it able to take server action as the `api` handler?

Unanswered
Cattle Egret posted this in #help-forum
Open in Discord
Cattle EgretOP
It's quite clear from the documentation and source code type definitions that useChat takes string as the value of api param. But people have been successfully passing server action into it, albeit with some problems it seems.

So if it does really work, how? Does server action gets converted into a string on the frontend? so fetch can actually call it when you pass that into it.

0 Replies