Skip to content

Commit

Permalink
Models graph hotfix (#1952)
Browse files Browse the repository at this point in the history
  • Loading branch information
maamalama authored May 16, 2024
1 parent f510ab1 commit 089bf48
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions web/components/templates/dashboard/useDashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,20 @@ export const useDashboardPage = ({
userFilters
);
const topModels =
models?.data
?.sort((a, b) => (a.total_requests > b.total_requests ? -1 : 1))
.slice(0, 5) ?? [];
models?.data?.sort((a, b) =>
a.total_requests > b.total_requests ? -1 : 1
) ?? [];

const { isLoading: isAllModelsLoading, models: allModels } = useModels(
timeFilter,
1000,
[]
);

const allModelsData = allModels?.data;
allModels?.data?.sort((a, b) =>
a.total_requests > b.total_requests ? -1 : 1
) ?? [];

// replace the model filter inside of the filterMap with the text suggestion model
const modelFilterIdx = filterMap.findIndex(
Expand All @@ -107,7 +118,7 @@ export const useDashboardPage = ({
filterMap[modelFilterIdx] = {
label: "Model",
operators: textWithSuggestions(
topModels
allModelsData
?.filter((model) => model.model)
.map((model) => ({
key: model.model,
Expand Down

0 comments on commit 089bf48

Please sign in to comment.