Skip to content
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
6 changes: 3 additions & 3 deletions GUI/src/components/MainNavigation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ const MainNavigation: FC = () => {
const items = [
{
id: 'userManagement',
label: 'User Management',
label: t('menu.userManagement'),
path: '/user-management',
icon: <MdSupervisorAccount />,
},
{
id: 'llmConnections',
label: 'LLM Connections',
label: t('menu.llmConnections'),
path: '/llm-connections',
icon: <MdOutlineDataset />,
},
{
id: 'testLLM',
label: 'Test LLM',
label: t('menu.testLLM'),
path: '/test-llm',
icon: <MdSearch />
},
Expand Down
20 changes: 13 additions & 7 deletions GUI/src/components/molecules/BudgetBanner/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React from 'react';
import { useQuery } from '@tanstack/react-query';
import { useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { checkBudgetStatus, BudgetStatus } from 'services/llmConnections';
import { llmConnectionsQueryKeys } from 'utils/queryKeys';
import './BudgetBanner.scss';
import Button from 'components/Button';
import { MdOutlineGppMaybe, MdWarning } from 'react-icons/md';

const BudgetBanner: React.FC = () => {
const { t } = useTranslation();
const navigate = useNavigate();
const { data: budgetStatus } = useQuery({
queryKey: llmConnectionsQueryKeys.budgetStatus(),
Expand All @@ -20,23 +22,27 @@ const BudgetBanner: React.FC = () => {

const getBannerContent = (status: BudgetStatus) => {
const { used_budget_percentage, exceeded_stop_budget, exceeded_warn_budget, data } = status;
const platformKey = data?.llmPlatform === "aws" ? "aws" : "azure";
const platformName = t(`budgetBanner.platforms.${platformKey}`);

if (exceeded_stop_budget) {
return {
type: 'error' as const,
message: `Production LLM connection disabled`,
description: `${data?.llmPlatform === "aws" ? "AWS Bedrock" : "Azure OpenAI"} integration has exceeded its budget. Update budget to reactivate LLM connection.`,
message: t('budgetBanner.productionDisabled'),
description: t('budgetBanner.budgetExceededDescription', { platform: platformName }),
icon: <MdOutlineGppMaybe size={30} />
};
}

if (exceeded_warn_budget) {
return {
type: 'warning' as const,
message: `${used_budget_percentage?.toFixed(1)}% of connection budget is used.`,
description: `${data?.llmPlatform === "aws" ? "AWS Bedrock" : "Azure OpenAI"} integration has used ${used_budget_percentage?.toFixed(1)}% of its budget. Review connection budget to avoid disconnections`,
message: t('budgetBanner.budgetUsageMessage', { percentage: used_budget_percentage?.toFixed(1) }),
description: t('budgetBanner.budgetUsageDescription', {
platform: platformName,
percentage: used_budget_percentage?.toFixed(1)
}),
icon: <MdWarning size={30} />

};
}

Expand Down Expand Up @@ -65,11 +71,11 @@ const BudgetBanner: React.FC = () => {
{budgetStatus.exceeded_warn_budget && !budgetStatus.exceeded_stop_budget ?
(
<Button size='s' onClick={() => navigate(`/view-llm-connection?id=${budgetStatus.data.id}`)}>
Review Budget
{t('budgetBanner.reviewBudgetButton')}
</Button>
) : (
<Button size='s' onClick={() => navigate(`/view-llm-connection?id=${budgetStatus.data.id}`)}>
Update Budget
{t('budgetBanner.updateBudgetButton')}
</Button>
)
}
Expand Down
16 changes: 8 additions & 8 deletions GUI/src/components/molecules/LLMConnectionCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ const LLMConnectionCard: FC<PropsWithChildren<LLMConnectionCardProps>> = ({
if (deploymentEnvironment === "testing") {
return (
<Label type="info">
testing
{t('dataModels.environments.testing')}
</Label>
);
} else if (deploymentEnvironment === "production") {
return (
<Label type="success">
production
{t('dataModels.environments.production')}
</Label>
);
}
Expand All @@ -101,19 +101,19 @@ const LLMConnectionCard: FC<PropsWithChildren<LLMConnectionCardProps>> = ({
if (status === "within_budget") {
return (
<Label type="success">
{'Within Budget'}
{t('dataModels.budgetStatus.withinBudget')}
</Label>
);
} else if (status === "over_budget") {
return (
<Label type="error">
{'Over Budget'}
{t('dataModels.budgetStatus.overBudget')}
</Label>
);
} else if (status === "close_to_exceed") {
return (
<Label type="warning">
{'Close to Exceed Budget'}
{t('dataModels.budgetStatus.closeToExceed')}
</Label>
);
}
Expand All @@ -135,13 +135,13 @@ const LLMConnectionCard: FC<PropsWithChildren<LLMConnectionCardProps>> = ({
<div className="flex" style={{ flexWrap: 'wrap', gap: '5px' }}>
<div className="label-row">
<span className="label-title">
{'Platform'}:
{t('dataModels.filters.platform')}:
</span>
<span className="label-value">{platform ?? 'N/A'}</span>
</div>
<div className="label-row">
<span className="label-title">
{'Model'}:
{t('dataModels.filters.model')}:
</span>
<span className="label-value">{model ?? 'N/A'}</span>
</div>
Expand All @@ -156,7 +156,7 @@ const LLMConnectionCard: FC<PropsWithChildren<LLMConnectionCardProps>> = ({
size="s"
onClick={() => navigate(`/view-llm-connection?id=${llmConnectionId}`)}
>
{t('datasets.datasetCard.settings') ?? ''}
{t('dataModels.settings') ?? ''}
</Button>
</div>
</div>
Expand Down
Loading
Loading