From e12f97a73b9d6fe87f32d24a4a28b10e71b949a5 Mon Sep 17 00:00:00 2001 From: Archer <545436317@qq.com> Date: Tue, 14 Mar 2023 12:54:37 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=96=87=E6=A1=88=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=EF=BC=9B=E5=88=A0=E9=99=A4=E8=B4=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 6 +++--- README.md | 6 +++--- next.config.js | 12 +----------- package.json | 2 +- src/constants/common.ts | 4 ++-- src/pages/chat/index.tsx | 4 ++-- src/pages/number/setting.tsx | 14 ++++++++++++-- src/service/utils/chat.ts | 2 +- src/utils/user.ts | 2 +- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index dea6c6360..6c7418b46 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -SERVICE_NAME=doc-gpt +SERVICE_NAME=fast-gpt # Image URL to use all building/pushing image targets IMG ?= $(SERVICE_NAME):latest @@ -34,13 +34,13 @@ run: ## Run a dev service from host. .PHONY: docker-build docker-build: ## Build docker image with the desktop-frontend. - docker build -t c121914yu/doc-gpt:latest . + docker build -t c121914yu/fast-gpt:latest . ##@ Deployment .PHONY: docker-run docker-run: ## Push docker image. - docker run -d -p 8008:3000 --name doc-gpt -v /web_project/yjl/doc-gpt/logs:/app/.next/logs c121914yu/doc-gpt:latest + docker run -d -p 8008:3000 --name fast-gpt -v /web_project/yjl/fast-gpt/logs:/app/.next/logs c121914yu/fast-gpt:latest #TODO: add support of docker push diff --git a/README.md b/README.md index c12ebfad2..47473fea0 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,9 @@ docker push imageName:tag ```bash # 服务器拉取部署, imageName 替换成镜像名 docker pull imageName:tag -docker stop doc-gpt || true -docker rm doc-gpt || true -docker run -d --network=host --name doc-gpt \ +docker stop fast-gpt || true +docker rm fast-gpt || true +docker run -d --network=host --name fast-gpt \ -e AXIOS_PROXY_HOST=127.0.0.1 \ -e AXIOS_PROXY_PORT=7890 \ -e MY_MAIL=your email\ diff --git a/next.config.js b/next.config.js index e3e375924..04c3c8a67 100644 --- a/next.config.js +++ b/next.config.js @@ -6,17 +6,7 @@ const isDev = process.env.NODE_ENV === 'development'; const nextConfig = { output: 'standalone', reactStrictMode: false, - compress: true, - images: { - remotePatterns: [ - { - protocol: 'https', - hostname: 'docgpt-1301319986.cos.ap-shanghai.myqcloud.com', - port: '', - pathname: '/**' - } - ] - } + compress: true }; module.exports = nextConfig; diff --git a/package.json b/package.json index 952079fd0..46183ae9d 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "docgpt", + "name": "fastgpt", "version": "0.1.0", "private": true, "scripts": { diff --git a/src/constants/common.ts b/src/constants/common.ts index e67fff500..3f1793db5 100644 --- a/src/constants/common.ts +++ b/src/constants/common.ts @@ -4,9 +4,9 @@ export enum EmailTypeEnum { } export const introPage = ` -## 欢迎使用 Doc GPT +## 欢迎使用 Fast GPT -[Git 仓库](https://github.com/c121914yu/DocGPT) +[Git 仓库](https://github.com/c121914yu/FastGPT) 时间比较赶,介绍没来得及完善,先直接上怎么使用: 1. 使用邮箱注册账号。 diff --git a/src/pages/chat/index.tsx b/src/pages/chat/index.tsx index 83b8910ba..faf12bf7f 100644 --- a/src/pages/chat/index.tsx +++ b/src/pages/chat/index.tsx @@ -243,9 +243,9 @@ const Chat = ({ chatId, windowId }: { chatId: string; windowId?: string }) => { if (typeof fnMap[chatSiteData.chatModel] === 'function') { await fnMap[chatSiteData.chatModel](requestPrompt); } - } catch (err) { + } catch (err: any) { toast({ - title: typeof err === 'string' ? err : '聊天出错了~', + title: typeof err === 'string' ? err : err?.message || '聊天出错了~', status: 'warning', duration: 5000, isClosable: true diff --git a/src/pages/number/setting.tsx b/src/pages/number/setting.tsx index 9d118ea87..4dc5d0274 100644 --- a/src/pages/number/setting.tsx +++ b/src/pages/number/setting.tsx @@ -12,8 +12,10 @@ import { Td, TableContainer, Select, - Input + Input, + IconButton } from '@chakra-ui/react'; +import { DeleteIcon } from '@chakra-ui/icons'; import { useForm, useFieldArray } from 'react-hook-form'; import { UserUpdateParams } from '@/types/user'; import { putUserInfo } from '@/api/user'; @@ -130,7 +132,15 @@ const NumberSetting = () => { > - + } + colorScheme={'red'} + onClick={() => { + removeAccount(i); + handleSubmit(onclickSave)(); + }} + /> ))} diff --git a/src/service/utils/chat.ts b/src/service/utils/chat.ts index ae99bbaa2..e9acba0ce 100644 --- a/src/service/utils/chat.ts +++ b/src/service/utils/chat.ts @@ -35,7 +35,7 @@ export const authChat = async (chatId: string) => { const userApiKey = user.accounts?.find((item: any) => item.type === 'openai')?.value; if (!userApiKey) { - return Promise.reject('该用户缺少ApiKey, 无法请求'); + return Promise.reject('缺少ApiKey, 无法请求'); } return { diff --git a/src/utils/user.ts b/src/utils/user.ts index afdf31303..190fc4314 100644 --- a/src/utils/user.ts +++ b/src/utils/user.ts @@ -1,4 +1,4 @@ -const tokenKey = 'doc-gpt-token'; +const tokenKey = 'fast-gpt-token'; export const setToken = (val: string) => { localStorage.setItem(tokenKey, val);