chore: locales
This commit is contained in:
@@ -28,7 +28,7 @@ const useModelsColumns = (): Array<{
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'User',
|
||||
title: intl.formatMessage({ id: 'usage.tabs.users' }),
|
||||
dataIndex: ['api_key', 'identity', 'value', 'user_name'],
|
||||
key: 'user_name',
|
||||
render: (text: string, record: ListItem) => (
|
||||
@@ -38,7 +38,7 @@ const useModelsColumns = (): Array<{
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Models Used',
|
||||
title: intl.formatMessage({ id: 'usage.filter.modelsUsed' }),
|
||||
dataIndex: 'models_called',
|
||||
key: 'models_called',
|
||||
sorter: tableSorter(2),
|
||||
@@ -47,7 +47,7 @@ const useModelsColumns = (): Array<{
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Input Tokens',
|
||||
title: intl.formatMessage({ id: 'usage.filter.inputTokens' }),
|
||||
dataIndex: 'input_tokens',
|
||||
key: 'input_tokens',
|
||||
render: (text: string[], record: ListItem) => (
|
||||
@@ -55,7 +55,7 @@ const useModelsColumns = (): Array<{
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Output Tokens',
|
||||
title: intl.formatMessage({ id: 'usage.filter.outputTokens' }),
|
||||
dataIndex: 'output_tokens',
|
||||
key: 'output_tokens',
|
||||
render: (text: string[], record: ListItem) => (
|
||||
@@ -63,7 +63,7 @@ const useModelsColumns = (): Array<{
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Total Tokens',
|
||||
title: intl.formatMessage({ id: 'usage.filter.totalTokens' }),
|
||||
dataIndex: 'total_tokens',
|
||||
key: 'total_tokens',
|
||||
sorter: tableSorter(3),
|
||||
@@ -73,7 +73,7 @@ const useModelsColumns = (): Array<{
|
||||
render: (text: number) => <AutoTooltip ghost>{text}</AutoTooltip>
|
||||
},
|
||||
{
|
||||
title: 'API Requests',
|
||||
title: intl.formatMessage({ id: 'usage.filter.apiRequests' }),
|
||||
dataIndex: 'api_requests',
|
||||
key: 'api_requests',
|
||||
sorter: tableSorter(3),
|
||||
@@ -83,7 +83,7 @@ const useModelsColumns = (): Array<{
|
||||
render: (text: number) => <AutoTooltip ghost>{text}</AutoTooltip>
|
||||
},
|
||||
{
|
||||
title: 'Last Active',
|
||||
title: intl.formatMessage({ id: 'usage.table.lastActive' }),
|
||||
dataIndex: 'last_active',
|
||||
key: 'last_active',
|
||||
sorter: tableSorter(3),
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
} from '@/atoms/usage';
|
||||
import { exportJsonToExcel } from '@/utils/excel-reader';
|
||||
import { useStore } from 'jotai';
|
||||
import _ from 'lodash';
|
||||
import useAPIKeysColumns from './use-apikeys-columns';
|
||||
import useModelsColumns from './use-models-columns';
|
||||
import useUsersColumns from './use-users-columns';
|
||||
@@ -26,11 +27,11 @@ const useExportTable = () => {
|
||||
jsonData: modelsTableData.dataList || [],
|
||||
sheetName: 'models',
|
||||
fields: modelsColumns
|
||||
.map((col: any) => col.dataIndex)
|
||||
.map((col: any) => _.join(col.dataIndex, '_'))
|
||||
.filter(Boolean) as string[],
|
||||
fieldLabels: modelsColumns.reduce(
|
||||
(map, col) => {
|
||||
map[col.dataIndex] = col.title;
|
||||
map[_.join(col.dataIndex, '_')] = col.title;
|
||||
return map;
|
||||
},
|
||||
{} as Record<string, any>
|
||||
@@ -45,7 +46,7 @@ const useExportTable = () => {
|
||||
.filter(Boolean) as string[],
|
||||
fieldLabels: apiKeysColumns.reduce(
|
||||
(map, col) => {
|
||||
map[col.dataIndex] = col.title;
|
||||
map[_.join(col.dataIndex, '_')] = col.title;
|
||||
return map;
|
||||
},
|
||||
{} as Record<string, any>
|
||||
@@ -60,7 +61,7 @@ const useExportTable = () => {
|
||||
.filter(Boolean) as string[],
|
||||
fieldLabels: usersColumns.reduce(
|
||||
(map, col) => {
|
||||
map[col.dataIndex] = col.title;
|
||||
map[_.join(col.dataIndex, '_')] = col.title;
|
||||
return map;
|
||||
},
|
||||
{} as Record<string, any>
|
||||
|
||||
@@ -33,7 +33,7 @@ const useModelsColumns = (): Array<{
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Cluster',
|
||||
title: intl.formatMessage({ id: 'usage.table.cluster' }),
|
||||
dataIndex: ['model', 'identity', 'value', 'cluster_name'],
|
||||
key: 'cluster_name',
|
||||
sorter: tableSorter(2),
|
||||
@@ -42,7 +42,7 @@ const useModelsColumns = (): Array<{
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Provider',
|
||||
title: intl.formatMessage({ id: 'usage.table.provider' }),
|
||||
dataIndex: 'provider_name',
|
||||
key: 'provider_name',
|
||||
render: (text: string, record: ListItem) => (
|
||||
@@ -57,7 +57,7 @@ const useModelsColumns = (): Array<{
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Input Tokens',
|
||||
title: intl.formatMessage({ id: 'usage.filter.inputTokens' }),
|
||||
dataIndex: 'input_tokens',
|
||||
key: 'input_tokens',
|
||||
render: (text: string[], record: ListItem) => (
|
||||
@@ -65,7 +65,7 @@ const useModelsColumns = (): Array<{
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Output Tokens',
|
||||
title: intl.formatMessage({ id: 'usage.filter.outputTokens' }),
|
||||
dataIndex: 'output_tokens',
|
||||
key: 'output_tokens',
|
||||
render: (text: string[], record: ListItem) => (
|
||||
@@ -73,7 +73,7 @@ const useModelsColumns = (): Array<{
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Total Tokens',
|
||||
title: intl.formatMessage({ id: 'usage.filter.totalTokens' }),
|
||||
dataIndex: 'total_tokens',
|
||||
key: 'total_tokens',
|
||||
sorter: tableSorter(3),
|
||||
@@ -83,7 +83,7 @@ const useModelsColumns = (): Array<{
|
||||
render: (text: number) => <AutoTooltip ghost>{text}</AutoTooltip>
|
||||
},
|
||||
{
|
||||
title: 'API Requests',
|
||||
title: intl.formatMessage({ id: 'usage.filter.apiRequests' }),
|
||||
dataIndex: 'api_requests',
|
||||
key: 'api_requests',
|
||||
sorter: tableSorter(3),
|
||||
@@ -93,7 +93,7 @@ const useModelsColumns = (): Array<{
|
||||
render: (text: number) => <AutoTooltip ghost>{text}</AutoTooltip>
|
||||
},
|
||||
{
|
||||
title: 'Last Active',
|
||||
title: intl.formatMessage({ id: 'usage.table.lastActive' }),
|
||||
dataIndex: 'last_active',
|
||||
key: 'last_active',
|
||||
sorter: tableSorter(3),
|
||||
|
||||
@@ -184,6 +184,14 @@ export const useUsageFilters = ({
|
||||
}
|
||||
};
|
||||
|
||||
const handleActiveModelsChange = (value: ValueType[][]) => {
|
||||
setActiveModels(value);
|
||||
};
|
||||
|
||||
const handleActiveApiKeysChange = (value: ValueType[][]) => {
|
||||
setActiveApiKeys(value);
|
||||
};
|
||||
|
||||
const handleFilterChange = (
|
||||
type: 'models' | 'users' | 'api_keys',
|
||||
value: string[]
|
||||
@@ -248,6 +256,8 @@ export const useUsageFilters = ({
|
||||
activeApiKeys,
|
||||
activeModels,
|
||||
handleSearch,
|
||||
handleActiveModelsChange,
|
||||
handleActiveApiKeysChange,
|
||||
onScopeChange: handleScopeChange,
|
||||
onDateChange: handleDateChange,
|
||||
onModelsChange: (value: string[]) => handleFilterChange('models', value),
|
||||
|
||||
@@ -32,7 +32,7 @@ const useModelsColumns = (): Array<{
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Models Used',
|
||||
title: intl.formatMessage({ id: 'usage.filter.modelsUsed' }),
|
||||
dataIndex: 'models_called',
|
||||
key: 'models_called',
|
||||
render: (text: string, record: ListItem) => (
|
||||
@@ -42,7 +42,7 @@ const useModelsColumns = (): Array<{
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'API Keys Used',
|
||||
title: intl.formatMessage({ id: 'usage.table.user.apiKeysUsed' }),
|
||||
dataIndex: 'api_keys_used',
|
||||
key: 'api_keys_used',
|
||||
sorter: tableSorter(2),
|
||||
@@ -51,7 +51,7 @@ const useModelsColumns = (): Array<{
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Input Tokens',
|
||||
title: intl.formatMessage({ id: 'usage.filter.inputTokens' }),
|
||||
dataIndex: 'input_tokens',
|
||||
key: 'input_tokens',
|
||||
render: (text: string[], record: ListItem) => (
|
||||
@@ -59,7 +59,7 @@ const useModelsColumns = (): Array<{
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Output Tokens',
|
||||
title: intl.formatMessage({ id: 'usage.filter.outputTokens' }),
|
||||
dataIndex: 'output_tokens',
|
||||
key: 'output_tokens',
|
||||
render: (text: string[], record: ListItem) => (
|
||||
@@ -67,7 +67,7 @@ const useModelsColumns = (): Array<{
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Total Tokens',
|
||||
title: intl.formatMessage({ id: 'usage.filter.totalTokens' }),
|
||||
dataIndex: 'total_tokens',
|
||||
key: 'total_tokens',
|
||||
sorter: tableSorter(3),
|
||||
@@ -77,7 +77,7 @@ const useModelsColumns = (): Array<{
|
||||
render: (text: number) => <AutoTooltip ghost>{text}</AutoTooltip>
|
||||
},
|
||||
{
|
||||
title: 'API Requests',
|
||||
title: intl.formatMessage({ id: 'usage.filter.apiRequests' }),
|
||||
dataIndex: 'api_requests',
|
||||
key: 'api_requests',
|
||||
sorter: tableSorter(3),
|
||||
@@ -87,7 +87,7 @@ const useModelsColumns = (): Array<{
|
||||
render: (text: number) => <AutoTooltip ghost>{text}</AutoTooltip>
|
||||
},
|
||||
{
|
||||
title: 'Last Active',
|
||||
title: intl.formatMessage({ id: 'usage.table.lastActive' }),
|
||||
dataIndex: 'last_active',
|
||||
key: 'last_active',
|
||||
sorter: tableSorter(3),
|
||||
|
||||
Reference in New Issue
Block a user