Feat: Add return value widget to CodeForm #3221 (#7776)

### What problem does this PR solve?
Feat: Add return value widget  to CodeForm #3221

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-05-21 19:35:27 +08:00
committed by GitHub
parent 558b252c5a
commit ac2643700b
3 changed files with 135 additions and 61 deletions

View File

@ -1,3 +1,4 @@
import { CodeTemplateStrMap, ProgrammingLanguage } from '@/constants/agent';
import { useTranslation } from 'react-i18next';
import { z } from 'zod';
import { Operator } from '../constant';
@ -133,13 +134,17 @@ export function useFormConfigMap() {
},
[Operator.Code]: {
component: CodeForm,
defaultValues: { arguments: [] },
defaultValues: {
lang: ProgrammingLanguage.Python,
script: CodeTemplateStrMap[ProgrammingLanguage.Python],
arguments: [],
},
schema: z.object({
lang: z.string(),
script: z.string(),
arguments: z.array(
z.object({ name: z.string(), component_id: z.string() }),
),
lang: z.string(),
}),
},
[Operator.Baidu]: {