Feat: Add a form for variable aggregation operators #10427 (#11095)

### What problem does this PR solve?

Feat: Add a form for variable aggregation operators #10427

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-11-07 11:44:22 +08:00
committed by GitHub
parent 34283d4db4
commit a880beb1f6
11 changed files with 289 additions and 22 deletions

View File

@ -53,10 +53,13 @@ export function StructuredOutputSecondaryMenu({
const renderAgentStructuredOutput = useCallback(
(values: any, option: { label: ReactNode; value: string }) => {
if (isPlainObject(values) && 'properties' in values) {
const properties =
get(values, 'properties') || get(values, 'items.properties');
if (isPlainObject(values) && properties) {
return (
<ul className="border-l">
{Object.entries(values.properties).map(([key, value]) => {
{Object.entries(properties).map(([key, value]) => {
const nextOption = {
label: option.label + `.${key}`,
value: option.value + `.${key}`,
@ -79,8 +82,9 @@ export function StructuredOutputSecondaryMenu({
{key}
<span className="text-text-secondary">{dataType}</span>
</div>
{dataType === JsonSchemaDataType.Object &&
renderAgentStructuredOutput(value, nextOption)}
{[JsonSchemaDataType.Object, JsonSchemaDataType.Array].some(
(x) => x === dataType,
) && renderAgentStructuredOutput(value, nextOption)}
</li>
);
}