Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/svelte-spa-router-4.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Niek authored Oct 17, 2024
2 parents f8f746d + c82a63e commit eb70f45
Show file tree
Hide file tree
Showing 38 changed files with 2,567 additions and 891 deletions.
45 changes: 45 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,51 @@
"contributions": [
"code"
]
},
{
"login": "MaksimMisin",
"name": "Maksim Misin",
"avatar_url": "https://avatars.githubusercontent.com/u/6176998?v=4",
"profile": "https://github.com/MaksimMisin",
"contributions": [
"code"
]
},
{
"login": "romainwg",
"name": "romain.wg",
"avatar_url": "https://avatars.githubusercontent.com/u/22281217?v=4",
"profile": "https://r-wg.it/",
"contributions": [
"doc"
]
},
{
"login": "morgan9e",
"name": "Morgan",
"avatar_url": "https://avatars.githubusercontent.com/u/53516171?v=4",
"profile": "https://morgan.kr",
"contributions": [
"code"
]
},
{
"login": "UdonCodes",
"name": "Udon",
"avatar_url": "https://avatars.githubusercontent.com/u/143291288?v=4",
"profile": "https://codeberg.org/udon",
"contributions": [
"design"
]
},
{
"login": "Ryan526",
"name": "Ryan526",
"avatar_url": "https://avatars.githubusercontent.com/u/11861916?v=4",
"profile": "https://github.com/Ryan526",
"contributions": [
"code"
]
}
],
"files": [
Expand Down
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
#VITE_API_BASE=http://localhost:5174
#VITE_ENDPOINT_COMPLETIONS=/v1/chat/completions
#VITE_ENDPOINT_MODELS=/v1/models
#VITE_OPENAI_API_KEY="your-openai-api-key"
9 changes: 6 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Linting
# Run on PRs only
on:
pull_request:
types: [opened, reopened]
branches: [main]

jobs:
lint:
Expand All @@ -15,7 +15,10 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'

- name: Lint
run: npm ci && npx eslint .
run: npm ci && npx eslint .

- name: Build
run: npm run build
4 changes: 2 additions & 2 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'

- name: Build
run: npm ci && npm run lint && npm run build:github

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18-alpine
FROM node:20-alpine

ADD . /work
WORKDIR /work
Expand Down
76 changes: 64 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# ChatGPT-web

[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/Niek/chatgpt-web/pages.yml?style=flat-square)](https://github.com/Niek/chatgpt-web/actions/workflows/pages.yml)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square)](https://standardjs.com)
[![GitHub](https://img.shields.io/github/license/Niek/chatgpt-web)](/LICENSE)
[![All Contributors](https://img.shields.io/github/all-contributors/Niek/chatgpt-web?color=ee8449&style=flat-square)](#contributors)

## **URL**: https://niek.github.io/chatgpt-web/
## **URL**: <https://niek.github.io/chatgpt-web/>

![Screenshot of ChatGPT-web](.github/screenshot.png)


ChatGPT-web is a simple one-page web interface to the OpenAI ChatGPT API. To use it, you need to register for [an OpenAI API key](https://platform.openai.com/account/api-keys) first. All messages are stored in your browser's local storage, so everything is **private**. You can also close the browser tab and come back later to continue the conversation.

## Features

* **Open source**: ChatGPT-web is open source ([GPL-3.0](/LICENSE)), so you can host it yourself and make changes as you want.
* **Private**: All chats and messages are stored in your browser's local storage, so everything is private.
* **Customizable**: You can customize the prompt, the temperature, and other model settings. Multiple models (including GPT-4) are supported.
Expand All @@ -26,35 +27,81 @@ ChatGPT-web is a simple one-page web interface to the OpenAI ChatGPT API. To use
* **Image generation**: ChatGPT-web can generate images using the DALL·E model by using the prompt "show me an image of ...".
* **Streaming**: ChatGPT-web can stream the response from the API, so you can see the response as it's being generated.

## Development
## Development and Building

To run the development server, run
Here’s how to participate in development and prepare your build for production:

### Setting Up and Running the Development Server

To install dependencies and start the development server:

```bash
npm ci
npm run dev # or: npm run build
npm run dev
```

To update the [`awesome-chatgpt-prompts`](/src/awesome-chatgpt-prompts/) subtree, run :
### Preparing the Production Build

To compile the project for production, ensuring optimal performance:

```bash
npm run build
```

This command generates a `dist` folder containing the production build of your project, ready for deployment.

### Incorporating Awesome ChatGPT Prompts

The *[Awesome ChatGPT Prompts](/src/awesome-chatgpt-prompts/)* repository is a treasure trove of prompt examples designed for use with the ChatGPT model. This collection can inspire new conversations or expand existing ones with the model. Get involved by adding your prompts or utilizing the repository to inspire your contributions:

To update and integrate the latest prompts from the repository into your project, run:

```bash
git subtree pull --prefix src/awesome-chatgpt-prompts https://github.com/f/awesome-chatgpt-prompts.git main --squash
```

## Use with Docker compose
This command synchronizes the latest set of prompts into your project's `src/awesome-chatgpt-prompts/` directory, fostering an environment of continuous innovation and expansion.

## Using Docker Compose for Local Deployment

Deploying the application and its mocked API locally is streamlined using Docker Compose. By executing the following command, you initialize both services effortlessly:

```bash
docker compose up -d
```

## Mocked api
If you don't want to wait for the API to respond, you can use the mocked API instead. To use the mocked API, edit the `.env` file at root of the project and set the key `VITE_API_BASE=http://localhost:5174` in it. Then, run the `docker compose up -d` command above.
### Accessing the Local Web Service

You can customize the mocked API response by sending a message that consists of `d` followed by a number, it will delay the response the the specified number of seconds. You can customize the length of the response by including `l` followed by a number, it will return a response with the specified number of sentences.
For example, sending the message `d2 l10` will result in a 2 seconds delay and 10 sentences response.
Upon successfully running the Docker Compose command, the local version of the web service becomes accessible. You can interact with it by visiting: <http://localhost:5173/>

## Mocked API Usage

For instances where immediate API responses are preferred, consider utilizing the mocked API. Follow the steps below to configure and customize your mocked API responses:

* **Configuration**:
* Open the `.env` file located at the project's root.
* Assign the key `VITE_API_BASE=http://localhost:5174` to redirect requests to the mocked API.
* Execute `docker compose up -d mocked_api` to start the mocked API service.

* **Customizing Responses**:
* To introduce a delay in the API response, use `d` followed by the desired number of seconds (e.g., `d2` for a 2-second delay).
* To specify the length of the response, use `l` followed by the desired number of sentences (e.g., `l10` for a response of 10 sentences).
* For instance, sending `d2 l10` configures the mocked API to delay the response by 2 seconds and to include 10 sentences.

## Desktop app

You can also use ChatGPT-web as a desktop app. To do so, [install Rust first](https://www.rust-lang.org/tools/install). Then, simply run `npm run tauri dev` for the development version or `npm run tauri build` for the production version of the desktop app. The desktop app will be built in the `src-tauri/target` folder.
To use ChatGPT-web as a desktop application:

* **Installation**: First, ensure [Rust is installed](https://www.rust-lang.org/tools/install) on your computer.

* **Development Version**:
* Run `npm run tauri dev` to start the desktop app in development mode.

* **Production Version**:
* Use `npm run tauri build` to compile the production version of the app.

* **Location of the Built Application**:
* The built application will be available in the `src-tauri/target` folder.

## Contributors

Expand Down Expand Up @@ -92,6 +139,11 @@ You can also use ChatGPT-web as a desktop app. To do so, [install Rust first](ht
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/nielthiart"><img src="https://avatars.githubusercontent.com/u/154435?v=4?s=100" width="100px;" alt="Niel Thiart"/><br /><sub><b>Niel Thiart</b></sub></a><br /><a href="https://github.com/Niek/chatgpt-web/commits?author=nielthiart" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/MaksimMisin"><img src="https://avatars.githubusercontent.com/u/6176998?v=4?s=100" width="100px;" alt="Maksim Misin"/><br /><sub><b>Maksim Misin</b></sub></a><br /><a href="https://github.com/Niek/chatgpt-web/commits?author=MaksimMisin" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://r-wg.it/"><img src="https://avatars.githubusercontent.com/u/22281217?v=4?s=100" width="100px;" alt="romain.wg"/><br /><sub><b>romain.wg</b></sub></a><br /><a href="https://github.com/Niek/chatgpt-web/commits?author=romainwg" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://morgan.kr"><img src="https://avatars.githubusercontent.com/u/53516171?v=4?s=100" width="100px;" alt="Morgan"/><br /><sub><b>Morgan</b></sub></a><br /><a href="https://github.com/Niek/chatgpt-web/commits?author=morgan9e" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://codeberg.org/udon"><img src="https://avatars.githubusercontent.com/u/143291288?v=4?s=100" width="100px;" alt="Udon"/><br /><sub><b>Udon</b></sub></a><br /><a href="#design-UdonCodes" title="Design">🎨</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Ryan526"><img src="https://avatars.githubusercontent.com/u/11861916?v=4?s=100" width="100px;" alt="Ryan526"/><br /><sub><b>Ryan526</b></sub></a><br /><a href="https://github.com/Niek/chatgpt-web/commits?author=Ryan526" title="Code">💻</a></td>
</tr>
</tbody>
</table>
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3"

services:
chatgpt_web:
container_name: chatgpt_web
Expand Down
4 changes: 2 additions & 2 deletions mocked_api/Dockerfile-mockapi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM python:3.10.10-alpine3.17
FROM python:3-alpine
WORKDIR /work

RUN pip install "fastapi<1.0" "uvicorn<0.22" "lorem-text<=2.1.x"
RUN pip install "fastapi<1.0" "uvicorn<0.22" "lorem-text<=2.1"
COPY mocked_api/mock_api.py .
COPY mocked_api/models_response.json .

Expand Down
Loading

0 comments on commit eb70f45

Please sign in to comment.