From 59fd94384df88aa45974c3a47aefbf6daba57b37 Mon Sep 17 00:00:00 2001 From: Archer <545436317@qq.com> Date: Mon, 13 May 2024 11:04:50 +0800 Subject: [PATCH] fix: session (#1455) * fix: session * doc * fix: i188n --- docSite/content/docs/development/docker.md | 7 +++++++ files/deploy/fastgpt/docker-compose.yml | 13 ++++++++----- packages/service/common/mongo/sessionRun.ts | 4 ++-- projects/app/i18n/en/common.json | 9 +++++---- projects/app/i18n/zh/common.json | 7 ++++--- .../pages/login/components/LoginForm/LoginForm.tsx | 2 +- 6 files changed, 27 insertions(+), 15 deletions(-) diff --git a/docSite/content/docs/development/docker.md b/docSite/content/docs/development/docker.md index 312c8f97a12..dfcae74ecf7 100644 --- a/docSite/content/docs/development/docker.md +++ b/docSite/content/docs/development/docker.md @@ -257,6 +257,13 @@ PG 数据库没有连接上/初始化失败,可以查看日志。FastGPT 会 2. 非 docker 部署的,需要手动安装 pg vector 插件 3. 查看 fastgpt 日志,有没有相关报错 +### Illegal instruction + +可能原因: + +1. arm架构。需要使用 Mongo 官方镜像: mongo:5.0.18 +2. cpu 不支持 AVX,无法用 mongo5,需要换成 mongo4.x。把 mongo 的 image 换成: mongo:4.4.29 + ### Operation `auth_codes.findOne()` buffering timed out after 10000ms mongo连接失败,查看mongo的运行状态对应日志。 diff --git a/files/deploy/fastgpt/docker-compose.yml b/files/deploy/fastgpt/docker-compose.yml index a0970e15217..624e4205971 100644 --- a/files/deploy/fastgpt/docker-compose.yml +++ b/files/deploy/fastgpt/docker-compose.yml @@ -1,12 +1,13 @@ # 数据库的默认账号和密码仅首次运行时设置有效 # 如果修改了账号密码,记得改数据库和项目连接参数,别只改一处~ # 该配置文件只是给快速启动,测试使用。正式使用,记得务必修改账号密码,以及调整合适的知识库参数,共享内存等。 +# 如何无法访问 dockerhub 和 git,可以用阿里云(阿里云没有arm包) version: '3.3' services: pg: - # image: pgvector/pgvector:0.7.0-pg15 # docker hub - image: registry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:v0.7.0 # 阿里云 + image: pgvector/pgvector:0.7.0-pg15 # docker hub + # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:v0.7.0 # 阿里云 container_name: pg restart: always ports: # 生产环境建议不要暴露 @@ -21,7 +22,9 @@ services: volumes: - ./pg/data:/var/lib/postgresql/data mongo: - image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo:5.0.18 + image: mongo:5.0.18 # dockerhub + # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo:5.0.18 # 阿里云 + # image: mongo:4.4.29 # cpu不支持AVX时候使用 container_name: mongo restart: always ports: @@ -66,8 +69,8 @@ services: wait $$! fastgpt: container_name: fastgpt - image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.7 # git - # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.7 # 阿里云 + image: ghcr.io/labring/fastgpt:v4.8 # git + # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8 # 阿里云 ports: - 3000:3000 networks: diff --git a/packages/service/common/mongo/sessionRun.ts b/packages/service/common/mongo/sessionRun.ts index a9800604554..c20219cd930 100644 --- a/packages/service/common/mongo/sessionRun.ts +++ b/packages/service/common/mongo/sessionRun.ts @@ -8,14 +8,14 @@ export const mongoSessionRun = async (fn: (session: ClientSession) const result = await fn(session); await session.commitTransaction(); - session.endSession(); + await session.endSession(); return result as T; } catch (error) { console.log(error); await session.abortTransaction(); - session.endSession(); + await session.endSession(); return Promise.reject(error); } }; diff --git a/projects/app/i18n/en/common.json b/projects/app/i18n/en/common.json index 5955c51e96f..e8de25278ee 100644 --- a/projects/app/i18n/en/common.json +++ b/projects/app/i18n/en/common.json @@ -2,14 +2,14 @@ "App": "App", "Export": "Export", "Folder": "Folder", + "Login": "Login", "Move": "Move", "Name": "Name", + "New Create": "Create New", "Rename": "Rename", "Running": "Running", "UnKnow": "Unknown", "Warning": "Warning", - "New Create": "Create New", - "common": { "Action": "Action", "Add": "Add", @@ -580,7 +580,8 @@ "success": "Start syncing" } }, - "training": {} + "training": { + } }, "data": { "Auxiliary Data": "Auxiliary data", @@ -863,10 +864,10 @@ "params": "Params" }, "input": { + "Add Branch": "Add branch", "Add Input": "Add input", "Input Number": "Input: {{length}}", "add": "Add condition", - "Add Branch": "Add branch", "description": { "Background": "You can add some specific content introductions to better identify the user's question type. This content is usually to introduce something unknown to the model.", "HTTP Dynamic Input": "Receives the output value of the previous node as a variable, which can be used by HTTP request parameters.", diff --git a/projects/app/i18n/zh/common.json b/projects/app/i18n/zh/common.json index 201a7de0aac..55ed8ff9227 100644 --- a/projects/app/i18n/zh/common.json +++ b/projects/app/i18n/zh/common.json @@ -2,14 +2,14 @@ "App": "应用", "Export": "导出", "Folder": "文件夹", + "Login": "登录", "Move": "移动", "Name": "名称", + "New Create": "新建", "Rename": "重命名", "Running": "运行中", "UnKnow": "未知", "Warning": "提示", - "New Create": "新建", - "common": { "Action": "操作", "Add": "添加", @@ -580,7 +580,8 @@ "success": "开始同步" } }, - "training": {} + "training": { + } }, "data": { "Auxiliary Data": "辅助数据", diff --git a/projects/app/src/pages/login/components/LoginForm/LoginForm.tsx b/projects/app/src/pages/login/components/LoginForm/LoginForm.tsx index b2fa6d99ee6..d7a0d4900da 100644 --- a/projects/app/src/pages/login/components/LoginForm/LoginForm.tsx +++ b/projects/app/src/pages/login/components/LoginForm/LoginForm.tsx @@ -137,7 +137,7 @@ const LoginForm = ({ setPageType, loginSuccess }: Props) => { isLoading={requesting} onClick={handleSubmit(onclickLogin)} > - {t('home.Login')} + {t('Login')} {feConfigs?.show_register && (