mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-01-01 01:25:32 +08:00
Feat: Fixed the issue where the newly created agent begin node displayed "undefined". #10427 (#12348)
### What problem does this PR solve? Feat: Fixed the issue where the newly created agent begin node displayed "undefined". #10427 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -211,3 +211,14 @@ export const WebhookJWTAlgorithmList = [
|
|||||||
'ps512',
|
'ps512',
|
||||||
'none',
|
'none',
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
|
export enum AgentDialogueMode {
|
||||||
|
Conversational = 'conversational',
|
||||||
|
Task = 'task',
|
||||||
|
Webhook = 'Webhook',
|
||||||
|
}
|
||||||
|
|
||||||
|
export const initialBeginValues = {
|
||||||
|
mode: AgentDialogueMode.Conversational,
|
||||||
|
prologue: `Hi! I'm your assistant. What can I do for you?`,
|
||||||
|
};
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { FileUploadProps } from '@/components/file-upload';
|
import { FileUploadProps } from '@/components/file-upload';
|
||||||
import { useHandleFilterSubmit } from '@/components/list-filter-bar/use-handle-filter-submit';
|
import { useHandleFilterSubmit } from '@/components/list-filter-bar/use-handle-filter-submit';
|
||||||
import message from '@/components/ui/message';
|
import message from '@/components/ui/message';
|
||||||
import { AgentGlobals } from '@/constants/agent';
|
import { AgentGlobals, initialBeginValues } from '@/constants/agent';
|
||||||
import {
|
import {
|
||||||
IAgentLogsRequest,
|
IAgentLogsRequest,
|
||||||
IAgentLogsResponse,
|
IAgentLogsResponse,
|
||||||
@ -76,6 +76,7 @@ export const EmptyDsl = {
|
|||||||
data: {
|
data: {
|
||||||
label: 'Begin',
|
label: 'Begin',
|
||||||
name: 'begin',
|
name: 'begin',
|
||||||
|
form: initialBeginValues,
|
||||||
},
|
},
|
||||||
sourcePosition: 'left',
|
sourcePosition: 'left',
|
||||||
targetPosition: 'right',
|
targetPosition: 'right',
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import {
|
|||||||
} from '../../constant';
|
} from '../../constant';
|
||||||
import { BeginFormSchemaType } from '../../form/begin-form/schema';
|
import { BeginFormSchemaType } from '../../form/begin-form/schema';
|
||||||
import { useBuildWebhookUrl } from '../../hooks/use-build-webhook-url';
|
import { useBuildWebhookUrl } from '../../hooks/use-build-webhook-url';
|
||||||
|
import { useIsPipeline } from '../../hooks/use-is-pipeline';
|
||||||
import OperatorIcon from '../../operator-icon';
|
import OperatorIcon from '../../operator-icon';
|
||||||
import { LabelCard } from './card';
|
import { LabelCard } from './card';
|
||||||
import { CommonHandle } from './handle';
|
import { CommonHandle } from './handle';
|
||||||
@ -34,6 +35,8 @@ function InnerBeginNode({
|
|||||||
|
|
||||||
const url = useBuildWebhookUrl();
|
const url = useBuildWebhookUrl();
|
||||||
|
|
||||||
|
const isPipeline = useIsPipeline();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NodeWrapper selected={selected} id={id}>
|
<NodeWrapper selected={selected} id={id}>
|
||||||
<CommonHandle
|
<CommonHandle
|
||||||
@ -45,15 +48,17 @@ function InnerBeginNode({
|
|||||||
id={NodeHandleId.Start}
|
id={NodeHandleId.Start}
|
||||||
></CommonHandle>
|
></CommonHandle>
|
||||||
|
|
||||||
<section className="flex items-center gap-2">
|
<section className="flex items-center gap-2">
|
||||||
<OperatorIcon name={data.label as Operator}></OperatorIcon>
|
<OperatorIcon name={data.label as Operator}></OperatorIcon>
|
||||||
<div className="truncate text-center font-semibold text-sm">
|
<div className="truncate text-center font-semibold text-sm">
|
||||||
{t(`flow.begin`)}
|
{t(`flow.begin`)}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<div className="text-accent-primary mt-2 p-1 bg-bg-accent w-fit rounded-sm text-xs">
|
{isPipeline || (
|
||||||
{t(`flow.${isWebhookMode ? 'webhook.name' : mode}`)}
|
<div className="text-accent-primary mt-2 p-1 bg-bg-accent w-fit rounded-sm text-xs">
|
||||||
</div>
|
{t(`flow.${isWebhookMode ? 'webhook.name' : mode}`)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{isWebhookMode ? (
|
{isWebhookMode ? (
|
||||||
<LabelCard className="mt-2 flex gap-1 items-center">
|
<LabelCard className="mt-2 flex gap-1 items-center">
|
||||||
<span className="font-bold">URL</span>
|
<span className="font-bold">URL</span>
|
||||||
|
|||||||
@ -15,19 +15,15 @@ import {
|
|||||||
initialLlmBaseValues,
|
initialLlmBaseValues,
|
||||||
} from '@/constants/agent';
|
} from '@/constants/agent';
|
||||||
export {
|
export {
|
||||||
|
AgentDialogueMode,
|
||||||
AgentStructuredOutputField,
|
AgentStructuredOutputField,
|
||||||
JsonSchemaDataType,
|
JsonSchemaDataType,
|
||||||
Operator,
|
Operator,
|
||||||
|
initialBeginValues,
|
||||||
} from '@/constants/agent';
|
} from '@/constants/agent';
|
||||||
|
|
||||||
export * from './pipeline';
|
export * from './pipeline';
|
||||||
|
|
||||||
export enum AgentDialogueMode {
|
|
||||||
Conversational = 'conversational',
|
|
||||||
Task = 'task',
|
|
||||||
Webhook = 'Webhook',
|
|
||||||
}
|
|
||||||
|
|
||||||
import { ModelVariableType } from '@/constants/knowledge';
|
import { ModelVariableType } from '@/constants/knowledge';
|
||||||
import { t } from 'i18next';
|
import { t } from 'i18next';
|
||||||
|
|
||||||
@ -109,11 +105,6 @@ export const initialRetrievalValues = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const initialBeginValues = {
|
|
||||||
mode: AgentDialogueMode.Conversational,
|
|
||||||
prologue: `Hi! I'm your assistant. What can I do for you?`,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const initialRewriteQuestionValues = {
|
export const initialRewriteQuestionValues = {
|
||||||
...initialLlmBaseValues,
|
...initialLlmBaseValues,
|
||||||
language: '',
|
language: '',
|
||||||
@ -750,6 +741,8 @@ export const NodeMap = {
|
|||||||
[Operator.Loop]: 'loopNode',
|
[Operator.Loop]: 'loopNode',
|
||||||
[Operator.LoopStart]: 'loopStartNode',
|
[Operator.LoopStart]: 'loopStartNode',
|
||||||
[Operator.ExitLoop]: 'exitLoopNode',
|
[Operator.ExitLoop]: 'exitLoopNode',
|
||||||
|
[Operator.ExcelProcessor]: 'ragNode',
|
||||||
|
[Operator.PDFGenerator]: 'ragNode',
|
||||||
};
|
};
|
||||||
|
|
||||||
export enum BeginQueryType {
|
export enum BeginQueryType {
|
||||||
|
|||||||
@ -179,6 +179,8 @@ export const useInitializeOperatorParams = () => {
|
|||||||
[Operator.Loop]: initialLoopValues,
|
[Operator.Loop]: initialLoopValues,
|
||||||
[Operator.LoopStart]: {},
|
[Operator.LoopStart]: {},
|
||||||
[Operator.ExitLoop]: {},
|
[Operator.ExitLoop]: {},
|
||||||
|
[Operator.PDFGenerator]: {},
|
||||||
|
[Operator.ExcelProcessor]: {},
|
||||||
};
|
};
|
||||||
}, [llmId]);
|
}, [llmId]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user