mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-02-03 11:20:50 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec4b5ab46a | ||
|
|
cd6c142324 |
@@ -266,3 +266,40 @@ export function IconDollarSign({ size = 20, ...props }: IconProps) {
|
|||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function IconGithub({ size = 20, ...props }: IconProps) {
|
||||||
|
return (
|
||||||
|
<svg {...baseSvgProps} width={size} height={size} {...props}>
|
||||||
|
<path d="M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4" />
|
||||||
|
<path d="M9 18c-4.51 2-5-2-7-2" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function IconExternalLink({ size = 20, ...props }: IconProps) {
|
||||||
|
return (
|
||||||
|
<svg {...baseSvgProps} width={size} height={size} {...props}>
|
||||||
|
<path d="M15 3h6v6" />
|
||||||
|
<path d="M10 14 21 3" />
|
||||||
|
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function IconBookOpen({ size = 20, ...props }: IconProps) {
|
||||||
|
return (
|
||||||
|
<svg {...baseSvgProps} width={size} height={size} {...props}>
|
||||||
|
<path d="M12 7v14" />
|
||||||
|
<path d="M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function IconCode({ size = 20, ...props }: IconProps) {
|
||||||
|
return (
|
||||||
|
<svg {...baseSvgProps} width={size} height={size} {...props}>
|
||||||
|
<polyline points="16 18 22 12 16 6" />
|
||||||
|
<polyline points="8 6 2 12 8 18" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -630,7 +630,15 @@
|
|||||||
"version_is_latest": "You are on the latest version",
|
"version_is_latest": "You are on the latest version",
|
||||||
"version_check_error": "Update check failed",
|
"version_check_error": "Update check failed",
|
||||||
"version_current_missing": "Server version is unavailable; cannot compare",
|
"version_current_missing": "Server version is unavailable; cannot compare",
|
||||||
"version_unknown": "Unknown"
|
"version_unknown": "Unknown",
|
||||||
|
"quick_links_title": "Quick Links",
|
||||||
|
"quick_links_desc": "Access project repositories and documentation for help and updates.",
|
||||||
|
"link_main_repo": "Main Repository",
|
||||||
|
"link_main_repo_desc": "CLI Proxy API core program source code",
|
||||||
|
"link_webui_repo": "WebUI Repository",
|
||||||
|
"link_webui_repo_desc": "Management Center frontend source code",
|
||||||
|
"link_docs": "Documentation",
|
||||||
|
"link_docs_desc": "Usage tutorials and configuration guides"
|
||||||
},
|
},
|
||||||
"notification": {
|
"notification": {
|
||||||
"debug_updated": "Debug settings updated",
|
"debug_updated": "Debug settings updated",
|
||||||
|
|||||||
@@ -630,7 +630,15 @@
|
|||||||
"version_is_latest": "当前已是最新版本",
|
"version_is_latest": "当前已是最新版本",
|
||||||
"version_check_error": "检查更新失败",
|
"version_check_error": "检查更新失败",
|
||||||
"version_current_missing": "未获取到服务器版本号,暂无法比对",
|
"version_current_missing": "未获取到服务器版本号,暂无法比对",
|
||||||
"version_unknown": "未知"
|
"version_unknown": "未知",
|
||||||
|
"quick_links_title": "快捷链接",
|
||||||
|
"quick_links_desc": "访问项目仓库和文档,获取帮助和更新。",
|
||||||
|
"link_main_repo": "主程序仓库",
|
||||||
|
"link_main_repo_desc": "CLI Proxy API 核心程序源代码",
|
||||||
|
"link_webui_repo": "WebUI 仓库",
|
||||||
|
"link_webui_repo_desc": "管理中心前端界面源代码",
|
||||||
|
"link_docs": "使用教程",
|
||||||
|
"link_docs_desc": "配置指南和使用说明"
|
||||||
},
|
},
|
||||||
"notification": {
|
"notification": {
|
||||||
"debug_updated": "调试设置已更新",
|
"debug_updated": "调试设置已更新",
|
||||||
|
|||||||
@@ -417,8 +417,6 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: $spacing-sm;
|
gap: $spacing-sm;
|
||||||
max-height: 400px;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.modelItem {
|
.modelItem {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { ToggleSwitch } from '@/components/ui/ToggleSwitch';
|
|||||||
import { IconDownload, IconRefreshCw, IconTimer, IconTrash2 } from '@/components/ui/icons';
|
import { IconDownload, IconRefreshCw, IconTimer, IconTrash2 } from '@/components/ui/icons';
|
||||||
import { useNotificationStore, useAuthStore } from '@/stores';
|
import { useNotificationStore, useAuthStore } from '@/stores';
|
||||||
import { logsApi } from '@/services/api/logs';
|
import { logsApi } from '@/services/api/logs';
|
||||||
|
import { formatUnixTimestamp } from '@/utils/format';
|
||||||
import styles from './LogsPage.module.scss';
|
import styles from './LogsPage.module.scss';
|
||||||
|
|
||||||
interface ErrorLogItem {
|
interface ErrorLogItem {
|
||||||
@@ -629,7 +630,7 @@ export function LogsPage() {
|
|||||||
<div className="item-title">{item.name}</div>
|
<div className="item-title">{item.name}</div>
|
||||||
<div className="item-subtitle">
|
<div className="item-subtitle">
|
||||||
{item.size ? `${(item.size / 1024).toFixed(1)} KB` : ''}{' '}
|
{item.size ? `${(item.size / 1024).toFixed(1)} KB` : ''}{' '}
|
||||||
{item.modified ? new Date(item.modified).toLocaleString() : ''}
|
{item.modified ? formatUnixTimestamp(item.modified) : ''}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="item-actions">
|
<div className="item-actions">
|
||||||
|
|||||||
@@ -135,3 +135,81 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.quickLinks {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||||
|
gap: $spacing-md;
|
||||||
|
}
|
||||||
|
|
||||||
|
.linkCard {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: $spacing-md;
|
||||||
|
padding: $spacing-md $spacing-lg;
|
||||||
|
background-color: var(--bg-secondary);
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
border-radius: $radius-lg;
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: var(--bg-hover);
|
||||||
|
border-color: var(--primary-color);
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.linkIcon {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 44px;
|
||||||
|
height: 44px;
|
||||||
|
border-radius: $radius-md;
|
||||||
|
background-color: var(--primary-color);
|
||||||
|
color: white;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
&.github {
|
||||||
|
background-color: #24292f;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.docs {
|
||||||
|
background-color: #10b981;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.linkContent {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.linkTitle {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: $spacing-xs;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--text-primary);
|
||||||
|
margin-bottom: 2px;
|
||||||
|
|
||||||
|
svg {
|
||||||
|
opacity: 0.5;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.linkDesc {
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Card } from '@/components/ui/Card';
|
import { Card } from '@/components/ui/Card';
|
||||||
import { Button } from '@/components/ui/Button';
|
import { Button } from '@/components/ui/Button';
|
||||||
|
import { IconGithub, IconBookOpen, IconExternalLink, IconCode } from '@/components/ui/icons';
|
||||||
import { useAuthStore, useConfigStore, useNotificationStore, useModelsStore } from '@/stores';
|
import { useAuthStore, useConfigStore, useNotificationStore, useModelsStore } from '@/stores';
|
||||||
import { apiKeysApi } from '@/services/api/apiKeys';
|
import { apiKeysApi } from '@/services/api/apiKeys';
|
||||||
import { classifyModels } from '@/utils/models';
|
import { classifyModels } from '@/utils/models';
|
||||||
@@ -148,6 +149,65 @@ export function SystemPage() {
|
|||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
|
<Card title={t('system_info.quick_links_title')}>
|
||||||
|
<p className={styles.sectionDescription}>{t('system_info.quick_links_desc')}</p>
|
||||||
|
<div className={styles.quickLinks}>
|
||||||
|
<a
|
||||||
|
href="https://github.com/router-for-me/CLIProxyAPI"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className={styles.linkCard}
|
||||||
|
>
|
||||||
|
<div className={`${styles.linkIcon} ${styles.github}`}>
|
||||||
|
<IconGithub size={22} />
|
||||||
|
</div>
|
||||||
|
<div className={styles.linkContent}>
|
||||||
|
<div className={styles.linkTitle}>
|
||||||
|
{t('system_info.link_main_repo')}
|
||||||
|
<IconExternalLink size={14} />
|
||||||
|
</div>
|
||||||
|
<div className={styles.linkDesc}>{t('system_info.link_main_repo_desc')}</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a
|
||||||
|
href="https://github.com/router-for-me/Cli-Proxy-API-Management-Center"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className={styles.linkCard}
|
||||||
|
>
|
||||||
|
<div className={`${styles.linkIcon} ${styles.github}`}>
|
||||||
|
<IconCode size={22} />
|
||||||
|
</div>
|
||||||
|
<div className={styles.linkContent}>
|
||||||
|
<div className={styles.linkTitle}>
|
||||||
|
{t('system_info.link_webui_repo')}
|
||||||
|
<IconExternalLink size={14} />
|
||||||
|
</div>
|
||||||
|
<div className={styles.linkDesc}>{t('system_info.link_webui_repo_desc')}</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a
|
||||||
|
href="https://help.router-for.me/"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className={styles.linkCard}
|
||||||
|
>
|
||||||
|
<div className={`${styles.linkIcon} ${styles.docs}`}>
|
||||||
|
<IconBookOpen size={22} />
|
||||||
|
</div>
|
||||||
|
<div className={styles.linkContent}>
|
||||||
|
<div className={styles.linkTitle}>
|
||||||
|
{t('system_info.link_docs')}
|
||||||
|
<IconExternalLink size={14} />
|
||||||
|
</div>
|
||||||
|
<div className={styles.linkDesc}>{t('system_info.link_docs_desc')}</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</Card>
|
||||||
|
|
||||||
<Card
|
<Card
|
||||||
title={t('system_info.models_title')}
|
title={t('system_info.models_title')}
|
||||||
extra={
|
extra={
|
||||||
|
|||||||
@@ -52,6 +52,37 @@ export function formatDateTime(date: string | Date): string {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将 Unix 时间戳(秒/毫秒/微秒/纳秒)格式化为本地时间字符串
|
||||||
|
*/
|
||||||
|
export function formatUnixTimestamp(value: unknown, locale?: string): string {
|
||||||
|
if (value === null || value === undefined || value === '') return '';
|
||||||
|
|
||||||
|
const asNumber = typeof value === 'number' ? value : Number(value);
|
||||||
|
const date = (() => {
|
||||||
|
if (!Number.isFinite(asNumber) || Number.isNaN(asNumber)) {
|
||||||
|
return new Date(String(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
const abs = Math.abs(asNumber);
|
||||||
|
|
||||||
|
// 秒:常见 10 位(~1e9)
|
||||||
|
if (abs < 1e11) return new Date(asNumber * 1000);
|
||||||
|
|
||||||
|
// 毫秒:常见 13 位(~1e12)
|
||||||
|
if (abs < 1e14) return new Date(asNumber);
|
||||||
|
|
||||||
|
// 微秒:常见 16 位(~1e15)
|
||||||
|
if (abs < 1e17) return new Date(Math.round(asNumber / 1000));
|
||||||
|
|
||||||
|
// 纳秒:常见 19 位(~1e18)
|
||||||
|
return new Date(Math.round(asNumber / 1e6));
|
||||||
|
})();
|
||||||
|
|
||||||
|
if (Number.isNaN(date.getTime())) return '';
|
||||||
|
return locale ? date.toLocaleString(locale) : date.toLocaleString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 格式化数字(添加千位分隔符)
|
* 格式化数字(添加千位分隔符)
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user