Next.js Discord

Discord Forum

help with vercel sdk

Answered
Asian black bear posted this in #help-forum
Open in Discord
Asian black bearOP
I'm trying to build a ai chat bot with vercelSDK and this face me



codes :

app/api/chat/route.tsx :
https://www.codebin.cc/code/cm6ow886c0001jl03nr6bvtuv:5vUaFjyKdGLEUhgcqHYrDCkd1MccVkL5W69vWkoXe6sc

app/chat/page.tsx:
https://www.codebin.cc/code/cm6ow97iv0001l2031qix4xb2:Cu13SzXkuQwwsS96pUSVdXk7B17jNEGM7hgteLe188zD

and nothing repond i try to console reponce give me that

Response {
  status: 200,
  statusText: '',
  headers: Headers {
    'Content-Type': 'text/plain; charset=utf-8',
    'X-Vercel-AI-Data-Stream': 'v1'
  },
  body: ReadableStream { locked: false, state: 'readable', supportsBYOB: false },
  bodyUsed: false,
  ok: true,
  redirected: false,
  type: 'default',
  url: ''
}

22 Replies

@@ts-ignore the console log is expected. The body is a stream. Is there no error? maybe check console log for some clues
Asian black bearOP
i mean why its not respond to my message
@Asian black bear i mean why its not respond to my message
open the network tag and look for a request to /api/chat and see its response.
@@ts-ignore open the network tag and look for a request to `/api/chat` and see its response.
Asian black bearOP
the request is not resolving
weird
Asian black bearOP
idk man i see docs and everything is good
also api key usage is 0$ its mean openai api not fetch any request
could you remove the console log
@@ts-ignore could you remove the console log
Asian black bearOP
oh its give me err but there is noting at console to see what is
check your terminal logs
maybe any clue there
Asian black bearOP
clear no erros also give me
POST /api/chat 200 in 731ms
this is very weird
is your openai key etc all setup?
@@ts-ignore is your openai key etc all setup?
Asian black bearOP
yep also to check i console it and its console good
called

OPENAI_API_KEY=sk-****

at env.local
yea this is correct
Answer
people follow this
Asian black bearOP
okay give me a sec to see
oh i don't have access to gpt-4-turbo