mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-24 23:46:52 +08:00
### What problem does this PR solve? Feat: Add a switch to control the display of structured output to the agent form. #10427 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -6,7 +6,7 @@ import {
|
||||
import { BaseNode } from '@/interfaces/database/agent';
|
||||
|
||||
import { Edge } from '@xyflow/react';
|
||||
import { isEmpty } from 'lodash';
|
||||
import { get, isEmpty } from 'lodash';
|
||||
import { ComponentType, ReactNode } from 'react';
|
||||
|
||||
export function filterAllUpstreamNodeIds(edges: Edge[], nodeIds: string[]) {
|
||||
@ -87,3 +87,15 @@ export function buildNodeOutputOptions({
|
||||
),
|
||||
}));
|
||||
}
|
||||
|
||||
export function getStructuredDatatype(value: Record<string, any> | unknown) {
|
||||
const dataType = get(value, 'type');
|
||||
const arrayItemsType = get(value, 'items.type', JsonSchemaDataType.String);
|
||||
|
||||
const compositeDataType =
|
||||
dataType === JsonSchemaDataType.Array
|
||||
? `${dataType}<${arrayItemsType}>`
|
||||
: dataType;
|
||||
|
||||
return { dataType, compositeDataType };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user