Skip to content

Commit 9f50126

Browse files
committed
Initial commit
Created from https://vercel.com/new
0 parents  commit 9f50126

File tree

246 files changed

+23420
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

246 files changed

+23420
-0
lines changed

.dockerignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.env
2+
.env.local
3+
node_modules
4+
test-results

.env.local.example

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Chatbot UI
2+
DEFAULT_MODEL=gpt-3.5-turbo
3+
NEXT_PUBLIC_DEFAULT_SYSTEM_PROMPT=You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.
4+
OPENAI_API_KEY=YOUR_KEY
5+
6+
# Google
7+
GOOGLE_API_KEY=YOUR_API_KEY
8+
GOOGLE_CSE_ID=YOUR_ENGINE_ID

.eslintrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

.gitignore

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
/test-results
11+
12+
# next.js
13+
/.next/
14+
/out/
15+
/dist
16+
17+
# production
18+
/build
19+
20+
# misc
21+
.DS_Store
22+
*.pem
23+
24+
# debug
25+
npm-debug.log*
26+
yarn-debug.log*
27+
yarn-error.log*
28+
.pnpm-debug.log*
29+
30+
# local env files
31+
.env*.local
32+
33+
# vercel
34+
.vercel
35+
36+
# typescript
37+
*.tsbuildinfo
38+
next-env.d.ts
39+
.idea
40+
pnpm-lock.yaml

CONTRIBUTING.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Contributing Guidelines
2+
3+
**Welcome to Chatbot UI!**
4+
5+
We appreciate your interest in contributing to our project.
6+
7+
Before you get started, please read our guidelines for contributing.
8+
9+
## Types of Contributions
10+
11+
We welcome the following types of contributions:
12+
13+
- Bug fixes
14+
- New features
15+
- Documentation improvements
16+
- Code optimizations
17+
- Translations
18+
- Tests
19+
20+
## Getting Started
21+
22+
To get started, fork the project on GitHub and clone it locally on your machine. Then, create a new branch to work on your changes.
23+
24+
```
25+
git clone https://github.com/mckaywrigley/chatbot-ui.git
26+
cd chatbot-ui
27+
git checkout -b my-branch-name
28+
29+
```
30+
31+
Before submitting your pull request, please make sure your changes pass our automated tests and adhere to our code style guidelines.
32+
33+
## Pull Request Process
34+
35+
1. Fork the project on GitHub.
36+
2. Clone your forked repository locally on your machine.
37+
3. Create a new branch from the main branch.
38+
4. Make your changes on the new branch.
39+
5. Ensure that your changes adhere to our code style guidelines and pass our automated tests.
40+
6. Commit your changes and push them to your forked repository.
41+
7. Submit a pull request to the main branch of the main repository.
42+
43+
## Contact
44+
45+
If you have any questions or need help getting started, feel free to reach out to me on [Twitter](https://twitter.com/mckaywrigley).

Dockerfile

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# ---- Base Node ----
2+
FROM node:19-alpine AS base
3+
WORKDIR /app
4+
COPY package*.json ./
5+
6+
# ---- Dependencies ----
7+
FROM base AS dependencies
8+
RUN npm ci
9+
10+
# ---- Build ----
11+
FROM dependencies AS build
12+
COPY . .
13+
RUN npm run build
14+
15+
# ---- Production ----
16+
FROM node:19-alpine AS production
17+
WORKDIR /app
18+
COPY --from=dependencies /app/node_modules ./node_modules
19+
COPY --from=build /app/.next ./.next
20+
COPY --from=build /app/public ./public
21+
COPY --from=build /app/package*.json ./
22+
COPY --from=build /app/next.config.js ./next.config.js
23+
COPY --from=build /app/next-i18next.config.js ./next-i18next.config.js
24+
25+
# Expose the port the app will run on
26+
EXPOSE 3000
27+
28+
# Start the application
29+
CMD ["npm", "start"]

Makefile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
include .env
2+
3+
.PHONY: all
4+
5+
build:
6+
docker build -t chatbot-ui .
7+
8+
run:
9+
export $(cat .env | xargs)
10+
docker stop chatbot-ui || true && docker rm chatbot-ui || true
11+
docker run --name chatbot-ui --rm -e OPENAI_API_KEY=${OPENAI_API_KEY} -p 3000:3000 chatbot-ui
12+
13+
logs:
14+
docker logs -f chatbot-ui
15+
16+
push:
17+
docker tag chatbot-ui:latest ${DOCKER_USER}/chatbot-ui:${DOCKER_TAG}
18+
docker push ${DOCKER_USER}/chatbot-ui:${DOCKER_TAG}

README.md

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Chatbot UI
2+
3+
Chatbot UI is an open source chat UI for AI models.
4+
5+
See a [demo](https://twitter.com/mckaywrigley/status/1640380021423603713?s=46&t=AowqkodyK6B4JccSOxSPew).
6+
7+
![Chatbot UI](./public/screenshots/screenshot-0402023.jpg)
8+
9+
## Updates
10+
11+
Chatbot UI will be updated over time.
12+
13+
Expect frequent improvements.
14+
15+
**Next up:**
16+
17+
- [ ] Sharing
18+
- [ ] "Bots"
19+
20+
## Deploy
21+
22+
**Vercel**
23+
24+
Host your own live version of Chatbot UI with Vercel.
25+
26+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fmckaywrigley%2Fchatbot-ui)
27+
28+
**Docker**
29+
30+
Build locally:
31+
32+
```shell
33+
docker build -t chatgpt-ui .
34+
docker run -e OPENAI_API_KEY=xxxxxxxx -p 3000:3000 chatgpt-ui
35+
```
36+
37+
Pull from ghcr:
38+
39+
```
40+
docker run -e OPENAI_API_KEY=xxxxxxxx -p 3000:3000 ghcr.io/mckaywrigley/chatbot-ui:main
41+
```
42+
43+
## Running Locally
44+
45+
**1. Clone Repo**
46+
47+
```bash
48+
git clone https://github.com/mckaywrigley/chatbot-ui.git
49+
```
50+
51+
**2. Install Dependencies**
52+
53+
```bash
54+
npm i
55+
```
56+
57+
**3. Provide OpenAI API Key**
58+
59+
Create a .env.local file in the root of the repo with your OpenAI API Key:
60+
61+
```bash
62+
OPENAI_API_KEY=YOUR_KEY
63+
```
64+
65+
> You can set `OPENAI_API_HOST` where access to the official OpenAI host is restricted or unavailable, allowing users to configure an alternative host for their specific needs.
66+
67+
> Additionally, if you have multiple OpenAI Organizations, you can set `OPENAI_ORGANIZATION` to specify one.
68+
69+
**4. Run App**
70+
71+
```bash
72+
npm run dev
73+
```
74+
75+
**5. Use It**
76+
77+
You should be able to start chatting.
78+
79+
## Configuration
80+
81+
When deploying the application, the following environment variables can be set:
82+
83+
| Environment Variable | Default value | Description |
84+
| --------------------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
85+
| OPENAI_API_KEY | | The default API key used for authentication with OpenAI |
86+
| OPENAI_API_HOST | `https://api.openai.com` | The base url, for Azure use `https://<endpoint>.openai.azure.com` |
87+
| OPENAI_API_TYPE | `openai` | The API type, options are `openai` or `azure` |
88+
| OPENAI_API_VERSION | `2023-03-15-preview` | Only applicable for Azure OpenAI |
89+
| AZURE_DEPLOYMENT_ID | | Needed when Azure OpenAI, Ref [Azure OpenAI API](https://learn.microsoft.com/zh-cn/azure/cognitive-services/openai/reference#completions) |
90+
| OPENAI_ORGANIZATION | | Your OpenAI organization ID |
91+
| DEFAULT_MODEL | `gpt-3.5-turbo` | The default model to use on new conversations, for Azure use `gpt-35-turbo` |
92+
| NEXT_PUBLIC_DEFAULT_SYSTEM_PROMPT | [see here](utils/app/const.ts) | The default system prompt to use on new conversations |
93+
| NEXT_PUBLIC_DEFAULT_TEMPERATURE | 1 | The default temperature to use on new conversations |
94+
| GOOGLE_API_KEY | | See [Custom Search JSON API documentation][GCSE] |
95+
| GOOGLE_CSE_ID | | See [Custom Search JSON API documentation][GCSE] |
96+
97+
If you do not provide an OpenAI API key with `OPENAI_API_KEY`, users will have to provide their own key.
98+
99+
If you don't have an OpenAI API key, you can get one [here](https://platform.openai.com/account/api-keys).
100+
101+
## Contact
102+
103+
If you have any questions, feel free to reach out to Mckay on [Twitter](https://twitter.com/mckaywrigley).
104+
105+
[GCSE]: https://developers.google.com/custom-search/v1/overview

SECURITY.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Security Policy
2+
3+
4+
This security policy outlines the process for reporting vulnerabilities and secrets found within this GitHub repository. It is essential that all contributors and users adhere to this policy in order to maintain a secure and stable environment.
5+
6+
## Reporting a Vulnerability
7+
8+
If you discover a vulnerability within the code, dependencies, or any other component of this repository, please follow these steps:
9+
10+
1. **Do not disclose the vulnerability publicly.** Publicly disclosing a vulnerability may put the project at risk and could potentially harm other users.
11+
12+
2. **Contact the repository maintainer(s) privately.** Send a private message or email to the maintainer(s) with a detailed description of the vulnerability. Include the following information:
13+
14+
- The affected component(s)
15+
- Steps to reproduce the issue
16+
- Potential impact of the vulnerability
17+
- Any possible mitigations or workarounds
18+
19+
3. **Wait for a response from the maintainer(s).** Please be patient, as they may need time to investigate and verify the issue. The maintainer(s) should acknowledge receipt of your report and provide an estimated time frame for addressing the vulnerability.
20+
21+
4. **Cooperate with the maintainer(s).** If requested, provide additional information or assistance to help resolve the issue.
22+
23+
5. **Do not disclose the vulnerability until the maintainer(s) have addressed it.** Once the issue has been resolved, the maintainer(s) may choose to publicly disclose the vulnerability and credit you for the discovery.
24+
25+
## Reporting Secrets
26+
27+
If you discover any secrets, such as API keys or passwords, within the repository, follow these steps:
28+
29+
1. **Do not share the secret or use it for unauthorized purposes.** Misusing a secret could have severe consequences for the project and its users.
30+
31+
2. **Contact the repository maintainer(s) privately.** Notify them of the discovered secret, its location, and any potential risks associated with it.
32+
33+
3. **Wait for a response and further instructions.**
34+
35+
## Responsible Disclosure
36+
37+
We encourage responsible disclosure of vulnerabilities and secrets. If you follow the steps outlined in this policy, we will work with you to understand and address the issue. We will not take legal action against individuals who discover and report vulnerabilities or secrets in accordance with this policy.
38+
39+
## Patching and Updates
40+
41+
We are committed to maintaining the security of our project. When vulnerabilities are reported and confirmed, we will:
42+
43+
1. Work diligently to develop and apply a patch or implement a mitigation strategy.
44+
2. Keep the reporter informed about the progress of the fix.
45+
3. Update the repository with the necessary patches and document the changes in the release notes or changelog.
46+
4. Credit the reporter for the discovery, if they wish to be acknowledged.
47+
48+
## Contributing to Security
49+
50+
We welcome contributions that help improve the security of our project. If you have suggestions or want to contribute code to address security issues, please follow the standard contribution guidelines for this repository. When submitting a pull request related to security, please mention that it addresses a security issue and provide any necessary context.
51+
52+
By adhering to this security policy, you contribute to the overall security and stability of the project. Thank you for your cooperation and responsible handling of vulnerabilities and secrets.
53+

0 commit comments

Comments
 (0)