The Directory 00:00:00
← The directory
TypeScript · AI

Chatbot UI

A chat interface for interacting with AI models.

Chatbot UI presents a self-hosted streaming conversation workspace with folders, prompts, and model controls

View the deployment · Run locally · Configure providers

An early self-hosted ChatGPT interface adapted so friends in Hong Kong could use a familiar chat workspace. It combines streaming responses with conversation history, reusable prompts, folders, model selection, and per-conversation controls.

Dark Chatbot UI showing a poem response, conversation sidebar, model selector, and message composer

The conversation workspace

  • Stream model responses into a focused two-pane chat interface.
  • Organize conversations and prompt templates into folders.
  • Search chat history and save reusable system prompts.
  • Choose a supported model and adjust temperature per conversation.
  • Render Markdown, tables, math, and syntax-highlighted code.
  • Import or export local conversation data.
  • Use built-in localization files for a multilingual interface.
  • Optionally enrich a request with Google Custom Search results.

Conversation history, folders, prompts, and user-supplied keys are managed in the browser. A deployment can also provide its own server-side OpenAI key.

Run it

git clone https://github.com/ChinesePrince07/chatbot-ui.git
cd chatbot-ui
npm install
cp .env.local.example .env.local 2>/dev/null || touch .env.local
npm run dev

Open http://localhost:3000.

If the repository does not include .env.local.example, add the variables you need from the table below directly to .env.local.

Configuration

Variable Default Purpose
OPENAI_API_KEY Server-provided OpenAI key; users can supply their own if omitted
OPENAI_API_HOST https://api.openai.com OpenAI-compatible API base URL
OPENAI_API_TYPE openai openai or azure
OPENAI_API_VERSION 2023-03-15-preview Azure API version
AZURE_DEPLOYMENT_ID Azure deployment identifier
OPENAI_ORGANIZATION Optional OpenAI organization
DEFAULT_MODEL gpt-3.5-turbo Initial conversation model
NEXT_PUBLIC_DEFAULT_SYSTEM_PROMPT built in Initial system prompt
GOOGLE_API_KEY Google Custom Search API key
GOOGLE_CSE_ID Google Programmable Search engine ID

Example:

OPENAI_API_KEY=your-key
OPENAI_API_HOST=https://api.openai.com
DEFAULT_MODEL=gpt-3.5-turbo

Do not commit .env.local.

Request path

message + conversation settings
              ↓
       /api/chat route
              ↓
token budget + system prompt
              ↓
 OpenAI or Azure-compatible API
              ↓
     streamed browser response

Google search uses a separate API route: it fetches search results, extracts readable page text, and asks the selected model to answer with that context.

Project map

components/Chat/       messages, composer, model and prompt controls
components/Chatbar/    conversations and conversation folders
components/Promptbar/  reusable prompts and prompt folders
pages/api/chat.ts      token counting and streamed completion endpoint
pages/api/google.ts    optional search-augmented request path
utils/app/             persistence, import/export, and conversation cleanup
public/locales/        interface translations

Checks

npm run lint
npm test

Project status

This repository captures a 2023-era ChatGPT interface and dependency stack. Provider models, API versions, quotas, and deployment behavior may have changed since it was built. Review the configured model and API version before using it for a new deployment.

Credits and license

This adaptation is built from Mckay Wrigley’s original Chatbot UI code. The upstream copyright notice is preserved in license.

Released under the MIT License.