ChatGPT的语境理解能力已经得到了大幅提升。它能够更好地理解你输入的问题或指令,并从中获取更多的上下文信息,以便给出更准确和相关的回答。无论是一般性的问题还是特定领域的知识,ChatGPT都能为你提供更有深度的答案

Vercel 官方打造的ChatGPT网页版

代码特色

  • Next.js App Router
  • React Server Components (RSCs), Suspense, and Server Actions
  • Vercel AI SDK for streaming chat UI
  • Support for OpenAI (default), Anthropic, Cohere, Hugging Face, or custom AI chat models and/or LangChain
  • shadcn/ui

github地址:

https://github.com/vercel/ai-chatbot

demo 地址:

chatgpt中文


支持的模型

该模板默认使用OpenAI的gpt-3.5-turbo版本。然而,由于Vercel AI SDK的支持,您可以仅需几行代码就可以切换到Anthropic、Cohere、Hugging Face或使用LangChain作为您的LLM提供商。

部署你的代码

您可以通过一键部署将自己的Next.js AI聊天机器人版本部署到Vercel上:

nextjs 一键部署ChatGPT 网页版_Server


本地运行

要运行Next.js AI聊天机器人,您需要使用.env.example中定义的环境变量。建议您使用Vercel环境变量,但只需要一个.env文件就足够了。

  1. 注意:您不应提交您的.env文件,否则会暴露秘密信息,使其他人能够控制访问您的各种OpenAI和身份验证提供商账户
  2. 安装 Vercel CLI: npm i -g vercel
  3. Link local instance with Vercel and GitHub accounts (creates .vercel directory): vercel link
  4. Download your environment variables: vercel env pull
pnpm install
pnpm dev

你的项目会启动在 localhost:3000.