forked from phoenix/litellm-mirror
Merge pull request #4575 from BerriAI/ui_fix_errors_when_no_model_list_defined
UI - don't spam error messages when model list is not defined
This commit is contained in:
commit
e34ba00a51
2 changed files with 18 additions and 4 deletions
|
@ -701,6 +701,9 @@ export const claimOnboardingToken = async (
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
let ModelListerrorShown = false;
|
||||||
|
let errorTimer: NodeJS.Timeout | null = null;
|
||||||
|
|
||||||
export const modelInfoCall = async (
|
export const modelInfoCall = async (
|
||||||
accessToken: String,
|
accessToken: String,
|
||||||
userID: String,
|
userID: String,
|
||||||
|
@ -722,8 +725,21 @@ export const modelInfoCall = async (
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
const errorData = await response.text();
|
let errorData = await response.text();
|
||||||
message.error(errorData, 10);
|
errorData += `error shown=${ModelListerrorShown}`
|
||||||
|
if (!ModelListerrorShown) {
|
||||||
|
if (errorData.includes("No model list passed")) {
|
||||||
|
errorData = "No Models Exist. Click Add Model to get started.";
|
||||||
|
}
|
||||||
|
message.info(errorData, 10);
|
||||||
|
ModelListerrorShown = true;
|
||||||
|
|
||||||
|
if (errorTimer) clearTimeout(errorTimer);
|
||||||
|
errorTimer = setTimeout(() => {
|
||||||
|
ModelListerrorShown = false;
|
||||||
|
}, 10000);
|
||||||
|
}
|
||||||
|
|
||||||
throw new Error("Network response was not ok");
|
throw new Error("Network response was not ok");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -758,7 +774,6 @@ export const modelHubCall = async (accessToken: String) => {
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
const errorData = await response.text();
|
const errorData = await response.text();
|
||||||
message.error(errorData, 10);
|
|
||||||
throw new Error("Network response was not ok");
|
throw new Error("Network response was not ok");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ import {
|
||||||
allTagNamesCall,
|
allTagNamesCall,
|
||||||
modelMetricsCall,
|
modelMetricsCall,
|
||||||
modelAvailableCall,
|
modelAvailableCall,
|
||||||
modelInfoCall,
|
|
||||||
adminspendByProvider,
|
adminspendByProvider,
|
||||||
adminGlobalActivity,
|
adminGlobalActivity,
|
||||||
adminGlobalActivityPerModel,
|
adminGlobalActivityPerModel,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue