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:
balibabu
2025-12-31 11:19:33 +08:00
committed by GitHub
parent ae4692a845
commit a07e947644
5 changed files with 28 additions and 16 deletions

View File

@ -211,3 +211,14 @@ export const WebhookJWTAlgorithmList = [
'ps512',
'none',
] 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?`,
};

View File

@ -1,7 +1,7 @@
import { FileUploadProps } from '@/components/file-upload';
import { useHandleFilterSubmit } from '@/components/list-filter-bar/use-handle-filter-submit';
import message from '@/components/ui/message';
import { AgentGlobals } from '@/constants/agent';
import { AgentGlobals, initialBeginValues } from '@/constants/agent';
import {
IAgentLogsRequest,
IAgentLogsResponse,
@ -76,6 +76,7 @@ export const EmptyDsl = {
data: {
label: 'Begin',
name: 'begin',
form: initialBeginValues,
},
sourcePosition: 'left',
targetPosition: 'right',

View File

@ -13,6 +13,7 @@ import {
} from '../../constant';
import { BeginFormSchemaType } from '../../form/begin-form/schema';
import { useBuildWebhookUrl } from '../../hooks/use-build-webhook-url';
import { useIsPipeline } from '../../hooks/use-is-pipeline';
import OperatorIcon from '../../operator-icon';
import { LabelCard } from './card';
import { CommonHandle } from './handle';
@ -34,6 +35,8 @@ function InnerBeginNode({
const url = useBuildWebhookUrl();
const isPipeline = useIsPipeline();
return (
<NodeWrapper selected={selected} id={id}>
<CommonHandle
@ -45,15 +48,17 @@ function InnerBeginNode({
id={NodeHandleId.Start}
></CommonHandle>
<section className="flex items-center gap-2">
<section className="flex items-center gap-2">
<OperatorIcon name={data.label as Operator}></OperatorIcon>
<div className="truncate text-center font-semibold text-sm">
{t(`flow.begin`)}
</div>
</section>
<div className="text-accent-primary mt-2 p-1 bg-bg-accent w-fit rounded-sm text-xs">
{t(`flow.${isWebhookMode ? 'webhook.name' : mode}`)}
</div>
{isPipeline || (
<div className="text-accent-primary mt-2 p-1 bg-bg-accent w-fit rounded-sm text-xs">
{t(`flow.${isWebhookMode ? 'webhook.name' : mode}`)}
</div>
)}
{isWebhookMode ? (
<LabelCard className="mt-2 flex gap-1 items-center">
<span className="font-bold">URL</span>

View File

@ -15,19 +15,15 @@ import {
initialLlmBaseValues,
} from '@/constants/agent';
export {
AgentDialogueMode,
AgentStructuredOutputField,
JsonSchemaDataType,
Operator,
initialBeginValues,
} from '@/constants/agent';
export * from './pipeline';
export enum AgentDialogueMode {
Conversational = 'conversational',
Task = 'task',
Webhook = 'Webhook',
}
import { ModelVariableType } from '@/constants/knowledge';
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 = {
...initialLlmBaseValues,
language: '',
@ -750,6 +741,8 @@ export const NodeMap = {
[Operator.Loop]: 'loopNode',
[Operator.LoopStart]: 'loopStartNode',
[Operator.ExitLoop]: 'exitLoopNode',
[Operator.ExcelProcessor]: 'ragNode',
[Operator.PDFGenerator]: 'ragNode',
};
export enum BeginQueryType {

View File

@ -179,6 +179,8 @@ export const useInitializeOperatorParams = () => {
[Operator.Loop]: initialLoopValues,
[Operator.LoopStart]: {},
[Operator.ExitLoop]: {},
[Operator.PDFGenerator]: {},
[Operator.ExcelProcessor]: {},
};
}, [llmId]);