Skip to content

Commit

Permalink
feat: add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
AprilNEA committed Jun 20, 2023
1 parent 99c92bb commit 0ef36e2
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 290 deletions.
66 changes: 66 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<div align="center">
<img src="./docs/icon.svg" alt="预览"/>

<h1 align="center">ChatGPT Admin Web</h1>

免费部署你的商业 ChatGPT 网页应用。

[暂无 Demo] / [Issues](https://github.com/AprilNEA/ChatGPT-Admin-Web/issues) / [Discord](https://discord.gg/y4vxgqfUW) / [Telegram](https://github.com/AprilNEA/ChatGPT-Admin-Web)

[GitHub Sponsor](https://github.com/sponsors/AprilNEA) / [爱发电](https://afdian.net/a/aprilnea)

![主界面](./docs/cover.png)

</div>

## 功能

- 面具 Mask 和提示词列表
- 用户管理、订单管理和订阅管理
- 支付接口
- 第三方支付接口
-[x]虎皮椒
- 文本安全
-[ ] 敏感词过滤
-[x] 第三方过滤
- 模型接入
-[x] OpenAI
-[ ] Bing
- 收益模式
-[ ] 广告
-[ ] 分销

<details><summary>思维导图</summary>

![System](./docs/system.svg)

</details>

## Features

- Mask and prompt list
- User management, order management and subscription management
- Payment interface
- Third party payment interface
-[x]Xunhu Pay
- Text Security
-[ ] Sensitive word filter
-[x] Third-party filtering
- Model Access
-[x] OpenAI
-[ ] Bing
- Revenue model
-[ ] Advertising
-[ ] Distribution

## Start

请查看[文档](https://caw.sku.moe)

Please see [documentation](https://caw.sku.moe)

## 捐赠

感谢您的激励,能让该项目持续发展。

[GitHub Sponsor](https://github.com/sponsors/AprilNEA) | [爱发电](https://afdian.net/a/aprilnea)
76 changes: 54 additions & 22 deletions apps/chat/.env.template
Original file line number Diff line number Diff line change
@@ -1,29 +1,61 @@
# 网站相关设置

# Your openai api key. (required)
OPENAI_API_KEY=sk-xxxx
# 这是用来加密用户的令牌的密钥,我们建议您在此生成
# https://1password.com/password-generator/
JWT_SECRET=
# 标题
NEXT_PUBLIC_TITLE=
# 公众号
NEXT_PUBLIC_WECHAT_OA=

# Access passsword, separated by comma. (optional)
CODE=your-password
# Database
DATABASE_URL=postgres://<user>:<password>@<host>/<db-name>?pgbouncer=true&connect_timeout=10
DIRECT_URL=postgres://<user>:<password>@<host>/<db-name>?pgbouncer=true&connect_timeout=10
#SHADOW_DATABASE_URL=

# You can start service behind a proxy
PROXY_URL=http://localhost:7890
# 如果你想使用 Redis 进行用户速率的限制,你可以在下方填入 U
REDIS_URL=
REDIS_TOKEN=

# Override openai api request base url. (optional)
# Default: https://api.openai.com
# Examples: http://your-openai-proxy.com
BASE_URL=
# 使用 OPENAI 模型的 BASE 和 Key
# 支持 api2d, closeAI 等第三方平台
OPENAI_BASE=https://renailu.deno.dev
OPENAI_KEY=JqHFaJXdFRrU3rjqNqD2

# Specify OpenAI organization ID.(optional)
# Default: Empty
# If you do not want users to input their own API key, set this value to 1.
OPENAI_ORG_ID=
# 支付信息
DOMAIN=https://lmo.best
CALLBACK_DOMAIN=https://wxtest.deno.dev
# 虎皮椒的 appid 和 appsecret
XUNHU_PAY_APPID=
XUNHU_PAY_APPSECRET=

# (optional)
# Default: Empty
# If you do not want users to input their own API key, set this value to 1.
HIDE_USER_API_KEY=
# 若不启用邮箱注册,请将该部分留空
NEXT_PUBLIC_EMAIL_SERVICE=

# (optional)
# Default: Empty
# If you do not want users to use GPT-4, set this value to 1.
DISABLE_GPT4=
MAILGUN_EMAIL_DOMAIN=
MAILGUN_EMAIL_API_KEY=

ELASTICE_EMAIL_API_KEY=
ELASTICE_EMAIL_SENDER=

# SMS 短信
SMS_SERVICE=uni
# UniSMS 的 key
SMS_UNI_KEY_ID=
# 在 UniSMS 中申请的签名,发送+86的短信请保证签名中带有中文
SMS_UNI_SIGNATURE=

# 文本安全配置,当前支持 baidu 或 tencent
TEXT_SECURITY=

TENCENT_SECRETID=
TENCENT_SECRETKEY=

BAIDU_APIKEY=
BAIDU_SECRETKEY=

# 微信登录配置,填入公众号的 appid 和 appsecret
# 公众号必须通过企业认证且为订阅号
WECHAT_PROXY=
WECHAT_APP_ID=
WECHAT_APP_SECRET=
32 changes: 16 additions & 16 deletions apps/chat/app/components/auth/auth.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import styles from "./auth.module.scss";
import { IconButton } from "../button/button";
import {IconButton} from "../button/button";

import { NavigateFunction, useNavigate } from "react-router-dom";
import { Path } from "../../constant";
import {NavigateFunction, useNavigate} from "react-router-dom";
import {Path} from "../../constant";

import Locale from "../../locales";

import BotIcon from "../../icons/bot.svg";
import React, { FormEvent, useCallback, useState } from "react";
import React, {FormEvent, useCallback, useState} from "react";

import usePreventFormSubmit from "@/app/hooks/use-prevent-form";
import { useUserStore } from "@/app/store";
import { Input, showToast } from "@/app/components/ui-lib/ui-lib";
import {useUserStore} from "@/app/store";
import {Input, showToast} from "@/app/components/ui-lib/ui-lib";
import Locales from "@/app/locales";
import {
apiUserLoginGet,
Expand All @@ -20,9 +20,9 @@ import {
apiUserRegister,
apiUserRegisterCode,
} from "@/app/api";
import { serverStatus } from "@caw/types";
import {serverStatus} from "@caw/types";
import useIntervalAsync from "@/app/hooks/use-interval-async";
import { Loading } from "@/app/components/loading";
import {Loading} from "@/app/components/loading";
import Image from "next/image";

const emailService = process.env.NEXT_PUBLIC_EMAIL_SERVICE;
Expand Down Expand Up @@ -64,7 +64,7 @@ const PhoneLogin: React.FC = () => {
Locales.User.PleaseInput(`${Locales.User.Phone}, ${Locales.User.Code}`),
);

const res = await apiUserRegister({ phone: phone, verificationCode: code });
const res = await apiUserRegister({phone: phone, verificationCode: code});

switch (res.status) {
case serverStatus.success: {
Expand Down Expand Up @@ -193,7 +193,7 @@ const EmailLogin: React.FC = () => {
</div>

<div className={styles["auth-actions"]}>
<IconButton text={Locale.Auth.Confirm} type="primary" />
<IconButton text={Locale.Auth.Confirm} type="primary"/>
</div>
</div>
);
Expand All @@ -202,6 +202,7 @@ const EmailLogin: React.FC = () => {
const WeChatLogin: React.FC = () => {
const navigate = useNavigate();
const [ticket, setTicket] = useState("");
const updateSessionToken = useUserStore((state) => state.updateSessionToken);

useIntervalAsync(
useCallback(async () => {
Expand All @@ -221,13 +222,12 @@ const WeChatLogin: React.FC = () => {
return;
}
}
}, [ticket]),
}, [ticket, navigate, updateSessionToken]),
3000,
);

const updateSessionToken = useUserStore((state) => state.updateSessionToken);

if (!ticket) return <Loading noLogo={true} />;
if (!ticket) return <Loading noLogo={true}/>;

return (
<div className={styles["form-container"]}>
Expand All @@ -249,15 +249,15 @@ export function AuthPage() {
return (
<div className={styles["auth-page"]}>
<div className={`no-dark ${styles["auth-logo"]}`}>
<BotIcon />
<BotIcon/>
</div>

<div className={styles["auth-title"]}>{Locale.Auth.Title}</div>
<div className={styles["auth-tips"]}>{Locale.Auth.Tips}</div>

<div className={styles["auth-container"]}>
<div className={styles["wechat-part"]}>
<WeChatLogin />
<WeChatLogin/>
</div>

<div className={styles["password-part"]}>
Expand All @@ -281,7 +281,7 @@ export function AuthPage() {
</button>
)}
</div>
{tab === "phone" ? <PhoneLogin /> : <EmailLogin />}
{tab === "phone" ? <PhoneLogin/> : <EmailLogin/>}
</div>
</div>
</div>
Expand Down
Binary file added docs/cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 0ef36e2

Please sign in to comment.