mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-24 00:52:24 +00:00
fix(ui): rename reminder markers to Ignore Custom Tags (#42370)
This commit is contained in:
parent
9be3c1b168
commit
e841f32e50
5 changed files with 18 additions and 17 deletions
|
|
@ -141,7 +141,7 @@ const ComplexityRouterAdvancedSections: React.FC<ComplexityRouterAdvancedSection
|
|||
},
|
||||
{
|
||||
key: "reminder-markers",
|
||||
label: <strong className="text-foreground font-semibold">Advanced: Reminder Markers</strong>,
|
||||
label: <strong className="text-foreground font-semibold">Advanced: Ignore Custom Tags</strong>,
|
||||
children: <ReminderMarkers value={value} onChange={onChange} showValidationErrors={showValidationErrors} />,
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ describe("ComplexityRouterConfig", () => {
|
|||
|
||||
expect(screen.getByText("Advanced: Heuristic Keyword Overrides")).toBeInTheDocument();
|
||||
expect(screen.getByText("Advanced: Housekeeping Routing")).toBeInTheDocument();
|
||||
expect(screen.getByText("Advanced: Reminder Markers")).toBeInTheDocument();
|
||||
expect(screen.getByText("Advanced: Ignore Custom Tags")).toBeInTheDocument();
|
||||
|
||||
const capabilityValue = { ...defaultValue, classifier_type: "capability" as const };
|
||||
rerender(<ComplexityRouterConfig {...baseProps} value={capabilityValue} />);
|
||||
|
|
@ -128,7 +128,7 @@ describe("ComplexityRouterConfig", () => {
|
|||
renderWithProviders(
|
||||
<ComplexityRouterConfig {...baseProps} value={value} showValidationErrors={showValidationErrors} />,
|
||||
);
|
||||
fireEvent.click(screen.getByText("Advanced: Reminder Markers"));
|
||||
fireEvent.click(screen.getByText("Advanced: Ignore Custom Tags"));
|
||||
const validation = screen.queryByText(/needs both/i);
|
||||
if (showValidationErrors) {
|
||||
expect(validation).toBeInTheDocument();
|
||||
|
|
|
|||
|
|
@ -26,31 +26,32 @@ const ReminderMarkers: React.FC<{
|
|||
return (
|
||||
<div>
|
||||
<p className="mb-4 text-sm text-muted-foreground">
|
||||
Delimiter pairs that wrap harness-injected reminder blocks, which are stripped before classification. Setting
|
||||
any pair replaces the built-in pairs, so list every pair your harness emits. Matching is case-insensitive and
|
||||
values are saved lowercased.
|
||||
Auto Router already ignores built-in reminder tags, such as <code><system-reminder></code>, when choosing
|
||||
a model. Leave this empty to keep the defaults. Add custom opening and closing tags to ignore the text between
|
||||
them when routing. Custom pairs replace the defaults, so include any built-in pairs you still need. The selected
|
||||
model still receives the full message. Matching is case-insensitive.
|
||||
</p>
|
||||
<div className="space-y-3">
|
||||
{markers.map((marker, index) => (
|
||||
<div className="flex items-end gap-2" key={index}>
|
||||
<div className="flex-1">
|
||||
<label className="mb-1 block text-sm font-medium" htmlFor={`reminder-marker-${index}-open`}>
|
||||
Opening delimiter
|
||||
Opening tag
|
||||
</label>
|
||||
<Input
|
||||
id={`reminder-marker-${index}-open`}
|
||||
placeholder="<system-reminder>"
|
||||
placeholder="<note>"
|
||||
value={marker.open}
|
||||
onChange={(event) => update(index, { open: event.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<label className="mb-1 block text-sm font-medium" htmlFor={`reminder-marker-${index}-close`}>
|
||||
Closing delimiter
|
||||
Closing tag
|
||||
</label>
|
||||
<Input
|
||||
id={`reminder-marker-${index}-close`}
|
||||
placeholder="</system-reminder>"
|
||||
placeholder="</note>"
|
||||
value={marker.close}
|
||||
onChange={(event) => update(index, { close: event.target.value })}
|
||||
/>
|
||||
|
|
@ -58,7 +59,7 @@ const ReminderMarkers: React.FC<{
|
|||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
aria-label={`Remove reminder marker pair ${index + 1}`}
|
||||
aria-label={`Remove tag pair ${index + 1}`}
|
||||
onClick={() => remove(index)}
|
||||
>
|
||||
<Trash2 />
|
||||
|
|
@ -72,7 +73,7 @@ const ReminderMarkers: React.FC<{
|
|||
onClick={() => onChange({ ...value, reminder_markers: [...markers, { open: "", close: "" }] })}
|
||||
>
|
||||
<Plus />
|
||||
Add marker pair
|
||||
Add tag pair
|
||||
</Button>
|
||||
{showValidationErrors && error && <p className="mt-2 text-xs text-destructive">{error}</p>}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -414,8 +414,8 @@ export const getReminderMarkersError = (pairs: ReminderMarkerPair[] | undefined)
|
|||
for (const [index, pair] of (pairs ?? []).entries()) {
|
||||
const open = pair.open.trim().toLowerCase();
|
||||
const close = pair.close.trim().toLowerCase();
|
||||
if (!open || !close) return `Reminder marker pair ${index + 1} needs both an opening and a closing delimiter`;
|
||||
if (open === close) return `Reminder marker pair ${index + 1} must use different opening and closing delimiters`;
|
||||
if (!open || !close) return `Tag pair ${index + 1} needs both an opening and a closing tag`;
|
||||
if (open === close) return `Tag pair ${index + 1} must use different opening and closing tags`;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -377,9 +377,9 @@ describe("EditAutoRouterModal advanced field round trips", () => {
|
|||
expect(screen.getByRole("switch", { name: "Route housekeeping calls to the cheapest tier" })).not.toBeChecked();
|
||||
expect(screen.getByRole("combobox", { name: "e.g., conversation title" })).toHaveValue("");
|
||||
|
||||
await user.click(screen.getByText("Advanced: Reminder Markers"));
|
||||
expect(screen.getByLabelText("Opening delimiter")).toHaveValue("<a>");
|
||||
expect(screen.getByLabelText("Closing delimiter")).toHaveValue("</a>");
|
||||
await user.click(screen.getByText("Advanced: Ignore Custom Tags"));
|
||||
expect(screen.getByLabelText("Opening tag")).toHaveValue("<a>");
|
||||
expect(screen.getByLabelText("Closing tag")).toHaveValue("</a>");
|
||||
|
||||
await user.click(screen.getByText("Advanced: Response Format"));
|
||||
const maxTokensSwitch = screen.getByRole("switch", { name: "Cap max_tokens at the tier model's output ceiling" });
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue