maestro/ui/src/components/settings/SafetyForm.tsx
2026-06-04 00:34:55 +00:00

72 lines
3.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { HelpText } from './HelpText';
import { FieldLabel, FieldInput } from './formUtils';
import type { SectionFormProps } from './types';
export function SafetyForm({ config, onChange }: SectionFormProps) {
const safety = config.safety ?? {};
const historySummarization = safety.historySummarization ?? {};
return (
<div className="space-y-5">
<h2 className="text-base font-semibold text-slate-800">Safety</h2>
<div>
<FieldLabel>Max Iterations</FieldLabel>
<FieldInput type="number" value={safety.maxIterations ?? 200}
onChange={v => onChange('safety.maxIterations', Number(v))} />
<HelpText>1 movement デフォルト: 200</HelpText>
</div>
<div>
<FieldLabel>Max Revisits</FieldLabel>
<FieldInput type="number" value={safety.maxRevisits ?? 3}
onChange={v => onChange('safety.maxRevisits', Number(v))} />
<HelpText> movement デフォルト: 3</HelpText>
</div>
<div>
<FieldLabel>Max Tool Loop Repeats</FieldLabel>
<FieldInput type="number" value={safety.maxToolLoopRepeats ?? 5}
onChange={v => onChange('safety.maxToolLoopRepeats', Number(v))} />
<HelpText> movement 2デフォルト: 51</HelpText>
</div>
<div>
<FieldLabel>Prompt Guard Ratio</FieldLabel>
<FieldInput type="number" value={safety.promptGuardRatio ?? 0.8}
onChange={v => onChange('safety.promptGuardRatio', v ? Number(v) : undefined)} />
<HelpText> prompt 0.50.95デフォルト: 0.8</HelpText>
</div>
<h3 className="text-sm font-medium text-slate-600 mt-4 pt-3 border-t border-slate-200">History Summarization</h3>
<div>
<label className="flex items-center gap-2 text-sm text-slate-700">
<input
type="checkbox"
checked={historySummarization.enabled !== false}
onChange={e => onChange('safety.historySummarization.enabled', e.target.checked)}
className="rounded"
/>
</label>
<HelpText> context デフォルト: 有効</HelpText>
</div>
<div>
<FieldLabel>Tail Turns</FieldLabel>
<FieldInput type="number" value={historySummarization.tailTurns ?? 2}
onChange={v => onChange('safety.historySummarization.tailTurns', Number(v))} />
<HelpText> assistant+tool デフォルト: 2</HelpText>
</div>
<div>
<FieldLabel>Preserve Recent Budget</FieldLabel>
<FieldInput type="number" value={historySummarization.preserveRecentBudget ?? 8000}
onChange={v => onChange('safety.historySummarization.preserveRecentBudget', Number(v))} />
<HelpText>デフォルト: 8000</HelpText>
</div>
</div>
);
}