mirror of
https://github.com/mudler/LocalAI.git
synced 2026-05-23 16:20:01 -04:00
feat(ui): add usageApi.getMySources/getAdminSources + i18n strings
Refs: #9862 Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
@@ -53,7 +53,29 @@
|
||||
},
|
||||
"usage": {
|
||||
"title": "Usage",
|
||||
"subtitle": "API token usage statistics"
|
||||
"subtitle": "API token usage statistics",
|
||||
"sources": {
|
||||
"tab": "Sources",
|
||||
"mixTitle": "Source mix",
|
||||
"ribbonAria": "{{apikey}}% API keys, {{web}}% Web UI, {{legacy}}% Legacy",
|
||||
"topSources": "Top sources over time",
|
||||
"searchPlaceholder": "Search by name or prefix",
|
||||
"sortBy": "Sort",
|
||||
"sortTokens": "Tokens",
|
||||
"sortRequests": "Requests",
|
||||
"sortLastUsed": "Last used",
|
||||
"sortName": "Name",
|
||||
"webUI": "Web UI",
|
||||
"legacy": "Legacy",
|
||||
"revoked": "revoked",
|
||||
"filteredTo": "Filtered to: {{name}}",
|
||||
"clearFilter": "Clear filter",
|
||||
"other": "Other ({{count}})",
|
||||
"noTrafficShort": "No requests in this period.",
|
||||
"noKeysYet": "Once requests come in, you'll see them broken down here.",
|
||||
"createKey": "Create your first API key",
|
||||
"truncatedWarning": "Showing top 200 keys. Apply a filter to narrow further."
|
||||
}
|
||||
},
|
||||
"explorer": {
|
||||
"title": "Explorer",
|
||||
|
||||
8
core/http/react-ui/src/utils/api.js
vendored
8
core/http/react-ui/src/utils/api.js
vendored
@@ -422,6 +422,14 @@ export const usageApi = {
|
||||
if (userId) url += `&user_id=${encodeURIComponent(userId)}`
|
||||
return fetchJSON(url)
|
||||
},
|
||||
getMySources: (period) =>
|
||||
fetchJSON(`/api/auth/usage/sources?period=${period || 'month'}`),
|
||||
getAdminSources: (period, userId, apiKeyId) => {
|
||||
let url = `/api/auth/admin/usage/sources?period=${period || 'month'}`
|
||||
if (userId) url += `&user_id=${encodeURIComponent(userId)}`
|
||||
if (apiKeyId) url += `&api_key_id=${encodeURIComponent(apiKeyId)}`
|
||||
return fetchJSON(url)
|
||||
},
|
||||
getMyQuotas: () => fetchJSON('/api/auth/quota'),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user