Skip to content

Commit 8ba8488

Browse files
authored
4.8.2-fix (FlowiseAI#1612)
1 parent 9639139 commit 8ba8488

File tree

13 files changed

+153
-87
lines changed

13 files changed

+153
-87
lines changed

.github/workflows/build-sandbox-image.yml

+24
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,27 @@ jobs:
8282
run: docker tag ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:${{env.IMAGE_TAG}} ${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:${{env.IMAGE_TAG}}
8383
- name: Push image to Docker Hub
8484
run: docker push ${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:${{env.IMAGE_TAG}}
85+
push-to-docker-hub:
86+
needs: build-fastgpt-sandbox-images
87+
runs-on: ubuntu-20.04
88+
steps:
89+
- name: Checkout code
90+
uses: actions/checkout@v3
91+
- name: Login to Docker Hub
92+
uses: docker/login-action@v2
93+
with:
94+
username: ${{ secrets.DOCKER_HUB_NAME }}
95+
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
96+
- name: Set DOCKER_REPO_TAGGED based on branch or tag
97+
run: |
98+
if [[ "${{ github.ref_name }}" == "main" ]]; then
99+
echo "IMAGE_TAG=latest" >> $GITHUB_ENV
100+
else
101+
echo "IMAGE_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
102+
fi
103+
- name: Pull image from GitHub Container Registry
104+
run: docker pull ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:${{env.IMAGE_TAG}}
105+
- name: Tag image with Docker Hub repository name and version tag
106+
run: docker tag ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:${{env.IMAGE_TAG}} ${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:${{env.IMAGE_TAG}}
107+
- name: Push image to Docker Hub
108+
run: docker push ${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:${{env.IMAGE_TAG}}

.github/workflows/fastgpt-image.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ jobs:
8080
- name: Pull image from GitHub Container Registry
8181
run: docker pull ghcr.io/${{ github.repository_owner }}/fastgpt:${{env.IMAGE_TAG}}
8282
- name: Tag image with Docker Hub repository name and version tag
83-
run: docker tag ghcr.io/${{ github.repository_owner }}/fastgpt:${{env.IMAGE_TAG}} ${{ secrets.DOCKER_IMAGE_NAME }}:${{env.IMAGE_TAG}}
83+
run: docker tag ghcr.io/${{ github.repository_owner }}/fastgpt:${{env.IMAGE_TAG}} ${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt:${{env.IMAGE_TAG}}
8484
- name: Push image to Docker Hub
85-
run: docker push ${{ secrets.DOCKER_IMAGE_NAME }}:${{env.IMAGE_TAG}}
85+
run: docker push ${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt:${{env.IMAGE_TAG}}
8686
push-to-ali-hub:
8787
needs: build-fastgpt-images
8888
if: github.repository == 'labring/FastGPT'
@@ -106,6 +106,6 @@ jobs:
106106
- name: Pull image from GitHub Container Registry
107107
run: docker pull ghcr.io/${{ github.repository_owner }}/fastgpt:${{env.IMAGE_TAG}}
108108
- name: Tag image with Docker Hub repository name and version tag
109-
run: docker tag ghcr.io/${{ github.repository_owner }}/fastgpt:${{env.IMAGE_TAG}} ${{ secrets.ALI_IMAGE_NAME }}:${{env.IMAGE_TAG}}
109+
run: docker tag ghcr.io/${{ github.repository_owner }}/fastgpt:${{env.IMAGE_TAG}} ${{ secrets.ALI_IMAGE_NAME }}/fastgpt:${{env.IMAGE_TAG}}
110110
- name: Push image to Docker Hub
111-
run: docker push ${{ secrets.ALI_IMAGE_NAME }}:${{env.IMAGE_TAG}}
111+
run: docker push ${{ secrets.ALI_IMAGE_NAME }}/fastgpt:${{env.IMAGE_TAG}}

.github/workflows/preview-image.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
-f projects/app/Dockerfile \
4848
--label "org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/FastGPT" \
4949
--label "org.opencontainers.image.description=fastgpt-pr imae" \
50-
--label "org.opencontainers.image.licenses=Apache" \g
50+
--label "org.opencontainers.image.licenses=Apache" \
5151
--push \
5252
--cache-from=type=local,src=/tmp/.buildx-cache \
5353
--cache-to=type=local,dest=/tmp/.buildx-cache \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: 'V4.8.2'
3+
description: 'FastGPT V4.8.2 更新说明'
4+
icon: 'upgrade'
5+
draft: false
6+
toc: true
7+
weight: 822
8+
---
9+
10+
## Sealos 升级说明
11+
12+
1. 在应用管理中新建一个应用,镜像为:registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.8.1
13+
2. 无需外网访问地址
14+
3. 部署完后,复制应用的内网地址
15+
4. 点击变更`FastGPT - 修改环境变量,增加下面的环境变量即可
16+
17+
```
18+
SANDBOX_URL=内网地址
19+
```
20+
21+
## Docker 部署
22+
23+
可以拉取最新 [docker-compose.yml](https://github.com/labring/FastGPT/blob/main/files/deploy/fastgpt/docker-compose.yml) 文件参考
24+
25+
1. 新增一个容器 `sandbox`
26+
2. fastgpt容器新增环境变量: `SANDBOX_URL`
27+
3. sandbox 简易不要开启外网访问,未做凭证校验。
28+
29+
## V4.8.2 更新说明
30+
31+
1. 新增 - js代码运行节点(更完整的type提醒,后续继续完善)
32+
2. 修复 - 新增的站点同步无法使用
33+
3. 修复 - 定时任务无法输入内容

files/deploy/fastgpt/docker-compose.yml

+12-2
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,25 @@ services:
6767
6868
# 等待docker-entrypoint.sh脚本执行的MongoDB服务进程
6969
wait $$!
70+
sandbox:
71+
container_name: sandbox
72+
image: ghcr.io/labring/fastgpt-sandbox:v4.8.2 # git
73+
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.8.2 # 阿里云
74+
networks:
75+
- fastgpt
76+
restart: always
7077
fastgpt:
7178
container_name: fastgpt
72-
image: ghcr.io/labring/fastgpt:v4.8.1 # git
73-
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.1 # 阿里云
79+
image: ghcr.io/labring/fastgpt:v4.8.2 # git
80+
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.2 # 阿里云
7481
ports:
7582
- 3000:3000
7683
networks:
7784
- fastgpt
7885
depends_on:
7986
- mongo
8087
- pg
88+
- sandbox
8189
restart: always
8290
environment:
8391
# root 密码,用户名为: root。如果需要修改 root 密码,直接修改这个环境变量,并重启即可。
@@ -98,6 +106,8 @@ services:
98106
- MONGODB_URI=mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
99107
# pg 连接参数
100108
- PG_URL=postgresql://username:password@pg:5432/postgres
109+
# sandbox 地址
110+
- SANDBOX_URL=http://sandbox:3000
101111
volumes:
102112
- ./config.json:/app/data/config.json
103113
- ./fastgpt/tmp:/app/tmp
+9-29
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,12 @@
1-
### FastGPT V4.8
2-
3-
本次更新的重点是对工作流 (高级编排) 进行了重构,使其更加简洁和强大。但由于新旧工作流机制有较大变化,尽管我们进行了一定的自动转换,仍有部分工作流需要您手动重建。请尽快更新到新版本,并对工作流进行必要的调试和重新发布。
4-
5-
❗ 重要提示:
6-
1️⃣ 旧工作流更新后暂不失效,打开旧工作流会弹出自动转换提示,重新编排后点 “发布” 按钮发布新工作流
7-
2️⃣ 发布新工作流前,工作流自动保存功能暂不生效
8-
3️⃣ 应用和插件新增 version 字段,标识适用新/旧版工作流,以实现兼容
9-
10-
✨ 新增功能亮点:
11-
1️⃣ 判断器:支持 if/elseIf/else 判断逻辑,工作流控制更灵活
12-
2️⃣ 变量更新节点:运行中可动态修改工作流输出变量或全局变量值
13-
3️⃣ 工作流自动保存和版本管理:自动保存修改,支持查看和回滚历史版本
14-
4️⃣ 工作流调试模式:更直观高效,可调试单节点或逐步执行,实时查看输入输出数据
15-
5️⃣ 定时执行应用:支持简单配置实现各种定时任务
16-
17-
🛠️ 其他优化与修复:
18-
- 优化工作流节点连线方式,支持四向连接,易构建循环工作流
19-
- 显著提升工作流上下文数据传递性能
20-
- 简易模式下修改配置自动刷新调试框,免手动保存
21-
- 改进 worker 进程管理,支持 Token 计算任务分配,提高效率
22-
- 工具调用支持 string、boolean、number 数据类型
23-
- 完善 completions 接口对 size 参数限制
24-
- 重构 Node.js API 中间件和服务端代码
25-
- 对话记录长度调整为偶数,最大长度增至 50 轮,避免奇数导致部分模型不兼容
26-
- HTTP 节点出错将终止进程,避免异常影响
27-
- 修复工具调用名称不能以数字开头问题
28-
- 修复分享链接 query 参数缓存 bug
29-
- 修复工具调用和 HTTP 模块兼容性问题
1+
### FastGPT V4.8.2
2+
3+
- 新增 - 知识库重新选择向量模型重建
4+
- 新增 - 对话框支持问题模糊检索提示,可自定义预设问题词库
5+
- 新增 - js代码运行节点
6+
- 新增 - 外部文件源知识库: [点击查看文档](https://doc.fastai.site/docs/course/externalfile/)
7+
- 新增 - 内容提取节点增加完全提取成功输出
8+
- 新增 - HTTP节点增加错误输出,可以自行判断处理
9+
- 优化 - 插件输入的 debug 模式,支持全量参数输入渲染
3010
- [点击查看高级编排介绍文档](https://doc.fastgpt.in/docs/workflow/intro)
3111
- [使用文档](https://doc.fastgpt.in/docs/intro/)
3212
- [点击查看商业版](https://doc.fastgpt.in/docs/commercial/)

projects/app/src/components/core/app/ScheduledTriggerConfig.tsx

+5-10
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const ScheduledTriggerConfig = ({
9999

100100
const timezone = value?.timezone;
101101
const cronString = value?.cronString;
102-
const defaultPrompt = value?.defaultPrompt || '';
102+
const defaultPrompt = value?.defaultPrompt;
103103

104104
const cronSelectList = useRef<MultipleSelectProps['list']>([
105105
{
@@ -134,15 +134,10 @@ const ScheduledTriggerConfig = ({
134134
timezone?: string;
135135
defaultPrompt?: string;
136136
}) => {
137-
if (!cronString) {
138-
onChange(undefined);
139-
return;
140-
}
141137
onChange({
142-
...value,
143-
cronString,
144-
timezone: timezone || Intl.DateTimeFormat().resolvedOptions().timeZone,
145-
defaultPrompt: defaultPrompt || ''
138+
cronString: cronString ?? value?.cronString ?? '0 0 * * *',
139+
timezone: timezone ?? value?.timezone ?? Intl.DateTimeFormat().resolvedOptions().timeZone,
140+
defaultPrompt: defaultPrompt ?? value?.defaultPrompt ?? ''
146141
});
147142
},
148143
[onChange, value]
@@ -314,7 +309,7 @@ const ScheduledTriggerConfig = ({
314309
</Box>
315310
</Flex>
316311
<Box mt={5}>
317-
<Box>{t('core.app.schedule.Default prompt')}</Box>
312+
<Box mb={1}>{t('core.app.schedule.Default prompt')}</Box>
318313
<Textarea
319314
value={defaultPrompt}
320315
rows={8}

projects/app/src/components/core/workflow/Flow/components/ButtonEdge.tsx

+23-21
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import { useContextSelector } from 'use-context-selector';
77
import { WorkflowContext } from '../../context';
88

99
const ButtonEdge = (props: EdgeProps) => {
10-
const nodes = useContextSelector(WorkflowContext, (v) => v.nodes);
11-
const setEdges = useContextSelector(WorkflowContext, (v) => v.setEdges);
12-
const workflowDebugData = useContextSelector(WorkflowContext, (v) => v.workflowDebugData);
10+
const { nodes, setEdges, workflowDebugData, hoverEdgeId } = useContextSelector(
11+
WorkflowContext,
12+
(v) => v
13+
);
1314

1415
const {
1516
id,
@@ -50,6 +51,7 @@ const ButtonEdge = (props: EdgeProps) => {
5051
});
5152

5253
const isToolEdge = sourceHandleId === NodeOutputKeyEnum.selectedTools;
54+
const isHover = hoverEdgeId === id;
5355

5456
const { newTargetX, newTargetY } = useMemo(() => {
5557
if (targetPosition === 'left') {
@@ -116,24 +118,23 @@ const ButtonEdge = (props: EdgeProps) => {
116118
})();
117119
return (
118120
<EdgeLabelRenderer>
119-
{highlightEdge && (
120-
<Flex
121-
alignItems={'center'}
122-
justifyContent={'center'}
123-
position={'absolute'}
124-
transform={`translate(-55%, -50%) translate(${labelX}px,${labelY}px)`}
125-
pointerEvents={'all'}
126-
w={'17px'}
127-
h={'17px'}
128-
bg={'white'}
129-
borderRadius={'17px'}
130-
cursor={'pointer'}
131-
zIndex={1000}
132-
onClick={() => onDelConnect(id)}
133-
>
134-
<MyIcon name={'core/workflow/closeEdge'} w={'100%'}></MyIcon>
135-
</Flex>
136-
)}
121+
<Flex
122+
display={isHover || highlightEdge ? 'flex' : 'none'}
123+
alignItems={'center'}
124+
justifyContent={'center'}
125+
position={'absolute'}
126+
transform={`translate(-55%, -50%) translate(${labelX}px,${labelY}px)`}
127+
pointerEvents={'all'}
128+
w={'17px'}
129+
h={'17px'}
130+
bg={'white'}
131+
borderRadius={'17px'}
132+
cursor={'pointer'}
133+
zIndex={1000}
134+
onClick={() => onDelConnect(id)}
135+
>
136+
<MyIcon name={'core/workflow/closeEdge'} w={'100%'}></MyIcon>
137+
</Flex>
137138
{!isToolEdge && (
138139
<Flex
139140
alignItems={'center'}
@@ -161,6 +162,7 @@ const ButtonEdge = (props: EdgeProps) => {
161162
</EdgeLabelRenderer>
162163
);
163164
}, [
165+
isHover,
164166
highlightEdge,
165167
labelX,
166168
labelY,

projects/app/src/components/core/workflow/Flow/index.tsx

+25-8
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import ReactFlow, {
1111
NodeChange,
1212
OnConnectStartParams,
1313
addEdge,
14-
EdgeChange
14+
EdgeChange,
15+
Edge
1516
} from 'reactflow';
1617
import { Box, Flex, IconButton, useDisclosure } from '@chakra-ui/react';
1718
import { SmallCloseIcon } from '@chakra-ui/icons';
@@ -74,13 +75,16 @@ const Container = React.memo(function Container() {
7475
});
7576

7677
const { isDowningCtrl } = useKeyboard();
77-
const setConnectingEdge = useContextSelector(WorkflowContext, (v) => v.setConnectingEdge);
78-
const reactFlowWrapper = useContextSelector(WorkflowContext, (v) => v.reactFlowWrapper);
79-
const nodes = useContextSelector(WorkflowContext, (v) => v.nodes);
80-
const onNodesChange = useContextSelector(WorkflowContext, (v) => v.onNodesChange);
81-
const edges = useContextSelector(WorkflowContext, (v) => v.edges);
82-
const setEdges = useContextSelector(WorkflowContext, (v) => v.setEdges);
83-
const onEdgesChange = useContextSelector(WorkflowContext, (v) => v.onEdgesChange);
78+
const {
79+
setConnectingEdge,
80+
reactFlowWrapper,
81+
nodes,
82+
onNodesChange,
83+
edges,
84+
setEdges,
85+
onEdgesChange,
86+
setHoverEdgeId
87+
} = useContextSelector(WorkflowContext, (v) => v);
8488

8589
/* node */
8690
const handleNodesChange = useCallback(
@@ -159,6 +163,17 @@ const Container = React.memo(function Container() {
159163
[onConnect, t, toast]
160164
);
161165

166+
/* edge */
167+
const onEdgeMouseEnter = useCallback(
168+
(e: any, edge: Edge) => {
169+
setHoverEdgeId(edge.id);
170+
},
171+
[setHoverEdgeId]
172+
);
173+
const onEdgeMouseLeave = useCallback(() => {
174+
setHoverEdgeId(undefined);
175+
}, [setHoverEdgeId]);
176+
162177
return (
163178
<>
164179
<ReactFlow
@@ -178,6 +193,8 @@ const Container = React.memo(function Container() {
178193
onConnect={customOnConnect}
179194
onConnectStart={onConnectStart}
180195
onConnectEnd={onConnectEnd}
196+
onEdgeMouseEnter={onEdgeMouseEnter}
197+
onEdgeMouseLeave={onEdgeMouseLeave}
181198
>
182199
<FlowController />
183200
</ReactFlow>

projects/app/src/components/core/workflow/context.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ type WorkflowContextType = {
7070
sourceHandle?: string | undefined;
7171
targetHandle?: string | undefined;
7272
}) => void;
73+
hoverEdgeId?: string;
74+
setHoverEdgeId: React.Dispatch<React.SetStateAction<string | undefined>>;
7375

7476
// connect
7577
connectingEdge?: OnConnectStartParams;
@@ -216,6 +218,9 @@ export const WorkflowContext = createContext<WorkflowContextType>({
216218
isShowVersionHistories: false,
217219
setIsShowVersionHistories: function (value: React.SetStateAction<boolean>): void {
218220
throw new Error('Function not implemented.');
221+
},
222+
setHoverEdgeId: function (value: React.SetStateAction<string | undefined>): void {
223+
throw new Error('Function not implemented.');
219224
}
220225
});
221226

@@ -233,6 +238,7 @@ const WorkflowContextProvider = ({
233238

234239
/* edge */
235240
const [edges, setEdges, onEdgesChange] = useEdgesState([]);
241+
const [hoverEdgeId, setHoverEdgeId] = useState<string>();
236242
const onDelEdge = useCallback(
237243
({
238244
nodeId,
@@ -673,6 +679,8 @@ const WorkflowContextProvider = ({
673679
// edge
674680
edges,
675681
setEdges,
682+
hoverEdgeId,
683+
setHoverEdgeId,
676684
onEdgesChange,
677685
connectingEdge,
678686
setConnectingEdge,

0 commit comments

Comments
 (0)