Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion apps/beeai-sdk-py/examples/settings_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
from beeai_sdk.a2a.extensions.ui.settings import (
CheckboxField,
CheckboxGroupField,
OptionItem,
SettingsExtensionServer,
SettingsExtensionSpec,
SettingsRender,
SingleSelectField,
)
from beeai_sdk.a2a.types import RunYield
from beeai_sdk.server import Server
Expand All @@ -39,7 +41,17 @@ async def settings_agent(
default_value=True,
)
],
)
),
SingleSelectField(
id="response_style",
label="Response Style",
options=[
OptionItem(value="concise", label="Concise"),
OptionItem(value="detailed", label="Detailed"),
OptionItem(value="humorous", label="Humorous"),
],
default_value="concise",
),
],
),
),
Expand Down
48 changes: 48 additions & 0 deletions apps/beeai-ui/src/components/RadioSelect/RadioSelect.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Copyright 2025 © BeeAI a Series of LF Projects, LLC
* SPDX-License-Identifier: Apache-2.0
*/

import { Checkmark } from '@carbon/icons-react';
import { RadioButton, RadioButtonGroup } from '@carbon/react';
import clsx from 'clsx';
import { useId } from 'react';

import classes from './RadioSelect.module.scss';

interface Props {
name: string;
label: string;
value?: string;
options: { value: string; label: string }[];
onChange: (value: string) => void;
}

export function RadioSelect({ name, label, value, options, onChange }: Props) {
const htmlId = useId();

return (
<RadioButtonGroup
legendText={label}
name={name}
valueSelected={value}
orientation="vertical"
className={classes.root}
>
{options.map(({ value: optionValue, label }) => {
const isSelected = optionValue === value;
return (
<div className={clsx(classes.option, { [classes.selected]: isSelected })} key={optionValue}>
<RadioButton
id={`${htmlId}:${optionValue}`}
value={optionValue}
labelText={label}
onClick={() => onChange(optionValue)}
/>
{optionValue === value && <Checkmark size={16} />}
</div>
);
})}
</RadioButtonGroup>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Copyright 2025 © BeeAI a Series of LF Projects, LLC
* SPDX-License-Identifier: Apache-2.0
*/

.root {
display: grid;
grid-template-columns: 1fr max-content;
align-items: center;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can simplify the styles here removing the "align-items: center" with "block-size: rem(40px)" from .settings.

}

.settings {
display: flex;
gap: $spacing-03;
}

.buttons {
display: flex;
justify-content: flex-end;
text-align: end;
gap: $spacing-04;
}
48 changes: 48 additions & 0 deletions apps/beeai-ui/src/modules/form/components/FormActionBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Copyright 2025 © BeeAI a Series of LF Projects, LLC
* SPDX-License-Identifier: Apache-2.0
*/

import { Button } from '@carbon/react';
import { useMergeRefs } from '@floating-ui/react';

import { useApp } from '#contexts/App/index.ts';
import { RunModels } from '#modules/runs/settings/RunModels.tsx';
import { RunSettings } from '#modules/runs/settings/RunSettings.tsx';
import { useRunSettingsDialog } from '#modules/runs/settings/useRunSettingsDialog.ts';

import classes from './FormActionBar.module.scss';

interface Props {
showSubmitButton?: boolean;
submitLabel: string;
showRunSettings?: boolean;
}

export function FormActionBar({ showSubmitButton = true, submitLabel, showRunSettings }: Props) {
const {
config: { featureFlags },
} = useApp();

const modelsDialog = useRunSettingsDialog({ blockOffset: 8 });
const settingsDialog = useRunSettingsDialog({ blockOffset: 8 });
const formRefs = useMergeRefs([modelsDialog.refs.setPositionReference, settingsDialog.refs.setPositionReference]);

return (
<div className={classes.root} ref={formRefs}>
{showRunSettings && (
<div className={classes.settings}>
<RunSettings dialog={settingsDialog} iconOnly={false} />
{featureFlags.ModelProviders && <RunModels dialog={modelsDialog} iconOnly={false} />}
</div>
)}
{showSubmitButton && (
<div className={classes.buttons}>
<Button type="submit" size="md">
{submitLabel}
</Button>
</div>
)}
</div>
);
}
14 changes: 0 additions & 14 deletions apps/beeai-ui/src/modules/form/components/FormRenderer.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,3 @@
flex-direction: column;
row-gap: $spacing-06;
}

.fields {
display: grid;
column-gap: $spacing-04;
row-gap: $spacing-06;
grid-template-columns: repeat(var(--grid-columns, 1), minmax(0, 1fr));
}

.buttons {
display: flex;
justify-content: flex-end;
text-align: end;
gap: $spacing-04;
}
18 changes: 8 additions & 10 deletions apps/beeai-ui/src/modules/form/components/FormRenderer.tsx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CSS rules for .fields and .buttons inside apps/beeai-ui/src/modules/form/components/FormRenderer.module.scss can be deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { Button } from '@carbon/react';
import type { FormRender } from 'beeai-sdk';
import { FormProvider, useForm } from 'react-hook-form';

Expand All @@ -13,6 +12,7 @@ import { isNotNull } from '#utils/helpers.ts';

import type { RunFormValues } from '../types';
import { getDefaultValues } from '../utils';
import { FormActionBar } from './FormActionBar';
import { FormFields } from './FormFields';
import classes from './FormRenderer.module.scss';

Expand All @@ -21,13 +21,15 @@ interface Props {
defaultHeading?: string | null;
showHeading?: boolean;
isDisabled?: boolean;
showRunSettings?: boolean;
onSubmit: (values: RunFormValues) => void;
}

export function FormRenderer({
definition,
defaultHeading,
showHeading: showHeadingProp = true,
showRunSettings,
isDisabled,
onSubmit,
}: Props) {
Expand All @@ -52,15 +54,11 @@ export function FormRenderer({

<FormFields fields={fields} columns={columns} />

{!isDisabled && (
<>
<div className={classes.buttons}>
<Button type="submit" size="md">
{submit_label ?? 'Submit'}
</Button>
</div>
</>
)}
<FormActionBar
submitLabel={submit_label ?? 'Submit'}
showRunSettings={showRunSettings}
showSubmitButton={!isDisabled}
/>
</fieldset>
</form>
</FormProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function FormRenderView({ formRender }: Props) {
<Container size="sm" className={classes.root}>
<FormRenderer
definition={formRender}
showRunSettings
onSubmit={(values: RunFormValues) => {
const form = {
request: formRender,
Expand Down
7 changes: 6 additions & 1 deletion apps/beeai-ui/src/modules/runs/components/MCPConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ export function MCPConfig() {
const id = useId();
const { selectedMCPServers, selectMCPServer } = useAgentDemands();

const entries = Object.entries(selectedMCPServers);
if (!entries.length) {
return null;
}

return (
<div className={classes.root}>
{Object.entries(selectedMCPServers).map(([key, value]) => (
{entries.map(([key, value]) => (
<TextInput
value={value}
onChange={(e) => selectMCPServer(key, e.target.value)}
Expand Down
84 changes: 0 additions & 84 deletions apps/beeai-ui/src/modules/runs/components/ModelProviders.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
.actionBarStart {
display: flex;
align-items: center;
gap: $spacing-03;
column-gap: $spacing-01;
}

.submit {
Expand Down
Loading