Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed issues #8126 and #8127 (#8275) #8299

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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