Skip to content

Commit

Permalink
fixed issues #8126 and #8127 (#8275)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaswanth8888 authored Feb 6, 2025
1 parent b76b380 commit 017a958
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { modelCreateCall, Model } from "../networking";
export const handleAddModelSubmit = async (
formValues: Record<string, any>,
accessToken: string,
form: any
form: any,
callback?: ()=>void
) => {
try {
console.log("handling submit for formValues:", formValues);
Expand Down Expand Up @@ -137,6 +138,7 @@ export const handleAddModelSubmit = async (
};

const response: any = await modelCreateCall(accessToken, new_model);
callback && callback()

console.log(`response for model create call: ${response["data"]}`);
});
Expand Down
3 changes: 3 additions & 0 deletions ui/litellm-dashboard/src/components/delete_model_button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ import { TrashIcon } from "@heroicons/react/outline";
interface DeleteModelProps {
modelID: string;
accessToken: string;
callback?: ()=>void;
}

const DeleteModelButton: React.FC<DeleteModelProps> = ({
modelID,
accessToken,
callback
}) => {
const [isModalVisible, setIsModalVisible] = useState(false);

Expand All @@ -30,6 +32,7 @@ const DeleteModelButton: React.FC<DeleteModelProps> = ({
console.log("model delete Response:", response);
message.success(`Model ${modelID} deleted successfully`);
setIsModalVisible(false);
callback && setTimeout(callback, 4000) //added timeout of 4 seconds as deleted model is taking time to reflect in get models
} catch (error) {
console.error("Error deleting the model:", error);
}
Expand Down
3 changes: 2 additions & 1 deletion ui/litellm-dashboard/src/components/model_dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ const ModelDashboard: React.FC<ModelDashboardProps> = ({
form
.validateFields()
.then((values) => {
handleAddModelSubmit(values, accessToken, form);
handleAddModelSubmit(values, accessToken, form, handleRefreshClick);
// form.resetFields();
})
.catch((error) => {
Expand Down Expand Up @@ -1450,6 +1450,7 @@ const ModelDashboard: React.FC<ModelDashboardProps> = ({
<DeleteModelButton
modelID={model.model_info.id}
accessToken={accessToken}
callback={handleRefreshClick}
/>
</Col>
</Grid>
Expand Down
3 changes: 1 addition & 2 deletions ui/litellm-dashboard/src/components/networking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const modelCreateCall = async (
const data = await response.json();
console.log("API Response:", data);
message.success(
"Model created successfully. Wait 60s and refresh on 'All Models' page"
"Model created successfully"
);
return data;
} catch (error) {
Expand Down Expand Up @@ -168,7 +168,6 @@ export const modelDeleteCall = async (

const data = await response.json();
console.log("API Response:", data);
message.success("Model deleted successfully. Restart server to see this.");
return data;
} catch (error) {
console.error("Failed to create key:", error);
Expand Down

0 comments on commit 017a958

Please sign in to comment.