Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web): Add DAG variables to web flow #1981

Merged
merged 95 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
725e557
feat: Support some higher-order operators
fangyinc Aug 28, 2024
1f676b9
feat: Support endpoint placeholder
fangyinc Aug 28, 2024
439b5b3
feat: Support mappers in inputs and outputs
fangyinc Aug 29, 2024
494eb58
feat: Support variables query API
fangyinc Aug 29, 2024
147051c
feat: Support query file metadatas
fangyinc Aug 29, 2024
08749a0
feat: Support dynamic parameters
fangyinc Aug 29, 2024
f1e00a7
feat: Support rag flow template
fangyinc Aug 30, 2024
c67b500
chore: Merge latest code
fangyinc Aug 30, 2024
bf63a96
feat: Support endpoint placeholder
fangyinc Aug 28, 2024
0e71991
chore: Merge latest code
fangyinc Aug 30, 2024
93527e0
feat: Support variables query API
fangyinc Aug 29, 2024
0219f57
feat: Support query file metadatas
fangyinc Aug 29, 2024
e9155f0
feat: Support dynamic parameters
fangyinc Aug 29, 2024
d152017
feat: Support rag flow template
fangyinc Aug 30, 2024
dbd1a4a
Merge branch 'flow2.0-operators' into chore/update-api
Aug 30, 2024
08b0c78
Merge branch 'flow2.0-operators' of https:/eosphoros-ai/D…
Aug 30, 2024
3e0a243
Merge branch 'flow2.0-operators' into chore/update-api
Aug 30, 2024
f978a50
chore: update flow api (#1931)
Dreammy23 Aug 30, 2024
d07cce6
chore: update SaveFlowModal component to use useRouter hook and add u…
Aug 30, 2024
2393842
fix: update SaveFlowModal component to use useRouter hook and add use…
Dreammy23 Aug 30, 2024
0392ab6
feat:update deploy state in SaveFlowModal component
Aug 30, 2024
161d04d
feat: update deploy state in SaveFlowModal component (#1934)
Dreammy23 Aug 30, 2024
6030fe1
chore: Fix import flow error
fangyinc Aug 30, 2024
b1ca247
Merge branch 'flow2.0-operators' of https:/eosphoros-ai/D…
fangyinc Aug 30, 2024
293fbb0
chore: Remove unnecessary code in Flow component
Aug 30, 2024
8d64679
chore: Remove unnecessary code in Flow component (#1936)
Dreammy23 Aug 30, 2024
f8789c0
feat: Add AddFlowVariable component for managing flow variables
Sep 2, 2024
ea71c49
feat: Add AddFlowVariable component for managing flow variables (#1944)
Dreammy23 Sep 2, 2024
a09587d
Merge branch 'flow2.0-operators' into chore/update-api-new
Sep 2, 2024
03e3f93
chore: update api (#1945)
Dreammy23 Sep 2, 2024
4edc64a
feat: import update canvas flow
yunfeng1993 Sep 2, 2024
1bc77f9
feat: Update AddFlowVariable component to include parameter management
Sep 2, 2024
4bd4d0a
chore: Update AddFlowVariable component to remove unnecessary code in…
Sep 2, 2024
7661de8
chore: Update AddFlowVariable component to remove unnecessary code i…
Dreammy23 Sep 3, 2024
230ba69
chore: Update getFlowNodes function to accept optional tags parameter
Sep 3, 2024
e14eb25
chore: Update AddNodesSider component to toggle between all nodes and…
Sep 3, 2024
72299da
chore: Remove commented out code for advanced and default modes in fl…
Sep 3, 2024
9c1f788
chore: Remove commented out code for advanced and default modes in fl…
Dreammy23 Sep 3, 2024
907897c
chore: Update AddFlowVariableModal component to include parameter man…
Sep 3, 2024
46cb6ac
chore: Update AddFlowVariableModal component to include parameter man…
Dreammy23 Sep 3, 2024
bc87dec
feat: upload metadata 、ui size settings 276 320 530 、import flow
yunfeng1993 Sep 3, 2024
37aed53
feat:Optimized code
Sep 4, 2024
d96e1ec
fix: upload loading
Sep 4, 2024
839a946
chore: Update AddFlowVariableModal component to include parameter man…
Sep 4, 2024
bb97721
Update AddFlowVariableModal component to include parameter management
Sep 4, 2024
59b0e68
Update globals.css
yunfeng1993 Sep 4, 2024
75788f1
Update ctx-axios.ts
yunfeng1993 Sep 4, 2024
9b9030c
Delete web/utils/ctx-axios.ts
yunfeng1993 Sep 4, 2024
ecc9c42
fix: axios file
Sep 4, 2024
b87b42f
feat: upload metadata 、ui size settings 276 320 530 、import flow (#1965)
Dreammy23 Sep 4, 2024
04af499
Update AddFlowVariableModal component to include parameter management
Sep 4, 2024
ed12ee0
Merge branch 'feat/sprint-flow-remaining-requirements' into feat/dag
Sep 4, 2024
af09d14
feat: Update AddFlowVariableModal component to include parameter mana…
Dreammy23 Sep 4, 2024
fbfb851
feat:Eslint formatting
Sep 4, 2024
9a4e6b6
feat: Add support for retrieving keys and variables by key in Flow API
Sep 4, 2024
f6bc56a
feat: Add support for retrieving keys and variables by key in Flow AP…
Dreammy23 Sep 4, 2024
25944c7
feat: Refactor AddFlowVariableModal to use buildVariableString from u…
Sep 4, 2024
5a35640
refactor: Refactor AddFlowVariableModal to use buildVariableString fr…
Dreammy23 Sep 4, 2024
f8ce7d4
feat: Check serialization for AWEL operator function
fangyinc Sep 4, 2024
8fb595a
feat: Update AddNodesSider component to use Switch instead of Tag for…
Sep 4, 2024
1794069
feat: Update AddNodesSider component to use Switch instead of Tag for…
Dreammy23 Sep 4, 2024
6ca1381
Merge branch 'flow2.0-operators' into chore/update-api
Sep 4, 2024
cbfd3d2
chore: update api (#1972)
Dreammy23 Sep 4, 2024
00d9e51
refactor: Simplify AppContent component by removing unnecessary div a…
Sep 4, 2024
ef04432
fix: set flow variable default value
Sep 4, 2024
ef624b0
fix: set flow variable default value (#1973)
Dreammy23 Sep 4, 2024
5617385
feat: Add helper function to render control component in AddFlowVaria…
Sep 4, 2024
19b8d45
feat: Add helper function to render control component in AddFlowVaria…
Dreammy23 Sep 4, 2024
70dc475
feat: Bring In Template
yunfeng1993 Sep 4, 2024
3b6a5bd
feat: lang setting
yunfeng1993 Sep 4, 2024
62b051c
refactor: Update AddFlowVariableModal to use buildVariableString from…
Sep 4, 2024
f3fe4cd
refactor: Update AddFlowVariableModal to use buildVariableString from…
Dreammy23 Sep 4, 2024
45dec7a
refactor: Improve input handling in AddFlowVariableModal
Sep 4, 2024
b501920
refactor: Improve input handling in AddFlowVariableModal (#1977)
Dreammy23 Sep 4, 2024
a8b6b82
refactor: Update AddFlowVariableModal to use buildVariableString from…
Sep 4, 2024
104b7d0
refactor: Update AddFlowVariableModal to set a minimum height for the…
Sep 4, 2024
58051df
refactor: Update AddFlowVariableModal to set a minimum height for the…
Dreammy23 Sep 4, 2024
4d4aac4
refactor: Update AddFlowVariableModal to include hover effect on vari…
Sep 4, 2024
f214572
refactor: Update AddFlowVariableModal styles and functionality
Sep 4, 2024
7feb1c3
refactor: Update AddFlowVariableModal styles and functionality (#1979)
Dreammy23 Sep 4, 2024
21146bb
Merge branch 'feat/sprint-flow-remaining-requirements' into feat/spri…
Sep 4, 2024
95e119f
refactor: Update FlowTemplateModal component to use correct prop names
Sep 4, 2024
59bbe9b
feat: Bring In Template (#1975)
Dreammy23 Sep 4, 2024
b60dd3b
style: Rename template-flow-modal to flow-template-modal and update i…
Sep 4, 2024
595c1f2
Merge branch 'main' into chore/merge-main
Sep 5, 2024
2aa791c
chore: merge main (#1982)
Dreammy23 Sep 5, 2024
a3a9da8
feat: flow template add label 、 description
yunfeng1993 Sep 8, 2024
713714f
Update flow-template-modal.tsx
yunfeng1993 Sep 9, 2024
c39a213
Update flow-template-modal.tsx
yunfeng1993 Sep 9, 2024
f6b9dfa
Update flow.ts
yunfeng1993 Sep 9, 2024
bc717c4
Update flow.ts
yunfeng1993 Sep 9, 2024
cadc59b
feat: flow template add label 、 description (#1985)
Dreammy23 Sep 9, 2024
2e99116
chore: Merge latest code
fangyinc Sep 9, 2024
a5145aa
fix: Eslint formatting
Sep 9, 2024
f273cb4
fix: Eslint formatting (#1987)
Dreammy23 Sep 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions i18n/translate_util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Translate the po file content to Chinese using LLM."""

from typing import List, Dict, Any
import asyncio
import os
Expand Down Expand Up @@ -147,6 +148,8 @@
"RAG": "RAG",
"DB-GPT": "DB-GPT",
"AWEL flow": "AWEL 工作流",
"Agent": "智能体",
"Agents": "智能体",
},
"default": {
"Transformer": "Transformer",
Expand All @@ -159,6 +162,8 @@
"RAG": "RAG",
"DB-GPT": "DB-GPT",
"AWEL flow": "AWEL flow",
"Agent": "Agent",
"Agents": "Agents",
},
}

Expand Down
29 changes: 22 additions & 7 deletions web/client/api/flow/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import {
IFlowRefreshParams,
IFlowResponse,
IFlowUpdateParam,
IGetKeysRequestParams,
IGetKeysResponseData,
IGetVariablesByKeyRequestParams,
IGetVariablesByKeyResponseData,
IUploadFileRequestParams,
IUploadFileResponse,
} from '@/types/flow';
Expand Down Expand Up @@ -35,8 +39,8 @@ export const deleteFlowById = (id: string) => {
return DELETE<null, null>(`/api/v2/serve/awel/flows/${id}`);
};

export const getFlowNodes = () => {
return GET<null, Array<IFlowNode>>(`/api/v2/serve/awel/nodes`);
export const getFlowNodes = (tags?: string) => {
return GET<{ tags?: string }, Array<IFlowNode>>(`/api/v2/serve/awel/nodes`, { tags });
};

export const refreshFlowNodeById = (data: IFlowRefreshParams) => {
Expand All @@ -63,11 +67,22 @@ export const downloadFile = (fileId: string) => {
return GET<null, any>(`/api/v2/serve/file/files/dbgpt/${fileId}`);
};

// TODO:wait for interface update
export const getFlowTemplateList = () => {
return GET<null, Array<any>>('/api/v2/serve/awel/flow/templates');
};

export const getFlowTemplateById = (id: string) => {
return GET<null, any>(`/api/v2/serve/awel/flow/templates/${id}`);
};

export const getFlowTemplates = () => {
return GET<null, any>(`/api/v2/serve/awel/flow/templates`);
};

export const getKeys = (data?: IGetKeysRequestParams) => {
return GET<IGetKeysRequestParams, Array<IGetKeysResponseData>>('/api/v2/serve/awel/variables/keys', data);
};

export const getVariablesByKey = (data: IGetVariablesByKeyRequestParams) => {
return GET<IGetVariablesByKeyRequestParams, IGetVariablesByKeyResponseData>('/api/v2/serve/awel/variables', data);
};

export const metadataBatch = (data: IUploadFileRequestParams) => {
return POST<IUploadFileRequestParams, Array<IUploadFileResponse>>('/api/v2/serve/file/files/metadata/batch', data);
};
40 changes: 33 additions & 7 deletions web/components/flow/add-nodes-sider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ import { IFlowNode } from '@/types/flow';
import { FLOW_NODES_KEY } from '@/utils';
import { CaretLeftOutlined, CaretRightOutlined } from '@ant-design/icons';
import type { CollapseProps } from 'antd';
import { Badge, Collapse, Input, Layout, Space } from 'antd';
import { Badge, Collapse, Input, Layout, Space, Switch } from 'antd';
import classnames from 'classnames';
import React, { useContext, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import StaticNodes from './static-nodes';

const { Search } = Input;
const { Sider } = Layout;

const TAGS = JSON.stringify({ order: 'higher-order' });

type GroupType = {
category: string;
categoryLabel: string;
Expand Down Expand Up @@ -41,13 +44,16 @@ const AddNodesSider: React.FC = () => {
const [resources, setResources] = useState<Array<IFlowNode>>([]);
const [operatorsGroup, setOperatorsGroup] = useState<GroupType[]>([]);
const [resourcesGroup, setResourcesGroup] = useState<GroupType[]>([]);
const [isAllNodesVisible, setIsAllNodesVisible] = useState<boolean>(false);

useEffect(() => {
getNodes();
getNodes(TAGS);
}, []);

async function getNodes() {
const [_, data] = await apiInterceptors(getFlowNodes());
// tags is optional, if tags is not passed, it will get all nodes
async function getNodes(tags?: string) {
const [_, data] = await apiInterceptors(getFlowNodes(tags));

if (data && data.length > 0) {
localStorage.setItem(FLOW_NODES_KEY, JSON.stringify(data));
const operatorNodes = data.filter(node => node.flow_type === 'operator');
Expand Down Expand Up @@ -166,6 +172,16 @@ const AddNodesSider: React.FC = () => {
setSearchValue(val);
}

function onModeChange() {
if (isAllNodesVisible) {
getNodes(TAGS);
} else {
getNodes();
}

setIsAllNodesVisible(!isAllNodesVisible);
}

return (
<Sider
className='flex justify-center items-start nodrag bg-[#ffffff80] border-r border-[#d5e5f6] dark:bg-[#ffffff29] dark:border-[#ffffff66]'
Expand All @@ -179,9 +195,19 @@ const AddNodesSider: React.FC = () => {
onCollapse={collapsed => setCollapsed(collapsed)}
>
<Space direction='vertical' className='w-[280px] pt-4 px-4 overflow-hidden overflow-y-auto scrollbar-default'>
<p className='w-full text-base font-semibold text-[#1c2533] dark:text-[rgba(255,255,255,0.85)] line-clamp-1'>
{t('add_node')}
</p>
<div className='flex justify-between align-middle'>
<p className='w-full text-base font-semibold text-[#1c2533] dark:text-[rgba(255,255,255,0.85)] line-clamp-1'>
{t('add_node')}
</p>

<Switch
checkedChildren='高阶'
unCheckedChildren='全部'
onClick={onModeChange}
className={classnames('w-20', { 'bg-zinc-400': isAllNodesVisible })}
defaultChecked
/>
</div>

<Search placeholder='Search node' onSearch={searchNode} allowClear />

Expand Down
Loading
Loading