Merge pull request #4574 from BerriAI/litellm_ui_fix_show_models_as_dd

[fix] UI fix show models as dropdown
This commit is contained in:
Ishaan Jaff 2024-07-06 14:37:39 -07:00 committed by GitHub
commit 022619a14d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 3 deletions

View file

@ -743,7 +743,7 @@ const ModelDashboard: React.FC<ModelDashboardProps> = ({
} }
const fetchModelMap = async () => { const fetchModelMap = async () => {
const data = await modelCostMap(); const data = await modelCostMap(accessToken);
console.log(`received model cost map data: ${Object.keys(data)}`); console.log(`received model cost map data: ${Object.keys(data)}`);
setModelMap(data); setModelMap(data);
}; };

View file

@ -12,11 +12,19 @@ export interface Model {
model_info: Object | null; model_info: Object | null;
} }
export const modelCostMap = async () => { export const modelCostMap = async (
accessToken: string,
) => {
try { try {
const url = proxyBaseUrl ? `${proxyBaseUrl}/get/litellm_model_cost_map` : `/get/litellm_model_cost_map`; const url = proxyBaseUrl ? `${proxyBaseUrl}/get/litellm_model_cost_map` : `/get/litellm_model_cost_map`;
const response = await fetch( const response = await fetch(
url url, {
method: "GET",
headers: {
Authorization: `Bearer ${accessToken}`,
"Content-Type": "application/json",
},
}
); );
const jsonData = await response.json(); const jsonData = await response.json();
console.log(`received litellm model cost data: ${jsonData}`); console.log(`received litellm model cost data: ${jsonData}`);