mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-05-05 17:57:47 +08:00
Refactor: Delete flow.ts (#13498)
### What problem does this PR solve? Feat: Delete flow.ts ### Type of change - [x] Refactoring
This commit is contained in:
@ -13,14 +13,14 @@ import vi_VN from 'antd/locale/vi_VN';
|
||||
import zhCN from 'antd/locale/zh_CN';
|
||||
import zh_HK from 'antd/locale/zh_HK';
|
||||
import dayjs from 'dayjs';
|
||||
import 'dayjs/locale/ar';
|
||||
import 'dayjs/locale/zh-cn';
|
||||
import advancedFormat from 'dayjs/plugin/advancedFormat';
|
||||
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
||||
import localeData from 'dayjs/plugin/localeData';
|
||||
import weekOfYear from 'dayjs/plugin/weekOfYear';
|
||||
import weekYear from 'dayjs/plugin/weekYear';
|
||||
import weekday from 'dayjs/plugin/weekday';
|
||||
import 'dayjs/locale/ar';
|
||||
import 'dayjs/locale/zh-cn';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { RouterProvider } from 'react-router';
|
||||
import { ThemeProvider, useTheme } from './components/theme-provider';
|
||||
|
||||
@ -1,191 +0,0 @@
|
||||
import { Edge, Node } from '@xyflow/react';
|
||||
import { IReference, Message } from './chat';
|
||||
|
||||
export type DSLComponents = Record<string, IOperator>;
|
||||
|
||||
export interface DSL {
|
||||
components: DSLComponents;
|
||||
history: any[];
|
||||
path?: string[][];
|
||||
answer?: any[];
|
||||
graph?: IGraph;
|
||||
messages: Message[];
|
||||
reference: IReference[];
|
||||
globals: Record<string, any>;
|
||||
retrieval: IReference[];
|
||||
}
|
||||
|
||||
export interface IOperator {
|
||||
obj: IOperatorNode;
|
||||
downstream: string[];
|
||||
upstream: string[];
|
||||
parent_id?: string;
|
||||
}
|
||||
|
||||
export interface IOperatorNode {
|
||||
component_name: string;
|
||||
params: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export declare interface IFlow {
|
||||
avatar?: string;
|
||||
canvas_type: null;
|
||||
create_date: string;
|
||||
create_time: number;
|
||||
description: string;
|
||||
dsl: DSL;
|
||||
id: string;
|
||||
title: string;
|
||||
update_date: string;
|
||||
update_time: number;
|
||||
user_id: string;
|
||||
permission: string;
|
||||
nickname: string;
|
||||
release?: boolean;
|
||||
}
|
||||
|
||||
export interface IFlowTemplate {
|
||||
avatar: string;
|
||||
canvas_type: string;
|
||||
canvas_category?: string;
|
||||
create_date: string;
|
||||
create_time: number;
|
||||
description: {
|
||||
en: string;
|
||||
zh: string;
|
||||
de: string;
|
||||
};
|
||||
dsl: DSL;
|
||||
id: string;
|
||||
title: {
|
||||
en: string;
|
||||
zh: string;
|
||||
de: string;
|
||||
};
|
||||
update_date: string;
|
||||
update_time: number;
|
||||
}
|
||||
|
||||
export type ICategorizeItemResult = Record<
|
||||
string,
|
||||
Omit<ICategorizeItem, 'name'>
|
||||
>;
|
||||
|
||||
export interface IGenerateForm {
|
||||
max_tokens?: number;
|
||||
temperature?: number;
|
||||
top_p?: number;
|
||||
presence_penalty?: number;
|
||||
frequency_penalty?: number;
|
||||
cite?: boolean;
|
||||
prompt: number;
|
||||
llm_id: string;
|
||||
parameters: { key: string; component_id: string };
|
||||
}
|
||||
export interface ICategorizeItem {
|
||||
name: string;
|
||||
description?: string;
|
||||
examples?: string;
|
||||
to?: string;
|
||||
index: number;
|
||||
}
|
||||
|
||||
export interface ICategorizeForm extends IGenerateForm {
|
||||
category_description: ICategorizeItemResult;
|
||||
}
|
||||
|
||||
export interface IRelevantForm extends IGenerateForm {
|
||||
yes: string;
|
||||
no: string;
|
||||
}
|
||||
|
||||
export interface ISwitchCondition {
|
||||
items: ISwitchItem[];
|
||||
logical_operator: string;
|
||||
to: string[] | string;
|
||||
}
|
||||
|
||||
export interface ISwitchItem {
|
||||
cpn_id: string;
|
||||
operator: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface ISwitchForm {
|
||||
conditions: ISwitchCondition[];
|
||||
end_cpn_id: string;
|
||||
no: string;
|
||||
}
|
||||
|
||||
export interface IBeginForm {
|
||||
prologue?: string;
|
||||
}
|
||||
|
||||
export interface IRetrievalForm {
|
||||
similarity_threshold?: number;
|
||||
keywords_similarity_weight?: number;
|
||||
top_n?: number;
|
||||
top_k?: number;
|
||||
rerank_id?: string;
|
||||
empty_response?: string;
|
||||
kb_ids: string[];
|
||||
}
|
||||
|
||||
export interface ICodeForm {
|
||||
inputs?: Array<{ name?: string; component_id?: string }>;
|
||||
lang: string;
|
||||
script?: string;
|
||||
}
|
||||
|
||||
export type BaseNodeData<TForm extends any> = {
|
||||
label: string; // operator type
|
||||
name: string; // operator name
|
||||
color?: string;
|
||||
form?: TForm;
|
||||
};
|
||||
|
||||
export type BaseNode<T = any> = Node<BaseNodeData<T>>;
|
||||
|
||||
export type IBeginNode = BaseNode<IBeginForm>;
|
||||
export type IRetrievalNode = BaseNode<IRetrievalForm>;
|
||||
export type IGenerateNode = BaseNode<IGenerateForm>;
|
||||
export type ICategorizeNode = BaseNode<ICategorizeForm>;
|
||||
export type ISwitchNode = BaseNode<ISwitchForm>;
|
||||
export type IRagNode = BaseNode;
|
||||
export type IRelevantNode = BaseNode;
|
||||
export type ILogicNode = BaseNode;
|
||||
export type INoteNode = BaseNode;
|
||||
export type IMessageNode = BaseNode;
|
||||
export type IRewriteNode = BaseNode;
|
||||
export type IInvokeNode = BaseNode;
|
||||
export type ITemplateNode = BaseNode;
|
||||
export type IEmailNode = BaseNode;
|
||||
export type IIterationNode = BaseNode;
|
||||
export type IIterationStartNode = BaseNode;
|
||||
export type IKeywordNode = BaseNode;
|
||||
export type ICodeNode = BaseNode<ICodeForm>;
|
||||
export type IAgentNode<T = any> = BaseNode<T>;
|
||||
|
||||
export type RAGFlowNodeType =
|
||||
| IBeginNode
|
||||
| IRetrievalNode
|
||||
| IGenerateNode
|
||||
| ICategorizeNode
|
||||
| ISwitchNode
|
||||
| IRagNode
|
||||
| IRelevantNode
|
||||
| ILogicNode
|
||||
| INoteNode
|
||||
| IMessageNode
|
||||
| IRewriteNode
|
||||
| IInvokeNode
|
||||
| ITemplateNode
|
||||
| IEmailNode
|
||||
| IIterationNode
|
||||
| IIterationStartNode
|
||||
| IKeywordNode;
|
||||
|
||||
export interface IGraph {
|
||||
nodes: RAGFlowNodeType[];
|
||||
edges: Edge[];
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
import { IAgentNode } from '@/interfaces/database/flow';
|
||||
import { BaseNode } from '@/interfaces/database/agent';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { Handle, NodeProps, Position } from '@xyflow/react';
|
||||
import { get } from 'lodash';
|
||||
@ -20,7 +20,7 @@ function InnerAgentNode({
|
||||
data,
|
||||
isConnectable = true,
|
||||
selected,
|
||||
}: NodeProps<IAgentNode<AgentFormSchemaType>>) {
|
||||
}: NodeProps<BaseNode<AgentFormSchemaType>>) {
|
||||
const edges = useGraphStore((state) => state.edges);
|
||||
const { t } = useTranslation();
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { BaseNode } from '@/interfaces/database/flow';
|
||||
import { BaseNode } from '@/interfaces/database/agent';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { NodeProps, Position } from '@xyflow/react';
|
||||
import get from 'lodash/get';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ICategorizeNode } from '@/interfaces/database/flow';
|
||||
import { ICategorizeNode } from '@/interfaces/database/agent';
|
||||
import { NodeProps, Position } from '@xyflow/react';
|
||||
import { get } from 'lodash';
|
||||
import { memo } from 'react';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { IBeginNode } from '@/interfaces/database/flow';
|
||||
import { IBeginNode } from '@/interfaces/database/agent';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { NodeProps, Position } from '@xyflow/react';
|
||||
import get from 'lodash/get';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { IRagNode } from '@/interfaces/database/flow';
|
||||
import { IRagNode } from '@/interfaces/database/agent';
|
||||
import { NodeProps, Position } from '@xyflow/react';
|
||||
import { PropsWithChildren, memo } from 'react';
|
||||
import { NodeHandleId } from '../../constant';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import {
|
||||
IIterationNode,
|
||||
IIterationStartNode,
|
||||
} from '@/interfaces/database/flow';
|
||||
} from '@/interfaces/database/agent';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { NodeProps, NodeResizeControl, Position } from '@xyflow/react';
|
||||
import { memo } from 'react';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useTheme } from '@/components/theme-provider';
|
||||
import { IKeywordNode } from '@/interfaces/database/flow';
|
||||
import { IKeywordNode } from '@/interfaces/database/agent';
|
||||
import { Handle, NodeProps, Position } from '@xyflow/react';
|
||||
import classNames from 'classnames';
|
||||
import { get } from 'lodash';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { NodeCollapsible } from '@/components/collapse';
|
||||
import { IMessageNode } from '@/interfaces/database/flow';
|
||||
import { IMessageNode } from '@/interfaces/database/agent';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useGetVariableLabelOrTypeByValue } from '@/pages/agent/hooks/use-get-begin-query';
|
||||
import { NodeProps } from '@xyflow/react';
|
||||
|
||||
@ -9,7 +9,7 @@ import {
|
||||
} from '@/components/ui/form';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { INoteNode } from '@/interfaces/database/flow';
|
||||
import { INoteNode } from '@/interfaces/database/agent';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { NotebookPen } from 'lucide-react';
|
||||
import { memo } from 'react';
|
||||
|
||||
@ -2,7 +2,7 @@ import { NodeCollapsible } from '@/components/collapse';
|
||||
import { RAGFlowAvatar } from '@/components/ragflow-avatar';
|
||||
import { useFetchKnowledgeList } from '@/hooks/use-knowledge-request';
|
||||
import { useFetchAllMemoryList } from '@/hooks/use-memory-request';
|
||||
import { BaseNode } from '@/interfaces/database/flow';
|
||||
import { BaseNode } from '@/interfaces/database/agent';
|
||||
import { NodeProps, Position } from '@xyflow/react';
|
||||
import classNames from 'classnames';
|
||||
import { get } from 'lodash';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useTheme } from '@/components/theme-provider';
|
||||
import { IRewriteNode } from '@/interfaces/database/flow';
|
||||
import { IRewriteNode } from '@/interfaces/database/agent';
|
||||
import { Handle, NodeProps, Position } from '@xyflow/react';
|
||||
import classNames from 'classnames';
|
||||
import { get } from 'lodash';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { IRagNode } from '@/interfaces/database/flow';
|
||||
import { IRagNode } from '@/interfaces/database/agent';
|
||||
import { NodeProps, Position } from '@xyflow/react';
|
||||
import { PropsWithChildren, memo } from 'react';
|
||||
import { NodeHandleId, Operator } from '../../constant';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { SwitchOperatorOptions } from '@/constants/agent';
|
||||
import { LogicalOperatorIcon } from '@/hooks/logic-hooks/use-build-operator-options';
|
||||
import { ISwitchCondition, ISwitchNode } from '@/interfaces/database/flow';
|
||||
import { ISwitchCondition, ISwitchNode } from '@/interfaces/database/agent';
|
||||
import { NodeProps, Position } from '@xyflow/react';
|
||||
import { memo, useCallback } from 'react';
|
||||
import { useGetVariableLabelOrTypeByValue } from '../../hooks/use-get-begin-query';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import { useUpdateNodeInternals } from '@xyflow/react';
|
||||
import { get } from 'lodash';
|
||||
import { useEffect, useMemo } from 'react';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ISwitchCondition, RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { ISwitchCondition, RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import { useUpdateNodeInternals } from '@xyflow/react';
|
||||
import get from 'lodash/get';
|
||||
import { useEffect, useMemo } from 'react';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { INodeEvent } from '@/hooks/use-send-message';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import { IMessage } from '@/interfaces/database/chat';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { HandleType, Position } from '@xyflow/react';
|
||||
import { Dispatch, SetStateAction, createContext } from 'react';
|
||||
import { useAddNode } from './hooks/use-add-node';
|
||||
|
||||
@ -7,7 +7,7 @@ import {
|
||||
} from '@/components/ui/sheet';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { IModalProps } from '@/interfaces/common';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { lowerFirst } from 'lodash';
|
||||
import { CirclePlay, X } from 'lucide-react';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useFetchModelId } from '@/hooks/logic-hooks';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import { get, isEmpty, omit } from 'lodash';
|
||||
import { useMemo } from 'react';
|
||||
import { initialAgentValues } from '../../constant';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import { isEmpty } from 'lodash';
|
||||
import { useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ModelVariableType } from '@/constants/knowledge';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import { isEmpty, isPlainObject } from 'lodash';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ import {
|
||||
import { BlurInput } from '@/components/ui/input';
|
||||
import { RAGFlowSelect } from '@/components/ui/select';
|
||||
import { Separator } from '@/components/ui/separator';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import { X } from 'lucide-react';
|
||||
import { ReactNode } from 'react';
|
||||
import { useFieldArray, useFormContext } from 'react-hook-form';
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import { ProgrammingLanguage } from '@/constants/agent';
|
||||
import { ICodeForm } from '@/interfaces/database/agent';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { ICodeForm, RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import { isEmpty } from 'lodash';
|
||||
import { useMemo } from 'react';
|
||||
import { initialCodeValues } from '../../constant';
|
||||
|
||||
@ -11,7 +11,7 @@ import {
|
||||
} from '@/components/ui/form';
|
||||
import { Separator } from '@/components/ui/separator';
|
||||
import { Operator } from '@/constants/agent';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import { t } from 'i18next';
|
||||
import { isEmpty } from 'lodash';
|
||||
import { X } from 'lucide-react';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import { isEmpty } from 'lodash';
|
||||
import { useMemo } from 'react';
|
||||
import { initialIterationValues } from '../../constant';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import { isEmpty, omit } from 'lodash';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import { isEmpty } from 'lodash';
|
||||
import { useMemo } from 'react';
|
||||
import { initialMessageValues } from '../../constant';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import { isEmpty } from 'lodash';
|
||||
import { useMemo } from 'react';
|
||||
import { initialRetrievalValues } from '../../constant';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import { isEmpty } from 'lodash';
|
||||
import { useMemo } from 'react';
|
||||
import {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import { isEmpty } from 'lodash';
|
||||
import { useMemo } from 'react';
|
||||
import { initialSwitchValues } from '../../constant';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import { isEmpty } from 'lodash';
|
||||
import { useMemo } from 'react';
|
||||
import { initialUserFillUpValues } from '../../constant';
|
||||
|
||||
@ -2,7 +2,7 @@ import { Connection, Edge, getOutgoers } from '@xyflow/react';
|
||||
import React, { useCallback, useEffect } from 'react';
|
||||
// import { shallow } from 'zustand/shallow';
|
||||
import { settledModelVariableMap } from '@/constants/knowledge';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import { get, lowerFirst, omit } from 'lodash';
|
||||
import { UseFormReturn } from 'react-hook-form';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import { Node, OnBeforeDelete } from '@xyflow/react';
|
||||
import { Operator } from '../constant';
|
||||
import useGraphStore from '../store';
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { useFetchAgent } from '@/hooks/use-agent-request';
|
||||
import { GlobalVariableType } from '@/interfaces/database/agent';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import {
|
||||
GlobalVariableType,
|
||||
RAGFlowNodeType,
|
||||
} from '@/interfaces/database/agent';
|
||||
import { useCallback } from 'react';
|
||||
import { Operator } from '../constant';
|
||||
import useGraphStore from '../store';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useFetchAgent } from '@/hooks/use-agent-request';
|
||||
import { IGraph } from '@/interfaces/database/flow';
|
||||
import { IGraph } from '@/interfaces/database/agent';
|
||||
import { useEffect } from 'react';
|
||||
import { useSetGraphInfo } from './use-set-graph';
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import { isEmpty } from 'lodash';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { AgentGlobals, AgentStructuredOutputField } from '@/constants/agent';
|
||||
import { useFetchAgent } from '@/hooks/use-agent-request';
|
||||
import { DefaultOptionType } from '@/interfaces/antd-compat';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import {
|
||||
buildNodeOutputOptions,
|
||||
buildOutputOptions,
|
||||
|
||||
@ -3,8 +3,10 @@ import {
|
||||
useResetAgent,
|
||||
useSetAgent,
|
||||
} from '@/hooks/use-agent-request';
|
||||
import { GlobalVariableType } from '@/interfaces/database/agent';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import {
|
||||
GlobalVariableType,
|
||||
RAGFlowNodeType,
|
||||
} from '@/interfaces/database/agent';
|
||||
import { formatDate } from '@/utils/date';
|
||||
import { useDebounceEffect } from 'ahooks';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { IGraph } from '@/interfaces/database/flow';
|
||||
import { IGraph } from '@/interfaces/database/agent';
|
||||
import { useCallback } from 'react';
|
||||
import useGraphStore from '../store';
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { FormInstance } from '@/interfaces/antd-compat';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
|
||||
export interface IOperatorForm {
|
||||
onValuesChange?(changedValues: any, values: any): void;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { IAgentForm } from '@/interfaces/database/agent';
|
||||
import { IAgentNode, RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { RAGFlowNodeType } from '@/interfaces/database/agent';
|
||||
import type {} from '@redux-devtools/extension';
|
||||
import {
|
||||
Connection,
|
||||
@ -528,9 +528,7 @@ const useGraphStore = create<RFState>()(
|
||||
return generateNodeNamesWithIncreasingIndex(name, nodes);
|
||||
},
|
||||
generateAgentToolName: (id: string, name: string) => {
|
||||
const node = get().nodes.find(
|
||||
(x) => x.id === id,
|
||||
) as IAgentNode<IAgentForm>;
|
||||
const node = get().nodes.find((x) => x.id === id) as RAGFlowNodeType;
|
||||
|
||||
if (!node) {
|
||||
return '';
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
import { FormInstance, FormListFieldData } from '@/interfaces/antd-compat';
|
||||
import {
|
||||
DSL,
|
||||
DSLComponents,
|
||||
GlobalVariableType,
|
||||
IAgentForm,
|
||||
ICategorizeForm,
|
||||
ICategorizeItem,
|
||||
ICategorizeItemResult,
|
||||
RAGFlowNodeType,
|
||||
} from '@/interfaces/database/agent';
|
||||
import { DSLComponents, RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||
import { buildSelectOptions } from '@/utils/component-util';
|
||||
import { buildOptions, removeUselessFieldsFromValues } from '@/utils/form';
|
||||
import { Edge, Node, XYPosition } from '@xyflow/react';
|
||||
@ -573,22 +573,6 @@ export const getOperatorIndex = (handleTitle: string) => {
|
||||
return handleTitle.split(' ').at(-1);
|
||||
};
|
||||
|
||||
// Get the value of other forms except itself
|
||||
export const getOtherFieldValues = (
|
||||
form: FormInstance,
|
||||
formListName: string = 'items',
|
||||
field: FormListFieldData,
|
||||
latestField: string,
|
||||
) =>
|
||||
(form.getFieldValue([formListName]) ?? [])
|
||||
.map((x: any) => {
|
||||
return get(x, latestField);
|
||||
})
|
||||
.filter(
|
||||
(x: string) =>
|
||||
x !== form.getFieldValue([formListName, field.name, latestField]),
|
||||
);
|
||||
|
||||
export const generateSwitchHandleText = (idx: number) => {
|
||||
return `Case ${idx + 1}`;
|
||||
};
|
||||
|
||||
@ -42,8 +42,8 @@ export function Banner() {
|
||||
export function NextBanner() {
|
||||
const { t, i18n } = useTranslation();
|
||||
return (
|
||||
<h1
|
||||
className="text-5xl leading-normal text-left"
|
||||
<h1
|
||||
className="text-5xl leading-normal text-left"
|
||||
dir={i18n.language?.startsWith('ar') ? 'rtl' : 'ltr'}
|
||||
>
|
||||
<span className="font-semibold text-text-primary">
|
||||
|
||||
Reference in New Issue
Block a user