Skip to content

Commit

Permalink
feat: Add prompt module
Browse files Browse the repository at this point in the history
  • Loading branch information
Peek-A-Booo committed May 7, 2023
1 parent 4240e07 commit f9777bd
Show file tree
Hide file tree
Showing 52 changed files with 1,747 additions and 1,221 deletions.
12 changes: 6 additions & 6 deletions .env.local.demo
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# OpenAI Key. eg: sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# OpenAI API Key. eg: sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
NEXT_PUBLIC_OPENAI_API_KEY=
# Your own openai api proxy url. If empty here, default proxy will be https://api.openai.com
# Your own OpenAI API proxy address. If left empty, https://api.openai.com will be used by default.
NEXT_PUBLIC_OPENAI_API_PROXY=

# Azure OpenAI Key. eg: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Azure OpenAI API Key. eg: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
NEXT_PUBLIC_AZURE_OPENAI_API_KEY=
# your own Azure OpenAI api proxy url. If it is empty, the Azure OpenAI Service will not function properly.
NEXT_PUBLIC_AZURE_OPENAI_API_PROXY=
# Resource name for Azure OpenAI Service. If empty, Azure OpenAI Service will not be able to be used.
NEXT_PUBLIC_AZURE_OPENAI_RESOURCE_NAME=

# set your own sentry dsn. if empty here, it will not report error to sentry
# Set your own sentry dsn. if empty, it will not report error to sentry
NEXT_PUBLIC_SENTRY_DSN=
17 changes: 17 additions & 0 deletions CHANGE_LOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# L-GPT Change Log

## v0.2.0

> 2023-05-07
### Fixed

- Fixed the issue of incorrect input box position caused by the vertical scroll bar appearing on some mobile browsers

### Add

- Introduce prompt words and prompt word templates

### Changed

- Refactor some pages and interaction logic
- Improve the error message content for front-end fetch requests

## v0.1.3

> 2023-04-28
Expand Down
55 changes: 32 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,33 @@

English / [简体中文](./README_CN.md)

L-GPT is an open-source project that imitates the OpenAI ChatGPT. [Demo](https://gpt.ltops.cn)
L-GPT is an open-source project that helps you improve your learning, work, and life efficiency by providing various AI models. [Demo](https://gpt.ltopx.com)

[QQ 群](./public/screenshots/qq.jpeg)

<img src="./public/screenshots/screenshot.png">
## Preview

<img src="./public/screenshots/screenshot-pc.png">

<img src="./public/screenshots/screenshot-m.png">

## Features

- Deploy for free on Vercel
- Responsive design, dark mode and PWA
- Responsive design and dark mode
- Safe, all data based on local
- Support i18n
- Support Azure OpenAI Service
- Support [Azure OpenAI Service](./azure.md)
- Support configuration and use of custom prompt

## Next

- [x] Support Azure OpenAI
- [ ] Introduce prompt words and prompt word templates
- [ ] Support GPT-4 and Claude
- [ ] Desktop version development?
- [x] Introduce prompt words and prompt word templates
- [ ] Chat record import and export
- [ ] Support GPT-4 and Claude
- [ ] Compress context to save chat tokens
- [ ] Desktop version development

## Deploy on Vercel

Expand All @@ -34,26 +39,26 @@ Get your own website.

# Prefer using user-configured key.
# If user hasn't configured, then use this key.
# If neither are configured, it is not possible to use.
# sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# If neither are configured, it is not possible to use OpenAI API.
# eg: sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
NEXT_PUBLIC_OPENAI_API_KEY=

# Prefer using user-configured proxy address.
# If the user hasn't configured, then use this proxy.
# If none of these are being used, then connect directly to the Open AI official address: https://api.openai.com.
NEXT_PUBLIC_OPENAI_API_PROXY=

# Set Your Azure OpenAI key.
# Set Your Azure OpenAI API key.
NEXT_PUBLIC_AZURE_OPENAI_API_KEY=

# Set Your Azure OpenAI proxy.
NEXT_PUBLIC_AZURE_OPENAI_API_PROXY=
# Set Your Azure OpenAI API resource name.
NEXT_PUBLIC_AZURE_OPENAI_RESOURCE_NAME=

# set your own sentry dsn. if empty here, it will not report error to sentry
NEXT_PUBLIC_SENTRY_DSN=
```

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/Peek-A-Booo/L-GPT&env=NEXT_PUBLIC_OPENAI_API_KEY&env=NEXT_PUBLIC_OPENAI_API_PROXY&env=NEXT_PUBLIC_AZURE_OPENAI_API_KEY&env=NEXT_PUBLIC_AZURE_OPENAI_API_PROXY&env=NEXT_PUBLIC_SENTRY_DSN)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/Peek-A-Booo/L-GPT&env=NEXT_PUBLIC_OPENAI_API_KEY&env=NEXT_PUBLIC_OPENAI_API_PROXY&env=NEXT_PUBLIC_AZURE_OPENAI_API_KEY&env=NEXT_PUBLIC_AZURE_OPENAI_RESOURCE_NAME&env=NEXT_PUBLIC_SENTRY_DSN)

## Running Local

Expand Down Expand Up @@ -86,10 +91,10 @@ Rename .evn.local.demo to .env.local and configure it.
NEXT_PUBLIC_OPENAI_API_KEY=
# your own OpenAI Api proxy url.
NEXT_PUBLIC_OPENAI_API_PROXY=
# Azure OpenAI Key. eg: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Azure OpenAI API Key. eg: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
NEXT_PUBLIC_AZURE_OPENAI_API_KEY=
# your own Azure OpenAI api proxy url. If it is empty, the Azure OpenAI Service will not function properly.
NEXT_PUBLIC_AZURE_OPENAI_API_PROXY=
# Azure OpenAI resource name.
NEXT_PUBLIC_AZURE_OPENAI_RESOURCE_NAME=
# set your own sentry dsn. if empty here, it will not report error to sentry
NEXT_PUBLIC_SENTRY_DSN=
```
Expand All @@ -110,10 +115,14 @@ pnpm build && pnpm start

You can configure the following environment variables.

| Environment Variable | Desc | Required | Default |
| ------------------------------------ | ------------------------------------------------------------- | -------- | ------------------------ |
| `NEXT_PUBLIC_OPENAI_API_KEY` | your OpenAI API Key | false | |
| `NEXT_PUBLIC_OPENAI_API_PROXY` | your OpenAI API proxy server | false | `https://api.openai.com` |
| `NEXT_PUBLIC_AZURE_OPENAI_API_KEY` | your Azure OpenAI API Key | false | |
| `NEXT_PUBLIC_AZURE_OPENAI_API_PROXY` | your Azure OpenAI API proxy server | false | |
| `NEXT_PUBLIC_SENTRY_DSN` | your sentry dsn. If empty, it will not report error to sentry | false | |
| Environment Variable | Desc | Required | Default |
| ---------------------------------------- | --------------------------------------------------------------- | -------- | ------------------------ |
| `NEXT_PUBLIC_OPENAI_API_KEY` | your OpenAI API Key | false | |
| `NEXT_PUBLIC_OPENAI_API_PROXY` | your OpenAI API proxy server | false | `https://api.openai.com` |
| `NEXT_PUBLIC_AZURE_OPENAI_API_KEY` | your Azure OpenAI API Key. [View Example](./azure.md) | false | |
| `NEXT_PUBLIC_AZURE_OPENAI_RESOURCE_NAME` | your Azure OpenAI API resource name. [View Example](./azure.md) | false | |
| `NEXT_PUBLIC_SENTRY_DSN` | your sentry dsn. If empty, it will not report error to sentry | false | |

## Contact

Any questions, please feel free to join our QQ group or contact us on [Twitter](https://twitter.com/peekbomb).
51 changes: 30 additions & 21 deletions README_CN.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
# L-GPT

L-GPT 是一项开源项目,借助 OpenAI Api 模仿了 ChatGPT 的功能[Demo](https://gpt.ltops.cn)
L-GPT 是一款开源项目,通过提供不同的 AI 模型来帮助你提高学习、工作、生活的效率[Demo](https://gpt.ltopx.com)

[QQ 群](./public/screenshots/qq.jpeg)

<img src="./public/screenshots/screenshot.png">
## 预览

<img src="./public/screenshots/screenshot-pc.png">

<img src="./public/screenshots/screenshot-m.png">

## 特性

- 一键免费发布到 Vercel
- 支持响应式,暗黑模式和 PWA
- 安全,所有数据均基于本地存储
- 支持 i18n
- 支持 Azure OpenAI Service
- 支持 [Azure OpenAI Service](./azure_CN.md)
- 支持配置和使用自定义 prompt

## 下一步计划

- [x] 支持 Azure OpenAI
- [ ] 引入提示词以及提示词模板
- [ ] 支持 GPT-4 和 Claude
- [ ] 桌面版本开发?
- [x] 引入提示词以及提示词模板
- [ ] 聊天记录导入导出
- [ ] 支持 GPT-4 和 Claude
- [ ] 压缩上下文,节省聊天 token
- [ ] 桌面版本开发

## 发布到 Vercel

Expand All @@ -32,26 +37,26 @@ L-GPT 是一项开源项目,借助 OpenAI Api 模仿了 ChatGPT 的功能。 [

# 优先使用用户配置key
# 用户没有配置则使用此key
# 都没配置则无法使用
# sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# 都没配置则无法使用OpenAI API服务
# 示例:sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
NEXT_PUBLIC_OPENAI_API_KEY=

# 优先使用用户配置的代理地址
# 用户没有配就使用此代理
# 都没有使用则直连Open AI 官方地址:https://api.openai.com
NEXT_PUBLIC_OPENAI_API_PROXY=

# 配置你的 Azure OpenAI key.
# 配置你的 Azure OpenAI API key.
NEXT_PUBLIC_AZURE_OPENAI_API_KEY=

# 配置你的 Azure OpenAI proxy.
NEXT_PUBLIC_AZURE_OPENAI_API_PROXY=
# 配置你的 Azure OpenAI 资源名称.
NEXT_PUBLIC_AZURE_OPENAI_RESOURCE_NAME=

# 配置你的 sentry dsn地址。如果为空, 将不会将错误报告到 sentry
NEXT_PUBLIC_SENTRY_DSN=
```

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/Peek-A-Booo/L-GPT&env=NEXT_PUBLIC_OPENAI_API_KEY&env=NEXT_PUBLIC_OPENAI_API_PROXY&env=NEXT_PUBLIC_AZURE_OPENAI_API_KEY&env=NEXT_PUBLIC_AZURE_OPENAI_API_PROXY&env=NEXT_PUBLIC_SENTRY_DSN)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/Peek-A-Booo/L-GPT&env=NEXT_PUBLIC_OPENAI_API_KEY&env=NEXT_PUBLIC_OPENAI_API_PROXY&env=NEXT_PUBLIC_AZURE_OPENAI_API_KEY&env=NEXT_PUBLIC_AZURE_OPENAI_RESOURCE_NAME&env=NEXT_PUBLIC_SENTRY_DSN)

## 本地运行

Expand Down Expand Up @@ -86,8 +91,8 @@ NEXT_PUBLIC_OPENAI_API_KEY=
NEXT_PUBLIC_OPENAI_API_PROXY=
# Azure OpenAI Key: eg: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
NEXT_PUBLIC_AZURE_OPENAI_API_KEY=
# 配置你的Azure OpenAI代理地址。 If it is empty, the Azure OpenAI Service will not function properly.
NEXT_PUBLIC_AZURE_OPENAI_API_PROXY=
# Azure OpenAI 资源名称
NEXT_PUBLIC_AZURE_OPENAI_RESOURCE_NAME=
# 配置你的 sentry dsn地址。如果为空, 将不会将错误报告到 sentry
NEXT_PUBLIC_SENTRY_DSN=
```
Expand All @@ -108,10 +113,14 @@ pnpm build && pnpm start

你可以配置以下环境变量。

| 环境变量 | 描述 | 是否必须配置 | 默认值 |
| ------------------------------------ | --------------------------------------------------------- | ------------ | ------------------------ |
| `NEXT_PUBLIC_OPENAI_API_KEY` | 你个人的 OpenAI API key || |
| `NEXT_PUBLIC_OPENAI_API_PROXY` | 你个人的 OpenAI API 代理地址 || `https://api.openai.com` |
| `NEXT_PUBLIC_AZURE_OPENAI_API_KEY` | 你个人的 Azure OpenAI API key || |
| `NEXT_PUBLIC_AZURE_OPENAI_API_PROXY` | 你个人的 Azure OpenAI API 代理地址 || |
| `NEXT_PUBLIC_SENTRY_DSN` | 你的 sentry dsn 地址。如果为空, 将不会将错误报告到 sentry || |
| 环境变量 | 描述 | 是否必须配置 | 默认值 |
| ---------------------------------------- | ----------------------------------------------------------------- | ------------ | ------------------------ |
| `NEXT_PUBLIC_OPENAI_API_KEY` | 你个人的 OpenAI API key || |
| `NEXT_PUBLIC_OPENAI_API_PROXY` | 你个人的 OpenAI API 代理地址 || `https://api.openai.com` |
| `NEXT_PUBLIC_AZURE_OPENAI_API_KEY` | 你个人的 Azure OpenAI API key。[查看示例](./azure_CN.md) || |
| `NEXT_PUBLIC_AZURE_OPENAI_RESOURCE_NAME` | 你个人的 Azure OpenAI API 服务资源名称。[查看示例](./azure_CN.md) || |
| `NEXT_PUBLIC_SENTRY_DSN` | 你的 sentry dsn 地址。如果为空, 将不会将错误报告到 sentry || |

## 联系方式

有任何疑问欢迎加入 QQ 群或联系 [Twitter](https://twitter.com/peekbomb).
Loading

1 comment on commit f9777bd

@vercel
Copy link

@vercel vercel bot commented on f9777bd May 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

l-gpt – ./

l-gpt.vercel.app
l-gpt-git-main-peek-a-booo.vercel.app
l-gpt-peek-a-booo.vercel.app
gpt.ltopx.com

Please sign in to comment.