Skip to content

Commit

Permalink
refactor: a lot of code
Browse files Browse the repository at this point in the history
  • Loading branch information
Peek-A-Booo committed Jun 13, 2023
1 parent 9c4cdc0 commit 0540903
Show file tree
Hide file tree
Showing 56 changed files with 709 additions and 851 deletions.
2 changes: 2 additions & 0 deletions CHANGE_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### Fixed

- Change the backend token calculation to asynchronous, otherwise it will cause inaccurate calculations.
- Fixed the issue of incorrect calculation of sorting method for menu items on top.

### Add

Expand All @@ -16,6 +17,7 @@
### Changed

- Optimized the front-end logic for calculating tokens, now able to correctly calculate all token consumption.
- Significant code and interaction detail optimizations

## v0.6.0

Expand Down
2 changes: 2 additions & 0 deletions CHANGE_LOG.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### 修复

- 后端计算 token 修改为异步,不然会导致计算不准确
- 修复菜单置顶计算排序方式有误的问题

### 新增

Expand All @@ -16,6 +17,7 @@
### 修改

- 优化前端计算 token 的逻辑,现在能够正确计算所有消耗的 token
- 大量代码和交互细节优化

## v0.6.0

Expand Down
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ In the future, functions will be implemented on the web end first and then synch
- Responsive design and dark mode
- Safe, all data based on local
- Support i18n
- Support [Azure OpenAI Service](./azure.md)
- Support [Azure OpenAI Service](https://docs.ltopx.com/api-key-configure/azure)
- Support configuration and use of custom prompt

## Next
Expand Down Expand Up @@ -143,25 +143,25 @@ 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. [View Example](./azure.md) | false | |
| `NEXT_PUBLIC_AZURE_OPENAI_RESOURCE_NAME` | your Azure OpenAI API resource name. [View Example](./azure.md) | false | |
| `NEXT_AZURE_OPENAI_API_VERSION` | your Azure OpenAI API Version. [View Example](./azure.md) | true | 2023-05-15 |
| `NEXT_PUBLIC_SENTRY_DSN` | your sentry dsn. If empty, it will not report error to sentry | false | |
| `DATABASE_URL` | postgresql database address | true | |
| `EMAIL_SERVER_HOST` | next-auth email server host | true | |
| `EMAIL_SERVER_PORT` | next-auth email server port | true | |
| `EMAIL_SERVER_USER` | next-auth email server user | true | |
| `EMAIL_SERVER_PASSWORD` | next-auth email server password | true | |
| `EMAIL_FROM` | next-auth email from | false | |
| `EMAIL_SECRET` | next-auth email secret | true | |
| `GITHUB_ID` | next-auth github id | true | |
| `GITHUB_SECRET` | next-auth github secret | true | |
| `GOOGLE_CLIENT_ID` | next-auth google client id | true | |
| `GOOGLE_CLIENT_SECRET` | next-auth google client secret | true | |
| 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](https://docs.ltopx.com/api-key-configure/azure) | false | |
| `NEXT_PUBLIC_AZURE_OPENAI_RESOURCE_NAME` | your Azure OpenAI API resource name. [View Example](https://docs.ltopx.com/api-key-configure/azure) | false | |
| `NEXT_AZURE_OPENAI_API_VERSION` | your Azure OpenAI API Version. [View Example](https://docs.ltopx.com/api-key-configure/azure) | true | 2023-05-15 |
| `NEXT_PUBLIC_SENTRY_DSN` | your sentry dsn. If empty, it will not report error to sentry | false | |
| `DATABASE_URL` | postgresql database address | true | |
| `EMAIL_SERVER_HOST` | next-auth email server host | true | |
| `EMAIL_SERVER_PORT` | next-auth email server port | true | |
| `EMAIL_SERVER_USER` | next-auth email server user | true | |
| `EMAIL_SERVER_PASSWORD` | next-auth email server password | true | |
| `EMAIL_FROM` | next-auth email from | false | |
| `EMAIL_SECRET` | next-auth email secret | true | |
| `GITHUB_ID` | next-auth github id | true | |
| `GITHUB_SECRET` | next-auth github secret | true | |
| `GOOGLE_CLIENT_ID` | next-auth google client id | true | |
| `GOOGLE_CLIENT_SECRET` | next-auth google client secret | true | |

## Contact

Expand Down
42 changes: 21 additions & 21 deletions README_CN.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# L-GPT

帮助文档 https://docs.ltopx.com
帮助文档 https://docs.ltopx.com/zh-CN

L-GPT 是一款开源项目。其能力是通过整合各个大语言模型的开放 API,给用户提供高度聚合的帮助型 AI 服务。它不仅支持基础的会话功能,后续还将支持文本转语音、语音输入、解析文件、插件等更多功能,能够多方面的来提升学习、工作和生活效率。 [Demo](https://gpt.ltopx.com)

Expand Down Expand Up @@ -31,7 +31,7 @@ L-GPT 是一款开源项目。其能力是通过整合各个大语言模型的
- 支持响应式,暗黑模式和 PWA
- 安全,所有数据均基于本地存储
- 支持 i18n
- 支持 [Azure OpenAI Service](./azure_CN.md)
- 支持 [Azure OpenAI Service](https://docs.ltopx.com/zh-CN/api-key-configure/azure)
- 支持配置和使用自定义 prompt

## 下一步计划
Expand Down Expand Up @@ -141,25 +141,25 @@ 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。[查看示例](./azure_CN.md) || |
| `NEXT_PUBLIC_AZURE_OPENAI_RESOURCE_NAME` | Azure OpenAI API 服务资源名称。[查看示例](./azure_CN.md) || |
| `NEXT_AZURE_OPENAI_API_VERSION` | Azure OpenAI API 服务版本号。[查看示例](./azure_CN.md) || 2023-05-15 |
| `NEXT_PUBLIC_SENTRY_DSN` | 你的 Sentry DSN 地址。如果为空, 将不会将错误报告到 Sentry || |
| `DATABASE_URL` | postgresql 数据库连接地址 || |
| `EMAIL_SERVER_HOST` | next-auth email server host || |
| `EMAIL_SERVER_PORT` | next-auth email server port || |
| `EMAIL_SERVER_USER` | next-auth email server user || |
| `EMAIL_SERVER_PASSWORD` | next-auth email server password || |
| `EMAIL_FROM` | next-auth email from || |
| `EMAIL_SECRET` | next-auth email secret || |
| `GITHUB_ID` | next-auth github id || |
| `GITHUB_SECRET` | next-auth github secret || |
| `GOOGLE_CLIENT_ID` | next-auth google client id || |
| `GOOGLE_CLIENT_SECRET` | next-auth google client secret || |
| 环境变量 | 描述 | 是否必须配置 | 默认值 |
| ---------------------------------------- | ----------------------------------------------------------------------------------------------- | ------------ | ------------------------ |
| `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。[查看示例](https://docs.ltopx.com/zh-CN/api-key-configure/azure) || |
| `NEXT_PUBLIC_AZURE_OPENAI_RESOURCE_NAME` | Azure OpenAI API 服务资源名称。[查看示例](https://docs.ltopx.com/zh-CN/api-key-configure/azure) || |
| `NEXT_AZURE_OPENAI_API_VERSION` | Azure OpenAI API 服务版本号。[查看示例](https://docs.ltopx.com/zh-CN/api-key-configure/azure) || 2023-05-15 |
| `NEXT_PUBLIC_SENTRY_DSN` | 你的 Sentry DSN 地址。如果为空, 将不会将错误报告到 Sentry || |
| `DATABASE_URL` | postgresql 数据库连接地址 || |
| `EMAIL_SERVER_HOST` | next-auth email server host || |
| `EMAIL_SERVER_PORT` | next-auth email server port || |
| `EMAIL_SERVER_USER` | next-auth email server user || |
| `EMAIL_SERVER_PASSWORD` | next-auth email server password || |
| `EMAIL_FROM` | next-auth email from || |
| `EMAIL_SECRET` | next-auth email secret || |
| `GITHUB_ID` | next-auth github id || |
| `GITHUB_SECRET` | next-auth github secret || |
| `GOOGLE_CLIENT_ID` | next-auth google client id || |
| `GOOGLE_CLIENT_SECRET` | next-auth google client secret || |

## 联系方式

Expand Down
23 changes: 0 additions & 23 deletions azure.md

This file was deleted.

23 changes: 0 additions & 23 deletions azure_CN.md

This file was deleted.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
"@react-email/render": "0.0.7",
"@sentry/nextjs": "7.54.0",
"@svgr/webpack": "8.0.1",
"@types/node": "20.3.0",
"@types/react": "18.2.11",
"@types/react-dom": "18.2.4",
"@types/node": "20.3.1",
"@types/react": "18.2.12",
"@types/react-dom": "18.2.5",
"@upstash/redis": "1.21.0",
"@vercel/analytics": "1.0.1",
"ahooks": "3.7.7",
Expand Down
Loading

1 comment on commit 0540903

@vercel
Copy link

@vercel vercel bot commented on 0540903 Jun 13, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.