mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-02-08 05:40:51 +08:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b90239d39c | ||
|
|
f8d66917fd | ||
|
|
36bfd0fa6a | ||
|
|
709ce4c8dd | ||
|
|
525b152a76 | ||
|
|
e053854544 | ||
|
|
0b54b6de64 |
@@ -6,6 +6,7 @@ import { Modal } from '@/components/ui/Modal';
|
||||
import { ToggleSwitch } from '@/components/ui/ToggleSwitch';
|
||||
import { IconChevronDown } from '@/components/ui/icons';
|
||||
import { ConfigSection } from '@/components/config/ConfigSection';
|
||||
import { useNotificationStore } from '@/stores';
|
||||
import styles from './VisualConfigEditor.module.scss';
|
||||
import type {
|
||||
PayloadFilterRule,
|
||||
@@ -201,6 +202,7 @@ function ApiKeysCardEditor({
|
||||
onChange: (nextValue: string) => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const { showNotification } = useNotificationStore();
|
||||
const apiKeys = useMemo(
|
||||
() =>
|
||||
value
|
||||
@@ -263,6 +265,34 @@ function ApiKeysCardEditor({
|
||||
closeModal();
|
||||
};
|
||||
|
||||
const handleCopy = async (apiKey: string) => {
|
||||
const copyByExecCommand = () => {
|
||||
const textarea = document.createElement('textarea');
|
||||
textarea.value = apiKey;
|
||||
textarea.setAttribute('readonly', '');
|
||||
textarea.style.position = 'fixed';
|
||||
textarea.style.opacity = '0';
|
||||
textarea.style.pointerEvents = 'none';
|
||||
document.body.appendChild(textarea);
|
||||
textarea.select();
|
||||
textarea.setSelectionRange(0, textarea.value.length);
|
||||
const copied = document.execCommand('copy');
|
||||
document.body.removeChild(textarea);
|
||||
if (!copied) throw new Error('copy_failed');
|
||||
};
|
||||
|
||||
try {
|
||||
if (navigator.clipboard?.writeText) {
|
||||
await navigator.clipboard.writeText(apiKey);
|
||||
} else {
|
||||
copyByExecCommand();
|
||||
}
|
||||
showNotification(t('notification.link_copied'), 'success');
|
||||
} catch {
|
||||
showNotification(t('notification.copy_failed'), 'error');
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="form-group" style={{ marginBottom: 0 }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 12 }}>
|
||||
@@ -294,6 +324,9 @@ function ApiKeysCardEditor({
|
||||
<div className="item-subtitle">{maskApiKey(String(key || ''))}</div>
|
||||
</div>
|
||||
<div className="item-actions">
|
||||
<Button variant="secondary" size="sm" onClick={() => handleCopy(key)} disabled={disabled}>
|
||||
{t('common.copy')}
|
||||
</Button>
|
||||
<Button variant="secondary" size="sm" onClick={() => openEditModal(index)} disabled={disabled}>
|
||||
{t('config_management.visual.common.edit')}
|
||||
</Button>
|
||||
|
||||
@@ -10,8 +10,6 @@ import {
|
||||
import { NavLink, useLocation } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { Modal } from '@/components/ui/Modal';
|
||||
import { ToggleSwitch } from '@/components/ui/ToggleSwitch';
|
||||
import { PageTransition } from '@/components/common/PageTransition';
|
||||
import { MainRoutes } from '@/router/MainRoutes';
|
||||
import {
|
||||
@@ -33,7 +31,7 @@ import {
|
||||
useNotificationStore,
|
||||
useThemeStore,
|
||||
} from '@/stores';
|
||||
import { configApi, versionApi } from '@/services/api';
|
||||
import { versionApi } from '@/services/api';
|
||||
import { triggerHeaderRefresh } from '@/hooks/useHeaderRefresh';
|
||||
import { LANGUAGE_LABEL_KEYS, LANGUAGE_ORDER } from '@/utils/constants';
|
||||
import { isSupportedLanguage } from '@/utils/language';
|
||||
@@ -174,20 +172,18 @@ const compareVersions = (latest?: string | null, current?: string | null) => {
|
||||
};
|
||||
|
||||
export function MainLayout() {
|
||||
const { t, i18n } = useTranslation();
|
||||
const { t } = useTranslation();
|
||||
const { showNotification } = useNotificationStore();
|
||||
const location = useLocation();
|
||||
|
||||
const apiBase = useAuthStore((state) => state.apiBase);
|
||||
const serverVersion = useAuthStore((state) => state.serverVersion);
|
||||
const serverBuildDate = useAuthStore((state) => state.serverBuildDate);
|
||||
const connectionStatus = useAuthStore((state) => state.connectionStatus);
|
||||
const logout = useAuthStore((state) => state.logout);
|
||||
|
||||
const config = useConfigStore((state) => state.config);
|
||||
const fetchConfig = useConfigStore((state) => state.fetchConfig);
|
||||
const clearCache = useConfigStore((state) => state.clearCache);
|
||||
const updateConfigValue = useConfigStore((state) => state.updateConfigValue);
|
||||
|
||||
const theme = useThemeStore((state) => state.theme);
|
||||
const cycleTheme = useThemeStore((state) => state.cycleTheme);
|
||||
@@ -199,22 +195,13 @@ export function MainLayout() {
|
||||
const [checkingVersion, setCheckingVersion] = useState(false);
|
||||
const [languageMenuOpen, setLanguageMenuOpen] = useState(false);
|
||||
const [brandExpanded, setBrandExpanded] = useState(true);
|
||||
const [requestLogModalOpen, setRequestLogModalOpen] = useState(false);
|
||||
const [requestLogDraft, setRequestLogDraft] = useState(false);
|
||||
const [requestLogTouched, setRequestLogTouched] = useState(false);
|
||||
const [requestLogSaving, setRequestLogSaving] = useState(false);
|
||||
const contentRef = useRef<HTMLDivElement | null>(null);
|
||||
const languageMenuRef = useRef<HTMLDivElement | null>(null);
|
||||
const brandCollapseTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
const headerRef = useRef<HTMLElement | null>(null);
|
||||
const versionTapCount = useRef(0);
|
||||
const versionTapTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
|
||||
const fullBrandName = 'CLI Proxy API Management Center';
|
||||
const abbrBrandName = t('title.abbr');
|
||||
const requestLogEnabled = config?.requestLog ?? false;
|
||||
const requestLogDirty = requestLogDraft !== requestLogEnabled;
|
||||
const canEditRequestLog = connectionStatus === 'connected' && Boolean(config);
|
||||
const isLogsPage = location.pathname.startsWith('/logs');
|
||||
|
||||
// 将顶栏高度写入 CSS 变量,确保侧栏/内容区计算一致,防止滚动时抖动
|
||||
@@ -246,7 +233,7 @@ export function MainLayout() {
|
||||
};
|
||||
}, []);
|
||||
|
||||
// 将主内容区的中心点写入 CSS 变量,供底部浮层(如配置面板操作栏)对齐到内容区而非整窗
|
||||
// 将主内容区的中心点写入 CSS 变量,供底部浮层(配置面板操作栏、提供商导航)对齐到内容区
|
||||
useLayoutEffect(() => {
|
||||
const updateContentCenter = () => {
|
||||
const el = contentRef.current;
|
||||
@@ -274,6 +261,7 @@ export function MainLayout() {
|
||||
resizeObserver.disconnect();
|
||||
}
|
||||
window.removeEventListener('resize', updateContentCenter);
|
||||
document.documentElement.style.removeProperty('--content-center-x');
|
||||
};
|
||||
}, []);
|
||||
|
||||
@@ -290,20 +278,6 @@ export function MainLayout() {
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (requestLogModalOpen && !requestLogTouched) {
|
||||
setRequestLogDraft(requestLogEnabled);
|
||||
}
|
||||
}, [requestLogModalOpen, requestLogTouched, requestLogEnabled]);
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
if (versionTapTimer.current) {
|
||||
clearTimeout(versionTapTimer.current);
|
||||
}
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!languageMenuOpen) {
|
||||
return;
|
||||
@@ -343,12 +317,6 @@ export function MainLayout() {
|
||||
}
|
||||
}, [brandExpanded]);
|
||||
|
||||
const openRequestLogModal = useCallback(() => {
|
||||
setRequestLogTouched(false);
|
||||
setRequestLogDraft(requestLogEnabled);
|
||||
setRequestLogModalOpen(true);
|
||||
}, [requestLogEnabled]);
|
||||
|
||||
const toggleLanguageMenu = useCallback(() => {
|
||||
setLanguageMenuOpen((prev) => !prev);
|
||||
}, []);
|
||||
@@ -364,54 +332,6 @@ export function MainLayout() {
|
||||
[setLanguage]
|
||||
);
|
||||
|
||||
const handleRequestLogClose = useCallback(() => {
|
||||
setRequestLogModalOpen(false);
|
||||
setRequestLogTouched(false);
|
||||
}, []);
|
||||
|
||||
const handleVersionTap = useCallback(() => {
|
||||
versionTapCount.current += 1;
|
||||
if (versionTapTimer.current) {
|
||||
clearTimeout(versionTapTimer.current);
|
||||
}
|
||||
versionTapTimer.current = setTimeout(() => {
|
||||
versionTapCount.current = 0;
|
||||
}, 1500);
|
||||
|
||||
if (versionTapCount.current >= 7) {
|
||||
versionTapCount.current = 0;
|
||||
if (versionTapTimer.current) {
|
||||
clearTimeout(versionTapTimer.current);
|
||||
versionTapTimer.current = null;
|
||||
}
|
||||
openRequestLogModal();
|
||||
}
|
||||
}, [openRequestLogModal]);
|
||||
|
||||
const handleRequestLogSave = async () => {
|
||||
if (!canEditRequestLog) return;
|
||||
if (!requestLogDirty) {
|
||||
setRequestLogModalOpen(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const previous = requestLogEnabled;
|
||||
setRequestLogSaving(true);
|
||||
updateConfigValue('request-log', requestLogDraft);
|
||||
|
||||
try {
|
||||
await configApi.updateRequestLog(requestLogDraft);
|
||||
clearCache('request-log');
|
||||
showNotification(t('notification.request_log_updated'), 'success');
|
||||
setRequestLogModalOpen(false);
|
||||
} catch (error: any) {
|
||||
updateConfigValue('request-log', previous);
|
||||
showNotification(`${t('notification.update_failed')}: ${error?.message || ''}`, 'error');
|
||||
} finally {
|
||||
setRequestLogSaving(false);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
fetchConfig().catch(() => {
|
||||
// ignore initial failure; login flow会提示
|
||||
@@ -685,57 +605,8 @@ export function MainLayout() {
|
||||
scrollContainerRef={contentRef}
|
||||
/>
|
||||
</main>
|
||||
|
||||
<footer className="footer">
|
||||
<span>
|
||||
{t('footer.api_version')}: {serverVersion || t('system_info.version_unknown')}
|
||||
</span>
|
||||
<span className="footer-version" onClick={handleVersionTap}>
|
||||
{t('footer.version')}: {__APP_VERSION__ || t('system_info.version_unknown')}
|
||||
</span>
|
||||
<span>
|
||||
{t('footer.build_date')}:{' '}
|
||||
{serverBuildDate
|
||||
? new Date(serverBuildDate).toLocaleString(i18n.language)
|
||||
: t('system_info.version_unknown')}
|
||||
</span>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Modal
|
||||
open={requestLogModalOpen}
|
||||
onClose={handleRequestLogClose}
|
||||
title={t('basic_settings.request_log_title')}
|
||||
footer={
|
||||
<>
|
||||
<Button variant="secondary" onClick={handleRequestLogClose} disabled={requestLogSaving}>
|
||||
{t('common.cancel')}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleRequestLogSave}
|
||||
loading={requestLogSaving}
|
||||
disabled={!canEditRequestLog || !requestLogDirty}
|
||||
>
|
||||
{t('common.save')}
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<div className="request-log-modal">
|
||||
<div className="status-badge warning">{t('basic_settings.request_log_warning')}</div>
|
||||
<ToggleSwitch
|
||||
label={t('basic_settings.request_log_enable')}
|
||||
labelPosition="left"
|
||||
checked={requestLogDraft}
|
||||
disabled={!canEditRequestLog || requestLogSaving}
|
||||
onChange={(value) => {
|
||||
setRequestLogDraft(value);
|
||||
setRequestLogTouched(true);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,11 +16,53 @@ const CLOSE_ANIMATION_DURATION = 350;
|
||||
const MODAL_LOCK_CLASS = 'modal-open';
|
||||
let activeModalCount = 0;
|
||||
|
||||
const scrollLockSnapshot = {
|
||||
scrollY: 0,
|
||||
contentScrollTop: 0,
|
||||
contentEl: null as HTMLElement | null,
|
||||
bodyPosition: '',
|
||||
bodyTop: '',
|
||||
bodyLeft: '',
|
||||
bodyRight: '',
|
||||
bodyWidth: '',
|
||||
bodyOverflow: '',
|
||||
htmlOverflow: '',
|
||||
};
|
||||
|
||||
const resolveContentScrollContainer = () => {
|
||||
if (typeof document === 'undefined') return null;
|
||||
const contentEl = document.querySelector('.content');
|
||||
return contentEl instanceof HTMLElement ? contentEl : null;
|
||||
};
|
||||
|
||||
const lockScroll = () => {
|
||||
if (typeof document === 'undefined') return;
|
||||
if (activeModalCount === 0) {
|
||||
document.body?.classList.add(MODAL_LOCK_CLASS);
|
||||
document.documentElement?.classList.add(MODAL_LOCK_CLASS);
|
||||
const body = document.body;
|
||||
const html = document.documentElement;
|
||||
const contentEl = resolveContentScrollContainer();
|
||||
|
||||
scrollLockSnapshot.scrollY = window.scrollY || window.pageYOffset || html.scrollTop || 0;
|
||||
scrollLockSnapshot.contentEl = contentEl;
|
||||
scrollLockSnapshot.contentScrollTop = contentEl?.scrollTop ?? 0;
|
||||
scrollLockSnapshot.bodyPosition = body.style.position;
|
||||
scrollLockSnapshot.bodyTop = body.style.top;
|
||||
scrollLockSnapshot.bodyLeft = body.style.left;
|
||||
scrollLockSnapshot.bodyRight = body.style.right;
|
||||
scrollLockSnapshot.bodyWidth = body.style.width;
|
||||
scrollLockSnapshot.bodyOverflow = body.style.overflow;
|
||||
scrollLockSnapshot.htmlOverflow = html.style.overflow;
|
||||
|
||||
body.classList.add(MODAL_LOCK_CLASS);
|
||||
html.classList.add(MODAL_LOCK_CLASS);
|
||||
|
||||
body.style.position = 'fixed';
|
||||
body.style.top = `-${scrollLockSnapshot.scrollY}px`;
|
||||
body.style.left = '0';
|
||||
body.style.right = '0';
|
||||
body.style.width = '100%';
|
||||
body.style.overflow = 'hidden';
|
||||
html.style.overflow = 'hidden';
|
||||
}
|
||||
activeModalCount += 1;
|
||||
};
|
||||
@@ -29,8 +71,31 @@ const unlockScroll = () => {
|
||||
if (typeof document === 'undefined') return;
|
||||
activeModalCount = Math.max(0, activeModalCount - 1);
|
||||
if (activeModalCount === 0) {
|
||||
document.body?.classList.remove(MODAL_LOCK_CLASS);
|
||||
document.documentElement?.classList.remove(MODAL_LOCK_CLASS);
|
||||
const body = document.body;
|
||||
const html = document.documentElement;
|
||||
const scrollY = scrollLockSnapshot.scrollY;
|
||||
const contentScrollTop = scrollLockSnapshot.contentScrollTop;
|
||||
const contentEl = scrollLockSnapshot.contentEl;
|
||||
|
||||
body.classList.remove(MODAL_LOCK_CLASS);
|
||||
html.classList.remove(MODAL_LOCK_CLASS);
|
||||
|
||||
body.style.position = scrollLockSnapshot.bodyPosition;
|
||||
body.style.top = scrollLockSnapshot.bodyTop;
|
||||
body.style.left = scrollLockSnapshot.bodyLeft;
|
||||
body.style.right = scrollLockSnapshot.bodyRight;
|
||||
body.style.width = scrollLockSnapshot.bodyWidth;
|
||||
body.style.overflow = scrollLockSnapshot.bodyOverflow;
|
||||
html.style.overflow = scrollLockSnapshot.htmlOverflow;
|
||||
|
||||
if (contentEl) {
|
||||
contentEl.scrollTo({ top: contentScrollTop, left: 0, behavior: 'auto' });
|
||||
}
|
||||
window.scrollTo({ top: scrollY, left: 0, behavior: 'auto' });
|
||||
|
||||
scrollLockSnapshot.scrollY = 0;
|
||||
scrollLockSnapshot.contentScrollTop = 0;
|
||||
scrollLockSnapshot.contentEl = null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -405,8 +405,8 @@
|
||||
"models_empty_desc": "This credential may not be loaded by the server yet, or no models are bound to it.",
|
||||
"models_unsupported": "This feature is not supported in the current version",
|
||||
"models_unsupported_desc": "Please update CLI Proxy API to the latest version and try again",
|
||||
"models_excluded_badge": "Excluded",
|
||||
"models_excluded_hint": "This model is excluded by OAuth",
|
||||
"models_excluded_badge": "Disabled",
|
||||
"models_excluded_hint": "This OAuth model is disabled",
|
||||
"status_toggle_label": "Enabled",
|
||||
"status_enabled_success": "\"{{name}}\" enabled",
|
||||
"status_disabled_success": "\"{{name}}\" disabled",
|
||||
@@ -490,43 +490,43 @@
|
||||
"result_file": "Persisted file"
|
||||
},
|
||||
"oauth_excluded": {
|
||||
"title": "OAuth Excluded Models",
|
||||
"description": "Per-provider exclusions are shown as cards; click edit to adjust. Wildcards * are supported and the scope follows the auth file filter.",
|
||||
"add": "Add Exclusion",
|
||||
"add_title": "Add provider exclusion",
|
||||
"edit_title": "Edit exclusions for {{provider}}",
|
||||
"title": "OAuth Model Disablement",
|
||||
"description": "Per-provider model disablement is shown as cards; click a card to edit or delete. Wildcards * are supported and the scope follows the auth file filter.",
|
||||
"add": "Add Disablement",
|
||||
"add_title": "Add provider model disablement",
|
||||
"edit_title": "Edit model disablement for {{provider}}",
|
||||
"refresh": "Refresh",
|
||||
"refreshing": "Refreshing...",
|
||||
"provider_label": "Provider",
|
||||
"provider_auto": "Follow current filter",
|
||||
"provider_placeholder": "e.g. gemini-cli",
|
||||
"provider_hint": "Defaults to the current filter; pick an existing provider or type a new name.",
|
||||
"models_label": "Models to exclude",
|
||||
"models_label": "Models to disable",
|
||||
"models_loading": "Loading models...",
|
||||
"models_unsupported": "Current CPA version does not support fetching model lists.",
|
||||
"models_loaded": "{{count}} models loaded. Check the models to exclude.",
|
||||
"models_loaded": "{{count}} models loaded. Check the models to disable.",
|
||||
"no_models_available": "No models available for this provider.",
|
||||
"save": "Save/Update",
|
||||
"saving": "Saving...",
|
||||
"save_success": "Excluded models updated",
|
||||
"save_failed": "Failed to update excluded models",
|
||||
"save_success": "Model disablement updated",
|
||||
"save_failed": "Failed to update model disablement",
|
||||
"delete": "Delete Provider",
|
||||
"delete_confirm": "Delete the exclusion list for {{provider}}?",
|
||||
"delete_success": "Exclusion list removed",
|
||||
"delete_failed": "Failed to delete exclusion list",
|
||||
"delete_confirm": "Delete model disablement for {{provider}}?",
|
||||
"delete_success": "Provider model disablement removed",
|
||||
"delete_failed": "Failed to delete model disablement",
|
||||
"deleting": "Deleting...",
|
||||
"no_models": "No excluded models",
|
||||
"model_count": "{{count}} models excluded",
|
||||
"list_empty_all": "No exclusions yet—use “Add Exclusion” to create one.",
|
||||
"list_empty_filtered": "No exclusions in this scope; click “Add Exclusion” to add.",
|
||||
"disconnected": "Connect to the server to view exclusions",
|
||||
"load_failed": "Failed to load exclusion list",
|
||||
"no_models": "No disabled models configured",
|
||||
"model_count": "{{count}} models disabled",
|
||||
"list_empty_all": "No provider model disablement yet; click “Add Disablement” to create one.",
|
||||
"list_empty_filtered": "No disabled items in this scope; click “Add Disablement” to add.",
|
||||
"disconnected": "Connect to the server to view model disablement",
|
||||
"load_failed": "Failed to load model disablement",
|
||||
"provider_required": "Please enter a provider first",
|
||||
"scope_all": "Scope: All providers",
|
||||
"scope_provider": "Scope: {{provider}}",
|
||||
"upgrade_required": "This feature requires a newer CLI Proxy API (CPA) version. Please upgrade.",
|
||||
"upgrade_required": "Current CPA version does not support OAuth model disablement. Please upgrade.",
|
||||
"upgrade_required_title": "Please upgrade CLI Proxy API",
|
||||
"upgrade_required_desc": "The current server does not support the OAuth excluded models API. Please upgrade to the latest CLI Proxy API (CPA) version."
|
||||
"upgrade_required_desc": "The current server version does not support fetching OAuth model disablement. Please upgrade to the latest CPA (CLI Proxy API) version and try again."
|
||||
},
|
||||
"oauth_model_alias": {
|
||||
"title": "OAuth Model Aliases",
|
||||
@@ -887,9 +887,9 @@
|
||||
"debug": "Debug Mode",
|
||||
"debug_desc": "Enable verbose debug logging",
|
||||
"commercial_mode": "Commercial Mode",
|
||||
"commercial_mode_desc": "Disable high-overhead middleware to reduce memory under high concurrency",
|
||||
"commercial_mode_desc": "Disable high-overhead middleware to support high concurrency",
|
||||
"logging_to_file": "Log to File",
|
||||
"logging_to_file_desc": "Save logs to rotating files",
|
||||
"logging_to_file_desc": "Save logs to files",
|
||||
"usage_statistics": "Usage Statistics",
|
||||
"usage_statistics_desc": "Collect usage statistics",
|
||||
"logs_max_size": "Log File Size Limit (MB)"
|
||||
@@ -989,6 +989,7 @@
|
||||
},
|
||||
"system_info": {
|
||||
"title": "Management Center Info",
|
||||
"about_title": "CLI Proxy API Management Center",
|
||||
"connection_status_title": "Connection Status",
|
||||
"api_status_label": "API Status:",
|
||||
"config_status_label": "Config Status:",
|
||||
@@ -1093,6 +1094,8 @@
|
||||
"gemini_api_key": "Gemini API key",
|
||||
"codex_api_key": "Codex API key",
|
||||
"claude_api_key": "Claude API key",
|
||||
"commercial_mode_restart_required": "Commercial mode setting changed. Please restart the service for it to take effect",
|
||||
"copy_failed": "Copy failed",
|
||||
"link_copied": "Link copied to clipboard"
|
||||
},
|
||||
"language": {
|
||||
|
||||
@@ -405,8 +405,8 @@
|
||||
"models_empty_desc": "Возможно, учётные данные ещё не загружены сервером или к ним не привязаны модели.",
|
||||
"models_unsupported": "Функция не поддерживается в текущей версии",
|
||||
"models_unsupported_desc": "Обновите CLI Proxy API до последней версии и повторите попытку",
|
||||
"models_excluded_badge": "Исключена",
|
||||
"models_excluded_hint": "Эта модель исключена OAuth",
|
||||
"models_excluded_badge": "Отключена",
|
||||
"models_excluded_hint": "Эта OAuth-модель отключена",
|
||||
"status_toggle_label": "Включено",
|
||||
"status_enabled_success": "\"{{name}}\" включён",
|
||||
"status_disabled_success": "\"{{name}}\" отключён",
|
||||
@@ -493,43 +493,43 @@
|
||||
"result_file": "Сохранённый файл"
|
||||
},
|
||||
"oauth_excluded": {
|
||||
"title": "Исключённые модели OAuth",
|
||||
"description": "Исключения по провайдерам отображаются карточками; нажмите \"Изменить\", чтобы настроить. Поддерживаются шаблоны *. Объём зависит от фильтра файлов авторизации.",
|
||||
"add": "Добавить исключение",
|
||||
"add_title": "Добавление исключения для провайдера",
|
||||
"edit_title": "Редактирование исключений для {{provider}}",
|
||||
"title": "Отключение OAuth-моделей",
|
||||
"description": "Отключения моделей по провайдерам отображаются карточками; нажмите карточку, чтобы изменить или удалить. Поддерживаются шаблоны *. Область зависит от фильтра файлов авторизации.",
|
||||
"add": "Добавить отключение",
|
||||
"add_title": "Добавление отключения моделей для провайдера",
|
||||
"edit_title": "Редактирование отключения моделей для {{provider}}",
|
||||
"refresh": "Обновить",
|
||||
"refreshing": "Обновляется...",
|
||||
"provider_label": "Провайдер",
|
||||
"provider_auto": "Следовать текущему фильтру",
|
||||
"provider_placeholder": "например: gemini-cli",
|
||||
"provider_hint": "По умолчанию используется текущий фильтр; выберите существующего провайдера или введите новое имя.",
|
||||
"models_label": "Модели для исключения",
|
||||
"models_label": "Отключаемые модели",
|
||||
"models_loading": "Загрузка моделей...",
|
||||
"models_unsupported": "Текущая версия CPA не поддерживает загрузку списка моделей.",
|
||||
"models_loaded": "Загружено моделей: {{count}}. Отметьте те, которые нужно исключить.",
|
||||
"models_loaded": "Загружено моделей: {{count}}. Отметьте модели, которые нужно отключить.",
|
||||
"no_models_available": "Для этого провайдера нет доступных моделей.",
|
||||
"save": "Сохранить/обновить",
|
||||
"saving": "Сохранение...",
|
||||
"save_success": "Исключения обновлены",
|
||||
"save_failed": "Не удалось обновить исключения",
|
||||
"save_success": "Отключение моделей обновлено",
|
||||
"save_failed": "Не удалось обновить отключение моделей",
|
||||
"delete": "Удалить провайдера",
|
||||
"delete_confirm": "Удалить список исключений для {{provider}}?",
|
||||
"delete_success": "Список исключений удалён",
|
||||
"delete_failed": "Не удалось удалить список исключений",
|
||||
"delete_confirm": "Удалить отключение моделей для {{provider}}?",
|
||||
"delete_success": "Отключение моделей провайдера удалено",
|
||||
"delete_failed": "Не удалось удалить отключение моделей",
|
||||
"deleting": "Удаление...",
|
||||
"no_models": "Исключённых моделей нет",
|
||||
"model_count": "Исключено моделей: {{count}}",
|
||||
"list_empty_all": "Исключений ещё нет — используйте \"Добавить исключение\".",
|
||||
"list_empty_filtered": "В этом диапазоне исключений нет; нажмите \"Добавить исключение\".",
|
||||
"disconnected": "Подключитесь к серверу, чтобы просматривать исключения",
|
||||
"load_failed": "Не удалось загрузить список исключений",
|
||||
"no_models": "Отключаемые модели не настроены",
|
||||
"model_count": "Отключено моделей: {{count}}",
|
||||
"list_empty_all": "Отключений моделей пока нет — используйте \"Добавить отключение\".",
|
||||
"list_empty_filtered": "В этой области нет отключённых моделей; нажмите \"Добавить отключение\".",
|
||||
"disconnected": "Подключитесь к серверу, чтобы просматривать отключение моделей",
|
||||
"load_failed": "Не удалось загрузить отключение моделей",
|
||||
"provider_required": "Сначала укажите провайдера",
|
||||
"scope_all": "Область: все провайдеры",
|
||||
"scope_provider": "Область: {{provider}}",
|
||||
"upgrade_required": "Эта функция требует более новой версии CLI Proxy API (CPA). Обновите систему.",
|
||||
"upgrade_required": "Текущая версия CPA не поддерживает отключение OAuth-моделей. Пожалуйста, обновите систему.",
|
||||
"upgrade_required_title": "Пожалуйста, обновите CLI Proxy API",
|
||||
"upgrade_required_desc": "Текущая версия сервера не поддерживает API исключённых моделей OAuth. Обновите CLI Proxy API (CPA) до последней версии."
|
||||
"upgrade_required_desc": "Текущая версия сервера не поддерживает получение отключения OAuth-моделей. Обновите CPA (CLI Proxy API) до последней версии и повторите попытку."
|
||||
},
|
||||
"oauth_model_alias": {
|
||||
"title": "Псевдонимы моделей OAuth",
|
||||
@@ -890,9 +890,9 @@
|
||||
"debug": "Режим отладки",
|
||||
"debug_desc": "Включить подробные отладочные журналы",
|
||||
"commercial_mode": "Коммерческий режим",
|
||||
"commercial_mode_desc": "Отключить тяжёлое промежуточное ПО, чтобы снизить расход памяти при высокой нагрузке",
|
||||
"commercial_mode_desc": "Отключить тяжёлое промежуточное ПО для поддержки высокой нагрузки",
|
||||
"logging_to_file": "Журналировать в файл",
|
||||
"logging_to_file_desc": "Сохранять журналы во вращающиеся файлы",
|
||||
"logging_to_file_desc": "Сохранять журналы в файлы",
|
||||
"usage_statistics": "Статистика использования",
|
||||
"usage_statistics_desc": "Собирать статистику использования",
|
||||
"logs_max_size": "Максимальный размер файла журнала (МБ)",
|
||||
@@ -994,6 +994,7 @@
|
||||
},
|
||||
"system_info": {
|
||||
"title": "Информация о центре управления",
|
||||
"about_title": "CLI Proxy API Management Center",
|
||||
"connection_status_title": "Статус подключения",
|
||||
"api_status_label": "Статус API:",
|
||||
"config_status_label": "Статус конфигурации:",
|
||||
@@ -1098,6 +1099,8 @@
|
||||
"gemini_api_key": "API-ключ Gemini",
|
||||
"codex_api_key": "API-ключ Codex",
|
||||
"claude_api_key": "API-ключ Claude",
|
||||
"commercial_mode_restart_required": "Режим коммерческого использования изменён. Перезапустите сервис, чтобы применить изменения",
|
||||
"copy_failed": "Не удалось скопировать",
|
||||
"link_copied": "Ссылка скопирована в буфер обмена"
|
||||
},
|
||||
"language": {
|
||||
|
||||
@@ -989,6 +989,7 @@
|
||||
},
|
||||
"system_info": {
|
||||
"title": "管理中心信息",
|
||||
"about_title": "CLI Proxy API Management Center",
|
||||
"connection_status_title": "连接状态",
|
||||
"api_status_label": "API 状态:",
|
||||
"config_status_label": "配置状态:",
|
||||
@@ -1093,6 +1094,8 @@
|
||||
"gemini_api_key": "Gemini API密钥",
|
||||
"codex_api_key": "Codex API密钥",
|
||||
"claude_api_key": "Claude API密钥",
|
||||
"commercial_mode_restart_required": "商业模式开关已变更,请重启服务后生效",
|
||||
"copy_failed": "复制失败",
|
||||
"link_copied": "已复制"
|
||||
},
|
||||
"language": {
|
||||
|
||||
@@ -26,6 +26,7 @@ const OAUTH_PROVIDER_PRESETS = [
|
||||
'claude',
|
||||
'codex',
|
||||
'qwen',
|
||||
'kimi',
|
||||
'iflow',
|
||||
];
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ const OAUTH_PROVIDER_PRESETS = [
|
||||
'claude',
|
||||
'codex',
|
||||
'qwen',
|
||||
'kimi',
|
||||
'iflow',
|
||||
];
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import CodeMirror, { ReactCodeMirrorRef } from '@uiw/react-codemirror';
|
||||
import { yaml } from '@codemirror/lang-yaml';
|
||||
import { search, searchKeymap, highlightSelectionMatches } from '@codemirror/search';
|
||||
import { keymap } from '@codemirror/view';
|
||||
import { parse as parseYaml } from 'yaml';
|
||||
import { Card } from '@/components/ui/Card';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { Input } from '@/components/ui/Input';
|
||||
@@ -17,6 +18,16 @@ import styles from './ConfigPage.module.scss';
|
||||
|
||||
type ConfigEditorTab = 'visual' | 'source';
|
||||
|
||||
function readCommercialModeFromYaml(yamlContent: string): boolean {
|
||||
try {
|
||||
const parsed = parseYaml(yamlContent);
|
||||
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) return false;
|
||||
return Boolean((parsed as Record<string, unknown>)['commercial-mode']);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function ConfigPage() {
|
||||
const { t } = useTranslation();
|
||||
const { showNotification } = useNotificationStore();
|
||||
@@ -78,13 +89,19 @@ export function ConfigPage() {
|
||||
const handleSave = async () => {
|
||||
setSaving(true);
|
||||
try {
|
||||
const previousCommercialMode = readCommercialModeFromYaml(content);
|
||||
const nextContent = activeTab === 'visual' ? applyVisualChangesToYaml(content) : content;
|
||||
const nextCommercialMode = readCommercialModeFromYaml(nextContent);
|
||||
const commercialModeChanged = previousCommercialMode !== nextCommercialMode;
|
||||
await configFileApi.saveConfigYaml(nextContent);
|
||||
const latestContent = await configFileApi.fetchConfigYaml();
|
||||
setDirty(false);
|
||||
setContent(latestContent);
|
||||
loadVisualValuesFromYaml(latestContent);
|
||||
showNotification(t('config_management.save_success'), 'success');
|
||||
if (commercialModeChanged) {
|
||||
showNotification(t('notification.commercial_mode_restart_required'), 'warning');
|
||||
}
|
||||
} catch (err: unknown) {
|
||||
const message = err instanceof Error ? err.message : '';
|
||||
showNotification(`${t('notification.save_failed')}: ${message}`, 'error');
|
||||
|
||||
@@ -15,6 +15,108 @@
|
||||
gap: $spacing-xl;
|
||||
}
|
||||
|
||||
.aboutCard {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.aboutHeader {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
gap: $spacing-md;
|
||||
padding: $spacing-lg 0 $spacing-xl;
|
||||
}
|
||||
|
||||
.aboutLogo {
|
||||
width: 108px;
|
||||
height: 108px;
|
||||
border-radius: 26px;
|
||||
object-fit: cover;
|
||||
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
|
||||
}
|
||||
|
||||
.aboutTitle {
|
||||
width: min(100%, 920px);
|
||||
font-size: clamp(28px, 4.2vw, 44px);
|
||||
font-weight: 800;
|
||||
line-height: 1.12;
|
||||
color: var(--text-primary);
|
||||
letter-spacing: -0.02em;
|
||||
text-align: center;
|
||||
text-wrap: balance;
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.aboutInfoGrid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: $spacing-md;
|
||||
|
||||
@media (max-width: 900px) {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.infoTile {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
min-height: 120px;
|
||||
padding: $spacing-md $spacing-lg;
|
||||
border-radius: $radius-lg;
|
||||
border: 1px solid var(--border-color);
|
||||
background: color-mix(in srgb, var(--bg-secondary) 82%, transparent);
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.tapTile {
|
||||
border: 1px solid var(--border-color);
|
||||
background: color-mix(in srgb, var(--bg-secondary) 82%, transparent);
|
||||
color: inherit;
|
||||
padding: $spacing-md $spacing-lg;
|
||||
cursor: pointer;
|
||||
transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
transform: translateY(-1px);
|
||||
border-color: var(--primary-color);
|
||||
box-shadow: 0 8px 18px rgba(59, 130, 246, 0.15);
|
||||
}
|
||||
|
||||
&:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.tileLabel {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.tileValue {
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
line-height: 1.25;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.tileSub {
|
||||
font-size: 12px;
|
||||
color: var(--text-tertiary);
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.aboutActions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: $spacing-lg;
|
||||
}
|
||||
|
||||
.section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -231,3 +333,29 @@
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.aboutLogo {
|
||||
width: 92px;
|
||||
height: 92px;
|
||||
border-radius: 22px;
|
||||
}
|
||||
|
||||
.aboutTitle {
|
||||
width: min(100%, 24ch);
|
||||
font-size: clamp(22px, 6.6vw, 34px);
|
||||
font-weight: 700;
|
||||
line-height: 1.18;
|
||||
letter-spacing: -0.012em;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 520px) {
|
||||
.aboutTitle {
|
||||
width: min(100%, 19ch);
|
||||
font-size: clamp(20px, 7.2vw, 28px);
|
||||
font-weight: 600;
|
||||
line-height: 1.22;
|
||||
letter-spacing: -0.006em;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,15 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Card } from '@/components/ui/Card';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { Modal } from '@/components/ui/Modal';
|
||||
import { ToggleSwitch } from '@/components/ui/ToggleSwitch';
|
||||
import { IconGithub, IconBookOpen, IconExternalLink, IconCode } from '@/components/ui/icons';
|
||||
import { useAuthStore, useConfigStore, useNotificationStore, useModelsStore, useThemeStore } from '@/stores';
|
||||
import { configApi } from '@/services/api';
|
||||
import { apiKeysApi } from '@/services/api/apiKeys';
|
||||
import { classifyModels } from '@/utils/models';
|
||||
import { STORAGE_KEY_AUTH } from '@/utils/constants';
|
||||
import { INLINE_LOGO_JPEG } from '@/assets/logoInline';
|
||||
import iconGemini from '@/assets/icons/gemini.svg';
|
||||
import iconClaude from '@/assets/icons/claude.svg';
|
||||
import iconOpenaiLight from '@/assets/icons/openai-light.svg';
|
||||
@@ -39,6 +43,8 @@ export function SystemPage() {
|
||||
const auth = useAuthStore();
|
||||
const config = useConfigStore((state) => state.config);
|
||||
const fetchConfig = useConfigStore((state) => state.fetchConfig);
|
||||
const clearCache = useConfigStore((state) => state.clearCache);
|
||||
const updateConfigValue = useConfigStore((state) => state.updateConfigValue);
|
||||
|
||||
const models = useModelsStore((state) => state.models);
|
||||
const modelsLoading = useModelsStore((state) => state.loading);
|
||||
@@ -46,14 +52,29 @@ export function SystemPage() {
|
||||
const fetchModelsFromStore = useModelsStore((state) => state.fetchModels);
|
||||
|
||||
const [modelStatus, setModelStatus] = useState<{ type: 'success' | 'warning' | 'error' | 'muted'; message: string }>();
|
||||
const [requestLogModalOpen, setRequestLogModalOpen] = useState(false);
|
||||
const [requestLogDraft, setRequestLogDraft] = useState(false);
|
||||
const [requestLogTouched, setRequestLogTouched] = useState(false);
|
||||
const [requestLogSaving, setRequestLogSaving] = useState(false);
|
||||
|
||||
const apiKeysCache = useRef<string[]>([]);
|
||||
const versionTapCount = useRef(0);
|
||||
const versionTapTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
|
||||
const otherLabel = useMemo(
|
||||
() => (i18n.language?.toLowerCase().startsWith('zh') ? '其他' : 'Other'),
|
||||
[i18n.language]
|
||||
);
|
||||
const groupedModels = useMemo(() => classifyModels(models, { otherLabel }), [models, otherLabel]);
|
||||
const requestLogEnabled = config?.requestLog ?? false;
|
||||
const requestLogDirty = requestLogDraft !== requestLogEnabled;
|
||||
const canEditRequestLog = auth.connectionStatus === 'connected' && Boolean(config);
|
||||
|
||||
const appVersion = __APP_VERSION__ || t('system_info.version_unknown');
|
||||
const apiVersion = auth.serverVersion || t('system_info.version_unknown');
|
||||
const buildTime = auth.serverBuildDate
|
||||
? new Date(auth.serverBuildDate).toLocaleString(i18n.language)
|
||||
: t('system_info.version_unknown');
|
||||
|
||||
const getIconForCategory = (categoryId: string): string | null => {
|
||||
const iconEntry = MODEL_CATEGORY_ICONS[categoryId];
|
||||
@@ -152,12 +173,80 @@ export function SystemPage() {
|
||||
});
|
||||
};
|
||||
|
||||
const openRequestLogModal = useCallback(() => {
|
||||
setRequestLogTouched(false);
|
||||
setRequestLogDraft(requestLogEnabled);
|
||||
setRequestLogModalOpen(true);
|
||||
}, [requestLogEnabled]);
|
||||
|
||||
const handleInfoVersionTap = useCallback(() => {
|
||||
versionTapCount.current += 1;
|
||||
if (versionTapTimer.current) {
|
||||
clearTimeout(versionTapTimer.current);
|
||||
}
|
||||
|
||||
if (versionTapCount.current >= 7) {
|
||||
versionTapCount.current = 0;
|
||||
versionTapTimer.current = null;
|
||||
openRequestLogModal();
|
||||
return;
|
||||
}
|
||||
|
||||
versionTapTimer.current = setTimeout(() => {
|
||||
versionTapCount.current = 0;
|
||||
versionTapTimer.current = null;
|
||||
}, 1500);
|
||||
}, [openRequestLogModal]);
|
||||
|
||||
const handleRequestLogClose = useCallback(() => {
|
||||
setRequestLogModalOpen(false);
|
||||
setRequestLogTouched(false);
|
||||
}, []);
|
||||
|
||||
const handleRequestLogSave = async () => {
|
||||
if (!canEditRequestLog) return;
|
||||
if (!requestLogDirty) {
|
||||
setRequestLogModalOpen(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const previous = requestLogEnabled;
|
||||
setRequestLogSaving(true);
|
||||
updateConfigValue('request-log', requestLogDraft);
|
||||
|
||||
try {
|
||||
await configApi.updateRequestLog(requestLogDraft);
|
||||
clearCache('request-log');
|
||||
showNotification(t('notification.request_log_updated'), 'success');
|
||||
setRequestLogModalOpen(false);
|
||||
} catch (error: any) {
|
||||
updateConfigValue('request-log', previous);
|
||||
showNotification(`${t('notification.update_failed')}: ${error?.message || ''}`, 'error');
|
||||
} finally {
|
||||
setRequestLogSaving(false);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
fetchConfig().catch(() => {
|
||||
// ignore
|
||||
});
|
||||
}, [fetchConfig]);
|
||||
|
||||
useEffect(() => {
|
||||
if (requestLogModalOpen && !requestLogTouched) {
|
||||
setRequestLogDraft(requestLogEnabled);
|
||||
}
|
||||
}, [requestLogModalOpen, requestLogTouched, requestLogEnabled]);
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
if (versionTapTimer.current) {
|
||||
clearTimeout(versionTapTimer.current);
|
||||
}
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
fetchModels();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
@@ -167,33 +256,43 @@ export function SystemPage() {
|
||||
<div className={styles.container}>
|
||||
<h1 className={styles.pageTitle}>{t('system_info.title')}</h1>
|
||||
<div className={styles.content}>
|
||||
<Card
|
||||
title={t('system_info.connection_status_title')}
|
||||
extra={
|
||||
<Card className={styles.aboutCard}>
|
||||
<div className={styles.aboutHeader}>
|
||||
<img src={INLINE_LOGO_JPEG} alt="CPAMC" className={styles.aboutLogo} />
|
||||
<div className={styles.aboutTitle}>{t('system_info.about_title')}</div>
|
||||
</div>
|
||||
|
||||
<div className={styles.aboutInfoGrid}>
|
||||
<button
|
||||
type="button"
|
||||
className={`${styles.infoTile} ${styles.tapTile}`}
|
||||
onClick={handleInfoVersionTap}
|
||||
>
|
||||
<div className={styles.tileLabel}>{t('footer.version')}</div>
|
||||
<div className={styles.tileValue}>{appVersion}</div>
|
||||
</button>
|
||||
|
||||
<div className={styles.infoTile}>
|
||||
<div className={styles.tileLabel}>{t('footer.api_version')}</div>
|
||||
<div className={styles.tileValue}>{apiVersion}</div>
|
||||
</div>
|
||||
|
||||
<div className={styles.infoTile}>
|
||||
<div className={styles.tileLabel}>{t('footer.build_date')}</div>
|
||||
<div className={styles.tileValue}>{buildTime}</div>
|
||||
</div>
|
||||
|
||||
<div className={styles.infoTile}>
|
||||
<div className={styles.tileLabel}>{t('connection.status')}</div>
|
||||
<div className={styles.tileValue}>{t(`common.${auth.connectionStatus}_status` as any)}</div>
|
||||
<div className={styles.tileSub}>{auth.apiBase || '-'}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className={styles.aboutActions}>
|
||||
<Button variant="secondary" size="sm" onClick={() => fetchConfig(undefined, true)}>
|
||||
{t('common.refresh')}
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
<div className="grid cols-2">
|
||||
<div className="stat-card">
|
||||
<div className="stat-label">{t('connection.server_address')}</div>
|
||||
<div className="stat-value">{auth.apiBase || '-'}</div>
|
||||
</div>
|
||||
<div className="stat-card">
|
||||
<div className="stat-label">{t('footer.api_version')}</div>
|
||||
<div className="stat-value">{auth.serverVersion || t('system_info.version_unknown')}</div>
|
||||
</div>
|
||||
<div className="stat-card">
|
||||
<div className="stat-label">{t('footer.build_date')}</div>
|
||||
<div className="stat-value">
|
||||
{auth.serverBuildDate ? new Date(auth.serverBuildDate).toLocaleString() : t('system_info.version_unknown')}
|
||||
</div>
|
||||
</div>
|
||||
<div className="stat-card">
|
||||
<div className="stat-label">{t('connection.status')}</div>
|
||||
<div className="stat-value">{t(`common.${auth.connectionStatus}_status` as any)}</div>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
@@ -312,6 +411,40 @@ export function SystemPage() {
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
<Modal
|
||||
open={requestLogModalOpen}
|
||||
onClose={handleRequestLogClose}
|
||||
title={t('basic_settings.request_log_title')}
|
||||
footer={
|
||||
<>
|
||||
<Button variant="secondary" onClick={handleRequestLogClose} disabled={requestLogSaving}>
|
||||
{t('common.cancel')}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleRequestLogSave}
|
||||
loading={requestLogSaving}
|
||||
disabled={!canEditRequestLog || !requestLogDirty}
|
||||
>
|
||||
{t('common.save')}
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<div className="request-log-modal">
|
||||
<div className="status-badge warning">{t('basic_settings.request_log_warning')}</div>
|
||||
<ToggleSwitch
|
||||
label={t('basic_settings.request_log_enable')}
|
||||
labelPosition="left"
|
||||
checked={requestLogDraft}
|
||||
disabled={!canEditRequestLog || requestLogSaving}
|
||||
onChange={(value) => {
|
||||
setRequestLogDraft(value);
|
||||
setRequestLogTouched(true);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -448,27 +448,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
padding: $spacing-md $spacing-lg;
|
||||
border-top: 1px solid var(--border-color);
|
||||
background: var(--bg-primary);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
color: var(--text-secondary);
|
||||
font-size: 14px;
|
||||
flex-wrap: wrap;
|
||||
gap: $spacing-sm;
|
||||
|
||||
.footer-version {
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-webkit-touch-callout: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
gap: $spacing-lg;
|
||||
|
||||
Reference in New Issue
Block a user