Skip to content

Commit 47ae193

Browse files
committed
Initial commit
1 parent 3634b2f commit 47ae193

Some content is hidden

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

81 files changed

+24217
-0
lines changed

.github/workflows/ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [dev, master]
6+
pull_request:
7+
branches: [dev]
8+
9+
jobs:
10+
build:
11+
name: Build & Test
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
node-version: ["lts/gallium", "lts/hydrogen", "current"]
16+
steps:
17+
- name: Checkout 🛎️
18+
uses: actions/checkout@v3
19+
with:
20+
persist-credentials: false
21+
22+
- uses: actions/setup-node@v3
23+
with:
24+
node-version: 16
25+
26+
- run: npm ci
27+
28+
- run: npm run test
29+
30+
- run: npm run build --if-present
31+
lint:
32+
name: format and lint
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Checkout 🛎️
36+
uses: actions/checkout@v3
37+
with:
38+
persist-credentials: false
39+
40+
- uses: actions/setup-node@v3
41+
with:
42+
node-version: 16
43+
- run: npm ci
44+
45+
- run: npm run format
46+
47+
- run: npm run lint

.gitignore

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
pnpm-lock.yaml
8+
9+
# testing
10+
/coverage
11+
12+
# next.js
13+
/.next/
14+
/.swc/
15+
/out/
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+
41+
/dist
42+
public/sitemap-0.xml
43+
src/assets/resources/**/*.json
44+
45+
.vercel
46+
.env

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# ChatDiffusion - An ChatGPT web UI that integrates with variety of online Stable Diffusion services
2+
3+
[![ci](https://github.com/prompt-engineering/chat-diffusion/actions/workflows/ci.yml/badge.svg)](https://github.com/prompt-engineering/chat-diffusion/actions/workflows/ci.yml)
4+
![GitHub](https://img.shields.io/github/license/prompt-engineering/chat-diffusion)
5+
[![Discord](https://img.shields.io/discord/1082563233593966612)](https://discord.gg/FSWXq4DmEj)
6+
7+
English | [简体中文](./README.zh-CN.md)
8+
9+
Online Demo:
10+
11+
Join us:
12+
13+
[![Chat Server](https://img.shields.io/badge/chat-discord-7289da.svg)](https://discord.gg/FSWXq4DmEj)
14+
15+
## Only support client-side (browser) call to OpenAI at this moment
16+
17+
## Local Usage
18+
19+
1. Clone the [ChatDiffusion](https://github.com/prompt-engineering/chat-diffusion) from GitHub.
20+
2. Run `npm install`.
21+
3. You can now use the application by running `npm run dev`.
22+
23+
## LICENSE
24+
25+
This code is distributed under the MIT license. See [LICENSE](./LICENSE) in this directory.

README.zh-CN.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# ChatDiffusion - 集成了在线 AI 绘画功能的 ChatGPT UI
2+
3+
[![ci](https://github.com/prompt-engineering/chat-diffusion/actions/workflows/ci.yml/badge.svg)](https://github.com/prompt-engineering/chat-diffusion/actions/workflows/ci.yml)
4+
![GitHub](https://img.shields.io/github/license/prompt-engineering/chat-diffusion)
5+
6+
[English](./README.md) | 简体中文
7+
8+
## 目前仅支持客户端(浏览器)访问 OpenAI,服务器端调用正在开发中
9+
10+
## 本地搭建
11+
12+
1. 从 GitHub 克隆 [ChatVisualNovel](https://github.com/prompt-engineering/chat-diffusion)
13+
2. 执行 `npm install`
14+
3. 直接运行 `npm run dev` 就可以使用了。
15+
16+
## LICENSE
17+
18+
This code is distributed under the MIT license. See [LICENSE](./LICENSE) in this directory.

docs/CONTRIBUTING.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Contributor Manual
2+
3+
We welcome contributions of any size and skill level. As an open source project, we believe in giving back to our contributors and are happy to help with guidance on PRs, technical writing, and turning any feature idea into a reality.
4+
5+
> **Tip for new contributors:**
6+
> Take a look at [https://github.com/firstcontributions/first-contributions](https://github.com/firstcontributions/first-contributions) for helpful information on contributing
7+
8+
## Quick Guide
9+
10+
### Prerequisite
11+
12+
```shell
13+
node: ">=16.0.0"
14+
npm: "^8.11.0"
15+
# otherwise, your build will fail
16+
```
17+
18+
### Setting up your local repo
19+
20+
```shell
21+
git clone && cd ...
22+
npm install
23+
npm run build
24+
```
25+
26+
### Development
27+
28+
```shell
29+
# starts a file-watching, live-reloading dev script for active development
30+
npm run dev
31+
# build the entire project, one time.
32+
npm run build
33+
```
34+
35+
### Running tests
36+
37+
```shell
38+
# run this in the top-level project root to run all tests
39+
npm run test
40+
```
41+
42+
### Making a Pull Request
43+
44+
You can run the following commands before making a Pull Request
45+
46+
```shell
47+
# format with fix
48+
npm run format:fix
49+
# lint with fix
50+
npm run lint:fix
51+
```
52+
53+
## Code Structure
54+
55+
TODO
56+
57+
## Translation
58+
59+
See [i18n guide](TRANSLATING.md)

docs/TRANSLATING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# 🌐 <abbr title="internationalization">i18n</abbr> Guide
2+
3+
Thanks for your interest in helping us translate ClickPrompt!
4+
5+
TODO

i18n/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# i18n files
2+
3+
Inside this folder, the first folder level is locale code such as `en-US`, and in it has A LOT of json files the naming convention is:
4+
5+
- Global data is in the `$.json` file.
6+
- For specific page data:
7+
- index page is corresponding to `_.json` file
8+
- other pages just use pathname without trailing slash and locale segment, and replace all `/` with `_`(cause in some filesystem `/` is illegal charactor in pathname). such as `_foo.json` for `/foo/`, `_foo_bar.json` for `/foo/bar/` . I think you get the idea.
9+
10+
# HOW TO USE IN RSC(React server component)
11+
12+
```typescript jsx
13+
// page.server.tsx
14+
import { getAppData } from "@/i18n";
15+
import CSC from "./component.client.tsx";
16+
17+
async function RscFoo() {
18+
// ...
19+
const { locale, pathname, i18n } = await getAppData();
20+
const t = i18n.tFactory("/");
21+
// t is a function takes key and give you value in the json file
22+
t("title"); // will be "Streamline your prompt design"
23+
24+
// you can also access global data by
25+
const g = i18n.g;
26+
27+
const i18nProps: GeneralI18nProps = {
28+
locale,
29+
pathname,
30+
i18n: {
31+
dict: i18n.dict,
32+
},
33+
};
34+
35+
// use i18n in CSC (client side component)
36+
return <CSC {...i18nProps} />;
37+
// ...
38+
}
39+
```
40+
41+
```typescript jsx
42+
// component.client.tsx
43+
"use client";
44+
45+
export default function CSC({ i18n }: GeneralI18nProps) {
46+
const { dict } = i18n;
47+
48+
// use dict like plain object here
49+
}
50+
```

i18n/en-US/$.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

i18n/en-US/_.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"select_api_type": "Please select how would you like to access ChatGPT:",
3+
"select_api_type_note": "This application currently only support calling OpenAI directly from your browser.\nPlease make sure you can access OpenAI server.\nOpenAI may block users accessing outside of allowed areas.",
4+
"client": "Client-side",
5+
"server": "Server-side",
6+
"openai_api_key": "Use your OpenAI API key:",
7+
"huggingface_access_token": "Use your Hugging Face Access Token:",
8+
"sign_up": "Sign up for the",
9+
"create_new": "Create a new",
10+
"copy_paste": "Copy and paste",
11+
"go": "Go",
12+
"enter_openai_api_key": "Please enter your OpenAI API key.",
13+
"enter_huggingface_access_token": "Please enter your Hugging Face access token"
14+
}

i18n/zh-CN/$.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

0 commit comments

Comments
 (0)