Skip to content

Commit 0b34d53

Browse files
committed
feat: add stream response setting
1 parent d99808f commit 0b34d53

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

tools/server/webui/src/components/SettingDialog.tsx

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ const SETTING_SECTIONS: SettingSection[] = [
103103
key,
104104
}) as SettingFieldInput
105105
),
106+
{
107+
type: SettingInputType.CHECKBOX,
108+
label: 'Enable response streaming',
109+
key: 'streamResponse',
110+
},
106111
],
107112
},
108113
{
@@ -171,11 +176,19 @@ const SETTING_SECTIONS: SettingSection[] = [
171176
),
172177
fields: [
173178
{
174-
type: SettingInputType.CHECKBOX,
175-
label: 'Enable response streaming',
176-
key: 'streamResponse',
179+
type: SettingInputType.CUSTOM,
180+
key: 'custom',
181+
component: () => (
182+
<div className="mt-1 mb-3 p-2 bg-base-200 rounded-md text-sm">
183+
<p className="font-semibold">Important Note:</p>
184+
<p className="opacity-90">
185+
Response streaming must be <strong>disabled</strong> to use tool
186+
calling. Individual tools (listed below) will be automatically
187+
disabled if streaming is enabled.
188+
</p>
189+
</div>
190+
),
177191
},
178-
// Fields will be dynamically generated based on AVAILABLE_TOOLS
179192
...Array.from(AVAILABLE_TOOLS.values()).map(
180193
(tool: AgentTool) =>
181194
({
@@ -432,13 +445,19 @@ export default function SettingDialog({
432445
/>
433446
);
434447
} else if (field.type === SettingInputType.CHECKBOX) {
448+
const isToolToggle =
449+
typeof field.key === 'string' &&
450+
field.key.startsWith('tool_') &&
451+
field.key.endsWith('_enabled');
452+
const isDisabled = isToolToggle && localConfig.streamResponse;
435453
return (
436454
<SettingsModalCheckbox
437455
key={key}
438456
configKey={field.key}
439457
value={!!localConfig[field.key]}
440458
onChange={onChange(field.key)}
441459
label={field.label as string}
460+
disabled={isDisabled}
442461
/>
443462
);
444463
} else if (field.type === SettingInputType.CUSTOM) {
@@ -553,11 +572,13 @@ function SettingsModalCheckbox({
553572
value,
554573
onChange,
555574
label,
575+
disabled,
556576
}: {
557577
configKey: SettKey;
558578
value: boolean;
559579
onChange: (value: boolean) => void;
560-
label: string;
580+
label: React.ReactElement | string;
581+
disabled?: boolean;
561582
}) {
562583
return (
563584
<div className="flex flex-row items-center mb-2">
@@ -566,6 +587,7 @@ function SettingsModalCheckbox({
566587
className="toggle"
567588
checked={value}
568589
onChange={(e) => onChange(e.target.checked)}
590+
disabled={disabled}
569591
/>
570592
<span className="ml-4">{label || configKey}</span>
571593
</div>

0 commit comments

Comments
 (0)