Skip to content

Commit

Permalink
4.8.2-fix (#1612)
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu authored May 28, 2024
1 parent 9639139 commit 8ba8488
Show file tree
Hide file tree
Showing 13 changed files with 153 additions and 87 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build-sandbox-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,27 @@ jobs:
run: docker tag ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:${{env.IMAGE_TAG}} ${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:${{env.IMAGE_TAG}}
- name: Push image to Docker Hub
run: docker push ${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sandbox:${{env.IMAGE_TAG}}
push-to-docker-hub:
needs: build-fastgpt-sandbox-images
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_NAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Set DOCKER_REPO_TAGGED based on branch or tag
run: |
if [[ "${{ github.ref_name }}" == "main" ]]; then
echo "IMAGE_TAG=latest" >> $GITHUB_ENV
else
echo "IMAGE_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
fi
- name: Pull image from GitHub Container Registry
run: docker pull ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:${{env.IMAGE_TAG}}
- name: Tag image with Docker Hub repository name and version tag
run: docker tag ghcr.io/${{ github.repository_owner }}/fastgpt-sandbox:${{env.IMAGE_TAG}} ${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:${{env.IMAGE_TAG}}
- name: Push image to Docker Hub
run: docker push ${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sandbox:${{env.IMAGE_TAG}}
8 changes: 4 additions & 4 deletions .github/workflows/fastgpt-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ jobs:
- name: Pull image from GitHub Container Registry
run: docker pull ghcr.io/${{ github.repository_owner }}/fastgpt:${{env.IMAGE_TAG}}
- name: Tag image with Docker Hub repository name and version tag
run: docker tag ghcr.io/${{ github.repository_owner }}/fastgpt:${{env.IMAGE_TAG}} ${{ secrets.DOCKER_IMAGE_NAME }}:${{env.IMAGE_TAG}}
run: docker tag ghcr.io/${{ github.repository_owner }}/fastgpt:${{env.IMAGE_TAG}} ${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt:${{env.IMAGE_TAG}}
- name: Push image to Docker Hub
run: docker push ${{ secrets.DOCKER_IMAGE_NAME }}:${{env.IMAGE_TAG}}
run: docker push ${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt:${{env.IMAGE_TAG}}
push-to-ali-hub:
needs: build-fastgpt-images
if: github.repository == 'labring/FastGPT'
Expand All @@ -106,6 +106,6 @@ jobs:
- name: Pull image from GitHub Container Registry
run: docker pull ghcr.io/${{ github.repository_owner }}/fastgpt:${{env.IMAGE_TAG}}
- name: Tag image with Docker Hub repository name and version tag
run: docker tag ghcr.io/${{ github.repository_owner }}/fastgpt:${{env.IMAGE_TAG}} ${{ secrets.ALI_IMAGE_NAME }}:${{env.IMAGE_TAG}}
run: docker tag ghcr.io/${{ github.repository_owner }}/fastgpt:${{env.IMAGE_TAG}} ${{ secrets.ALI_IMAGE_NAME }}/fastgpt:${{env.IMAGE_TAG}}
- name: Push image to Docker Hub
run: docker push ${{ secrets.ALI_IMAGE_NAME }}:${{env.IMAGE_TAG}}
run: docker push ${{ secrets.ALI_IMAGE_NAME }}/fastgpt:${{env.IMAGE_TAG}}
2 changes: 1 addition & 1 deletion .github/workflows/preview-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
-f projects/app/Dockerfile \
--label "org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/FastGPT" \
--label "org.opencontainers.image.description=fastgpt-pr imae" \
--label "org.opencontainers.image.licenses=Apache" \g
--label "org.opencontainers.image.licenses=Apache" \
--push \
--cache-from=type=local,src=/tmp/.buildx-cache \
--cache-to=type=local,dest=/tmp/.buildx-cache \
Expand Down
33 changes: 33 additions & 0 deletions docSite/content/docs/development/upgrading/482.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: 'V4.8.2'
description: 'FastGPT V4.8.2 更新说明'
icon: 'upgrade'
draft: false
toc: true
weight: 822
---

## Sealos 升级说明

1. 在应用管理中新建一个应用,镜像为:registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.8.1
2. 无需外网访问地址
3. 部署完后,复制应用的内网地址
4. 点击变更`FastGPT - 修改环境变量,增加下面的环境变量即可

```
SANDBOX_URL=内网地址
```

## Docker 部署

可以拉取最新 [docker-compose.yml](https://github.com/labring/FastGPT/blob/main/files/deploy/fastgpt/docker-compose.yml) 文件参考

1. 新增一个容器 `sandbox`
2. fastgpt容器新增环境变量: `SANDBOX_URL`
3. sandbox 简易不要开启外网访问,未做凭证校验。

## V4.8.2 更新说明

1. 新增 - js代码运行节点(更完整的type提醒,后续继续完善)
2. 修复 - 新增的站点同步无法使用
3. 修复 - 定时任务无法输入内容
14 changes: 12 additions & 2 deletions files/deploy/fastgpt/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,25 @@ services:
# 等待docker-entrypoint.sh脚本执行的MongoDB服务进程
wait $$!
sandbox:
container_name: sandbox
image: ghcr.io/labring/fastgpt-sandbox:v4.8.2 # git
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.8.2 # 阿里云
networks:
- fastgpt
restart: always
fastgpt:
container_name: fastgpt
image: ghcr.io/labring/fastgpt:v4.8.1 # git
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.1 # 阿里云
image: ghcr.io/labring/fastgpt:v4.8.2 # git
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.2 # 阿里云
ports:
- 3000:3000
networks:
- fastgpt
depends_on:
- mongo
- pg
- sandbox
restart: always
environment:
# root 密码,用户名为: root。如果需要修改 root 密码,直接修改这个环境变量,并重启即可。
Expand All @@ -98,6 +106,8 @@ services:
- MONGODB_URI=mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
# pg 连接参数
- PG_URL=postgresql://username:password@pg:5432/postgres
# sandbox 地址
- SANDBOX_URL=http://sandbox:3000
volumes:
- ./config.json:/app/data/config.json
- ./fastgpt/tmp:/app/tmp
Expand Down
38 changes: 9 additions & 29 deletions projects/app/public/docs/versionIntro.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,12 @@
### FastGPT V4.8

本次更新的重点是对工作流 (高级编排) 进行了重构,使其更加简洁和强大。但由于新旧工作流机制有较大变化,尽管我们进行了一定的自动转换,仍有部分工作流需要您手动重建。请尽快更新到新版本,并对工作流进行必要的调试和重新发布。

❗ 重要提示:
1️⃣ 旧工作流更新后暂不失效,打开旧工作流会弹出自动转换提示,重新编排后点 “发布” 按钮发布新工作流
2️⃣ 发布新工作流前,工作流自动保存功能暂不生效
3️⃣ 应用和插件新增 version 字段,标识适用新/旧版工作流,以实现兼容

✨ 新增功能亮点:
1️⃣ 判断器:支持 if/elseIf/else 判断逻辑,工作流控制更灵活
2️⃣ 变量更新节点:运行中可动态修改工作流输出变量或全局变量值
3️⃣ 工作流自动保存和版本管理:自动保存修改,支持查看和回滚历史版本
4️⃣ 工作流调试模式:更直观高效,可调试单节点或逐步执行,实时查看输入输出数据
5️⃣ 定时执行应用:支持简单配置实现各种定时任务

🛠️ 其他优化与修复:
- 优化工作流节点连线方式,支持四向连接,易构建循环工作流
- 显著提升工作流上下文数据传递性能
- 简易模式下修改配置自动刷新调试框,免手动保存
- 改进 worker 进程管理,支持 Token 计算任务分配,提高效率
- 工具调用支持 string、boolean、number 数据类型
- 完善 completions 接口对 size 参数限制
- 重构 Node.js API 中间件和服务端代码
- 对话记录长度调整为偶数,最大长度增至 50 轮,避免奇数导致部分模型不兼容
- HTTP 节点出错将终止进程,避免异常影响
- 修复工具调用名称不能以数字开头问题
- 修复分享链接 query 参数缓存 bug
- 修复工具调用和 HTTP 模块兼容性问题
### FastGPT V4.8.2

- 新增 - 知识库重新选择向量模型重建
- 新增 - 对话框支持问题模糊检索提示,可自定义预设问题词库
- 新增 - js代码运行节点
- 新增 - 外部文件源知识库: [点击查看文档](https://doc.fastai.site/docs/course/externalfile/)
- 新增 - 内容提取节点增加完全提取成功输出
- 新增 - HTTP节点增加错误输出,可以自行判断处理
- 优化 - 插件输入的 debug 模式,支持全量参数输入渲染
- [点击查看高级编排介绍文档](https://doc.fastgpt.in/docs/workflow/intro)
- [使用文档](https://doc.fastgpt.in/docs/intro/)
- [点击查看商业版](https://doc.fastgpt.in/docs/commercial/)
15 changes: 5 additions & 10 deletions projects/app/src/components/core/app/ScheduledTriggerConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const ScheduledTriggerConfig = ({

const timezone = value?.timezone;
const cronString = value?.cronString;
const defaultPrompt = value?.defaultPrompt || '';
const defaultPrompt = value?.defaultPrompt;

const cronSelectList = useRef<MultipleSelectProps['list']>([
{
Expand Down Expand Up @@ -134,15 +134,10 @@ const ScheduledTriggerConfig = ({
timezone?: string;
defaultPrompt?: string;
}) => {
if (!cronString) {
onChange(undefined);
return;
}
onChange({
...value,
cronString,
timezone: timezone || Intl.DateTimeFormat().resolvedOptions().timeZone,
defaultPrompt: defaultPrompt || ''
cronString: cronString ?? value?.cronString ?? '0 0 * * *',
timezone: timezone ?? value?.timezone ?? Intl.DateTimeFormat().resolvedOptions().timeZone,
defaultPrompt: defaultPrompt ?? value?.defaultPrompt ?? ''
});
},
[onChange, value]
Expand Down Expand Up @@ -314,7 +309,7 @@ const ScheduledTriggerConfig = ({
</Box>
</Flex>
<Box mt={5}>
<Box>{t('core.app.schedule.Default prompt')}</Box>
<Box mb={1}>{t('core.app.schedule.Default prompt')}</Box>
<Textarea
value={defaultPrompt}
rows={8}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import { useContextSelector } from 'use-context-selector';
import { WorkflowContext } from '../../context';

const ButtonEdge = (props: EdgeProps) => {
const nodes = useContextSelector(WorkflowContext, (v) => v.nodes);
const setEdges = useContextSelector(WorkflowContext, (v) => v.setEdges);
const workflowDebugData = useContextSelector(WorkflowContext, (v) => v.workflowDebugData);
const { nodes, setEdges, workflowDebugData, hoverEdgeId } = useContextSelector(
WorkflowContext,
(v) => v
);

const {
id,
Expand Down Expand Up @@ -50,6 +51,7 @@ const ButtonEdge = (props: EdgeProps) => {
});

const isToolEdge = sourceHandleId === NodeOutputKeyEnum.selectedTools;
const isHover = hoverEdgeId === id;

const { newTargetX, newTargetY } = useMemo(() => {
if (targetPosition === 'left') {
Expand Down Expand Up @@ -116,24 +118,23 @@ const ButtonEdge = (props: EdgeProps) => {
})();
return (
<EdgeLabelRenderer>
{highlightEdge && (
<Flex
alignItems={'center'}
justifyContent={'center'}
position={'absolute'}
transform={`translate(-55%, -50%) translate(${labelX}px,${labelY}px)`}
pointerEvents={'all'}
w={'17px'}
h={'17px'}
bg={'white'}
borderRadius={'17px'}
cursor={'pointer'}
zIndex={1000}
onClick={() => onDelConnect(id)}
>
<MyIcon name={'core/workflow/closeEdge'} w={'100%'}></MyIcon>
</Flex>
)}
<Flex
display={isHover || highlightEdge ? 'flex' : 'none'}
alignItems={'center'}
justifyContent={'center'}
position={'absolute'}
transform={`translate(-55%, -50%) translate(${labelX}px,${labelY}px)`}
pointerEvents={'all'}
w={'17px'}
h={'17px'}
bg={'white'}
borderRadius={'17px'}
cursor={'pointer'}
zIndex={1000}
onClick={() => onDelConnect(id)}
>
<MyIcon name={'core/workflow/closeEdge'} w={'100%'}></MyIcon>
</Flex>
{!isToolEdge && (
<Flex
alignItems={'center'}
Expand Down Expand Up @@ -161,6 +162,7 @@ const ButtonEdge = (props: EdgeProps) => {
</EdgeLabelRenderer>
);
}, [
isHover,
highlightEdge,
labelX,
labelY,
Expand Down
33 changes: 25 additions & 8 deletions projects/app/src/components/core/workflow/Flow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import ReactFlow, {
NodeChange,
OnConnectStartParams,
addEdge,
EdgeChange
EdgeChange,
Edge
} from 'reactflow';
import { Box, Flex, IconButton, useDisclosure } from '@chakra-ui/react';
import { SmallCloseIcon } from '@chakra-ui/icons';
Expand Down Expand Up @@ -74,13 +75,16 @@ const Container = React.memo(function Container() {
});

const { isDowningCtrl } = useKeyboard();
const setConnectingEdge = useContextSelector(WorkflowContext, (v) => v.setConnectingEdge);
const reactFlowWrapper = useContextSelector(WorkflowContext, (v) => v.reactFlowWrapper);
const nodes = useContextSelector(WorkflowContext, (v) => v.nodes);
const onNodesChange = useContextSelector(WorkflowContext, (v) => v.onNodesChange);
const edges = useContextSelector(WorkflowContext, (v) => v.edges);
const setEdges = useContextSelector(WorkflowContext, (v) => v.setEdges);
const onEdgesChange = useContextSelector(WorkflowContext, (v) => v.onEdgesChange);
const {
setConnectingEdge,
reactFlowWrapper,
nodes,
onNodesChange,
edges,
setEdges,
onEdgesChange,
setHoverEdgeId
} = useContextSelector(WorkflowContext, (v) => v);

/* node */
const handleNodesChange = useCallback(
Expand Down Expand Up @@ -159,6 +163,17 @@ const Container = React.memo(function Container() {
[onConnect, t, toast]
);

/* edge */
const onEdgeMouseEnter = useCallback(
(e: any, edge: Edge) => {
setHoverEdgeId(edge.id);
},
[setHoverEdgeId]
);
const onEdgeMouseLeave = useCallback(() => {
setHoverEdgeId(undefined);
}, [setHoverEdgeId]);

return (
<>
<ReactFlow
Expand All @@ -178,6 +193,8 @@ const Container = React.memo(function Container() {
onConnect={customOnConnect}
onConnectStart={onConnectStart}
onConnectEnd={onConnectEnd}
onEdgeMouseEnter={onEdgeMouseEnter}
onEdgeMouseLeave={onEdgeMouseLeave}
>
<FlowController />
</ReactFlow>
Expand Down
8 changes: 8 additions & 0 deletions projects/app/src/components/core/workflow/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ type WorkflowContextType = {
sourceHandle?: string | undefined;
targetHandle?: string | undefined;
}) => void;
hoverEdgeId?: string;
setHoverEdgeId: React.Dispatch<React.SetStateAction<string | undefined>>;

// connect
connectingEdge?: OnConnectStartParams;
Expand Down Expand Up @@ -216,6 +218,9 @@ export const WorkflowContext = createContext<WorkflowContextType>({
isShowVersionHistories: false,
setIsShowVersionHistories: function (value: React.SetStateAction<boolean>): void {
throw new Error('Function not implemented.');
},
setHoverEdgeId: function (value: React.SetStateAction<string | undefined>): void {
throw new Error('Function not implemented.');
}
});

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

/* edge */
const [edges, setEdges, onEdgesChange] = useEdgesState([]);
const [hoverEdgeId, setHoverEdgeId] = useState<string>();
const onDelEdge = useCallback(
({
nodeId,
Expand Down Expand Up @@ -673,6 +679,8 @@ const WorkflowContextProvider = ({
// edge
edges,
setEdges,
hoverEdgeId,
setHoverEdgeId,
onEdgesChange,
connectingEdge,
setConnectingEdge,
Expand Down
Loading

0 comments on commit 8ba8488

Please sign in to comment.