diff --git a/frontend/src/main.jsx b/frontend/src/main.jsx index 54b1fa1..2017316 100644 --- a/frontend/src/main.jsx +++ b/frontend/src/main.jsx @@ -76,7 +76,7 @@ const EMPTY_KEY_FORM = { name: '', expires_at: '', daily_tokens: '', monthly_tokens: '', daily_requests: '', monthly_requests: '', }; -function SettingsSection({ password }) { +function SettingsSection({ password, refreshKey }) { const [settings, setSettings] = useState(null); const [availableModels, setAvailableModels] = useState([]); const [modelsLoading, setModelsLoading] = useState(false); @@ -85,6 +85,8 @@ function SettingsSection({ password }) { const [appVersion, setAppVersion] = useState(null); const [saved, setSaved] = useState(false); const [error, setError] = useState(null); + const [usageLog, setUsageLog] = useState([]); + const [errorLog, setErrorLog] = useState([]); const fetchModels = async (url, currentModel) => { setModelsLoading(true); @@ -112,14 +114,18 @@ function SettingsSection({ password }) { Promise.all([ axios.get('/api/settings', { headers }), axios.get('/api/proxy-info', { headers }), - ]).then(([settingsRes, proxyRes]) => { + axios.get('/api/logs/usage', { headers }), + axios.get('/api/logs/error', { headers }), + ]).then(([settingsRes, proxyRes, usageRes, errorRes]) => { const s = settingsRes.data; setSettings(s); setProxyEndpoint(proxyRes.data.endpoint); setAppVersion(proxyRes.data.version); + setUsageLog(usageRes.data.lines); + setErrorLog(errorRes.data.lines); fetchModels(s.ollama_url, s.force_model); }).catch(() => setError('Einstellungen konnten nicht geladen werden.')); - }, []); + }, [refreshKey]); const handleSave = async (e) => { e.preventDefault(); @@ -192,6 +198,18 @@ function SettingsSection({ password }) { {saved &&
+ {usageLog.length > 0 ? usageLog.join('\n') : '— keine Einträge —'}
+
+ {errorLog.length > 0 && (
+ <>
+ {errorLog.join('\n')}
+ >
+ )}
+