Mirror site by openAI chat completion API, based on https://github.com/vercel/examples/tree/main/solutions/ai-chatgpt
- Next.js
- OpenAI API (ChatGPT) - streaming
- API Routes (Edge runtime) - streaming
- Redis - save sessions
- Google search API
Rename .env.example to .env.local:
cp .env.example .env.localupdate OPENAI_API_KEY with your OpenAI secret key.
Next, run Next.js in development mode:
npm install
npm run devThe app should be up and running at http://localhost:3000.
Conservation history is saved in redis, it's optinal, you can remove it if you don't need it.
Setup: Deploy a redis server, in .env.local update REDIS_URL with redis server, such as localhost:6379
With web search result, you can let chatGpt to search the web for you, and return the result.
Setup: In .env.local,
update GOOGLE_SEARCH_API_KEY and GOOGLE_SEARCH_CONTENXT_KEY for google search, refer to (https://developers.google.com/custom-search/v1/introduction#identify_your_application_to_google_with_api_ke)
update BING_SEARCH_V7_SUBSCRIPTION_KEY for bing search, refer to (https://learn.microsoft.com/en-us/bing/search-apis/bing-web-search/overview)
Usage: Turn on the web search button in left pane. By default, the input message will be used as search key words and the search results will by be included in a default prompt. You can also set your own prompt using ##...## to enclose the search keyword.
- Detailed search result and more search engines
- Upload file and consume file
- Automatically set session name by summarize chat with gpt
- User authtication