forked from phoenix/litellm-mirror
ui - get/set model retry policy
This commit is contained in:
parent
116e555a03
commit
4fdf1147d3
1 changed files with 27 additions and 3 deletions
|
@ -18,7 +18,7 @@ import {
|
||||||
} from "@tremor/react";
|
} from "@tremor/react";
|
||||||
import { TabPanel, TabPanels, TabGroup, TabList, Tab, TextInput, Icon, DateRangePicker } from "@tremor/react";
|
import { TabPanel, TabPanels, TabGroup, TabList, Tab, TextInput, Icon, DateRangePicker } from "@tremor/react";
|
||||||
import { Select, SelectItem, MultiSelect, MultiSelectItem, DateRangePickerValue } from "@tremor/react";
|
import { Select, SelectItem, MultiSelect, MultiSelectItem, DateRangePickerValue } from "@tremor/react";
|
||||||
import { modelInfoCall, userGetRequesedtModelsCall, modelCreateCall, Model, modelCostMap, modelDeleteCall, healthCheckCall, modelUpdateCall, modelMetricsCall, modelExceptionsCall, modelMetricsSlowResponsesCall, getCallbacksCall } from "./networking";
|
import { modelInfoCall, userGetRequesedtModelsCall, modelCreateCall, Model, modelCostMap, modelDeleteCall, healthCheckCall, modelUpdateCall, modelMetricsCall, modelExceptionsCall, modelMetricsSlowResponsesCall, getCallbacksCall, setCallbacksCall } from "./networking";
|
||||||
import { BarChart, AreaChart } from "@tremor/react";
|
import { BarChart, AreaChart } from "@tremor/react";
|
||||||
import {
|
import {
|
||||||
Button as Button2,
|
Button as Button2,
|
||||||
|
@ -443,6 +443,29 @@ const handleEditSubmit = async (formValues: Record<string, any>) => {
|
||||||
setLastRefreshed(currentDate.toLocaleString());
|
setLastRefreshed(currentDate.toLocaleString());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleSaveRetrySettings = async () => {
|
||||||
|
if (!accessToken) {
|
||||||
|
console.error("Access token is missing");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("new modelGroupRetryPolicy:", modelGroupRetryPolicy);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const payload = {
|
||||||
|
router_settings: {
|
||||||
|
model_group_retry_policy: modelGroupRetryPolicy
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
await setCallbacksCall(accessToken, payload);
|
||||||
|
message.success("Retry settings saved successfully");
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Failed to save retry settings:", error);
|
||||||
|
message.error("Failed to save retry settings");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!accessToken || !token || !userRole || !userID) {
|
if (!accessToken || !token || !userRole || !userID) {
|
||||||
|
@ -1277,7 +1300,8 @@ const handleEditSubmit = async (formValues: Record<string, any>) => {
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
{Object.entries(retry_policy_map).map(([exceptionType, retryPolicyKey], idx) => {
|
{Object.entries(retry_policy_map).map(([exceptionType, retryPolicyKey], idx) => {
|
||||||
let retryCount = (modelGroupRetryPolicy[selectedModelGroup] ?? {})[retryPolicyKey];
|
|
||||||
|
let retryCount = modelGroupRetryPolicy?.[selectedModelGroup]?.[retryPolicyKey]
|
||||||
if (retryCount == null) {
|
if (retryCount == null) {
|
||||||
retryCount = defaultRetry;
|
retryCount = defaultRetry;
|
||||||
}
|
}
|
||||||
|
@ -1310,7 +1334,7 @@ const handleEditSubmit = async (formValues: Record<string, any>) => {
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
}
|
}
|
||||||
<Button className="mt-6 mr-8">
|
<Button className="mt-6 mr-8" onClick={handleSaveRetrySettings}>
|
||||||
Save
|
Save
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue