RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Feat: Remove the code that outputs jsonschema from the webhook.#10427 (#12297)
balibabu4ec6a4e49359
diff --git a/web/src/pages/agent/form/variable-assigner-form/index.tsx b/web/src/pages/agent/form/variable-assigner-form/index.tsxindex 6d717ebc7b..931351e7e3 100644--- a/web/src/pages/agent/form/variable-assigner-form/index.tsx+++ b/web/src/pages/agent/form/variable-assigner-form/index.tsx@@ -24,8 +24,6 @@ export const FormSchema = z.object(VariableAssignerSchema);export type VariableAssignerFormSchemaType = z.infer<typeof FormSchema>;-// const outputList = buildOutputList(initialVariableAssignerValues.outputs);-function VariableAssignerForm({ node }: INextOperatorForm) {const defaultValues = useFormValues(initialDataOperationsValues, node);@@ -41,10 +39,7 @@ function VariableAssignerForm({ node }: INextOperatorForm) {<Form {...form}><FormWrapper><DynamicVariables name="variables" label="Variables"></DynamicVariables>- {/* <Output list={outputList} isFormRequired></Output> */}</FormWrapper>- {/* <DevTool control={form.control} placement="top-left" /> */}- {/* set up the dev tool */}</Form>);}diff --git a/web/src/pages/agent/hooks/use-build-structured-output.ts b/web/src/pages/agent/hooks/use-build-structured-output.tsindex efc309d304..c9d34bd43d 100644--- a/web/src/pages/agent/hooks/use-build-structured-output.ts+++ b/web/src/pages/agent/hooks/use-build-structured-output.ts@@ -2,9 +2,7 @@ import { getStructuredDatatype } from '@/utils/canvas-util';import { get, isPlainObject } from 'lodash';import { ReactNode, useCallback } from 'react';import {- AgentDialogueMode,AgentStructuredOutputField,- BeginId,JsonSchemaDataType,Operator,} from '../constant';@@ -18,94 +16,36 @@ function getNodeId(value: string) {}export function useShowSecondaryMenu() {- const { getOperatorTypeFromId, getNode } = useGraphStore((state) => state);+ const { getOperatorTypeFromId } = useGraphStore((state) => state);const showSecondaryMenu = useCallback((value: string, outputLabel: string) => {const nodeId = getNodeId(value);- const operatorType = getOperatorTypeFromId(nodeId);-- // For Agent nodes, show secondary menu for 'structured' field- if (- operatorType === Operator.Agent &&+ return (+ getOperatorTypeFromId(nodeId) === Operator.Agent &&outputLabel === AgentStructuredOutputField- ) {- return true;- }-- // For Begin nodes in webhook mode, show secondary menu for schema properties (body, headers, query, etc.)- if (operatorType === Operator.Begin) {- const node = getNode(nodeId);- const mode = get(node, 'data.form.mode');- if (mode === AgentDialogueMode.Webhook) {- // Check if this output field is from the schema- const outputs = get(node, 'data.form.outputs', {});- const outputField = outputs[outputLabel];- // Show secondary menu if the field is an object or has properties- return (- outputField &&- (outputField.type === 'object' ||- (outputField.properties &&- Object.keys(outputField.properties).length > 0))- );- }- }-- return false;+ );},- [getOperatorTypeFromId, getNode],+ [getOperatorTypeFromId],);return showSecondaryMenu;}-function useGetBeginOutputsOrSchema() {- const { getNode } = useGraphStore((state) => state);-- const getBeginOutputs = useCallback(() => {- const node = getNode(BeginId);- const outputs = get(node, 'data.form.outputs', {});- return outputs;- }, [getNode]);-- const getBeginSchema = useCallback(() => {- const node = getNode(BeginId);- const outputs = get(node, 'data.form.schema', {});- return outputs;- }, [getNode]);-- return { getBeginOutputs, getBeginSchema };-}export function useGetStructuredOutputByValue() {- const { getNode, getOperatorTypeFromId } = useGraphStore((state) => state);-- const { getBeginOutputs } = useGetBeginOutputsOrSchema();+ const { getNode } = useGraphStore((state) => state);const getStructuredOutput = useCallback((value: string) => {- const nodeId = getNodeId(value);- const node = getNode(nodeId);- const operatorType = getOperatorTypeFromId(nodeId);- const fields = splitValue(value);- const outputLabel = fields.at(1);-- let structuredOutput;- if (operatorType === Operator.Agent) {- structuredOutput = get(- node,- `data.form.outputs.${AgentStructuredOutputField}`,- );- } else if (operatorType === Operator.Begin) {- // For Begin nodes in webhook mode, get the specific schema property- const outputs = getBeginOutputs();- if (outputLabel) {- structuredOutput = outputs[outputLabel];- }- }+ const node = getNode(getNodeId(value));+ const structuredOutput = get(+ node,+ `data.form.outputs.${AgentStructuredOutputField}`,+ );return structuredOutput;},- [getBeginOutputs, getNode, getOperatorTypeFromId],+ [getNode],);return getStructuredOutput;@@ -126,14 +66,13 @@ export function useFindAgentStructuredOutputLabel() {icon?: ReactNode;}>,) => {+ // agent structured outputconst fields = splitValue(value);- const operatorType = getOperatorTypeFromId(fields.at(0));-- // Handle Agent structured fieldsif (- operatorType === Operator.Agent &&+ getOperatorTypeFromId(fields.at(0)) === Operator.Agent &&fields.at(1)?.startsWith(AgentStructuredOutputField)) {+ // is agent structured outputconst agentOption = options.find((x) => value.includes(x.value));const jsonSchemaFields = fields.at(1)@@ -145,19 +84,6 @@ export function useFindAgentStructuredOutputLabel() {value: value,};}-- // Handle Begin webhook fields- if (operatorType === Operator.Begin && fields.at(1)) {- const fieldOption = options- .filter((x) => x.parentLabel === BeginId)- .find((x) => value.startsWith(x.value));-- return {- ...fieldOption,- label: fields.at(1),- value: value,- };- }},[getOperatorTypeFromId],);@@ -168,7 +94,6 @@ export function useFindAgentStructuredOutputLabel() {export function useFindAgentStructuredOutputTypeByValue() {const { getOperatorTypeFromId } = useGraphStore((state) => state);const filterStructuredOutput = useGetStructuredOutputByValue();- const { getBeginSchema } = useGetBeginOutputsOrSchema();const findTypeByValue = useCallback((@@ -211,12 +136,10 @@ export function useFindAgentStructuredOutputTypeByValue() {}const fields = splitValue(value);const nodeId = fields.at(0);- const operatorType = getOperatorTypeFromId(nodeId);const jsonSchema = filterStructuredOutput(value);- // Handle Agent structured fieldsif (- operatorType === Operator.Agent &&+ getOperatorTypeFromId(nodeId) === Operator.Agent &&fields.at(1)?.startsWith(AgentStructuredOutputField)) {const jsonSchemaFields = fields@@ -228,32 +151,13 @@ export function useFindAgentStructuredOutputTypeByValue() {return type;}}-- // Handle Begin webhook fields (body, headers, query, etc.)- if (operatorType === Operator.Begin) {- const outputLabel = fields.at(1);- const schema = getBeginSchema();- if (outputLabel && schema) {- const jsonSchemaFields = fields.at(1);- if (jsonSchemaFields) {- const type = findTypeByValue(schema, jsonSchemaFields);- return type;- }- }- }},- [- filterStructuredOutput,- findTypeByValue,- getBeginSchema,- getOperatorTypeFromId,- ],+ [filterStructuredOutput, findTypeByValue, getOperatorTypeFromId],);return findAgentStructuredOutputTypeByValue;}-// TODO: Consider merging with useFindAgentStructuredOutputLabelexport function useFindAgentStructuredOutputLabelByValue() {const { getNode } = useGraphStore((state) => state);diff --git a/web/src/pages/agent/hooks/use-get-begin-query.tsx b/web/src/pages/agent/hooks/use-get-begin-query.tsxindex 46825e5a49..5de22e0e97 100644--- a/web/src/pages/agent/hooks/use-get-begin-query.tsx+++ b/web/src/pages/agent/hooks/use-get-begin-query.tsx@@ -318,8 +318,7 @@ export function useFilterQueryVariableOptionsByTypes({isAgentStructured(y.value,y.value.slice(-AgentStructuredOutputField.length),- ) ||- y.value.startsWith(BeginId), // begin node outputs+ ),),};})