wangdl 8663ceba66
Some checks failed
Deploy Admin Frontend / build-and-deploy (push) Failing after 10s
feat: HTTP 层重构 + API 抽离 + 状态管理优化 + 路由修复
- HTTP 层:安装 axios,创建 lib/api-client.ts 统一拦截器
- API 层:创建 33 个 api/*.ts 文件,所有页面迁移完成
- DataPages.tsx 拆分为 10 个独立文件
- message 导入统一为 App.useApp()
- 新增 StaticAntdProvider 全局消息/通知
- 全局 HTTP 错误/成功提示(notification.error/success)
- learning 路由 /learning → /learning/dashboard 修复选中 bug
- 学习会话页面优化(移除 ID 列、加批量删除、后端排序)
- 文档导入页面重构(知识库筛选、批量重新解析)
- 删除旧 service 文件 10 个(admin-api、billing-api 等)
- antd App 包裹根组件

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-01 22:44:51 +08:00

179 lines
4.4 KiB
TypeScript

// ── Admin learning data display labels ──
export const eventTypeLabels: Record<string, string> = {
material_opened: '打开资料',
material_closed: '关闭资料',
position_changed: '位置变化',
heartbeat: '心跳',
marked_as_read: '标记已读',
};
export const eventStatusLabels: Record<string, string> = {
processed: '已处理',
failed: '失败',
duplicate: '重复',
pending: '待处理',
warning: '警告',
};
export const sessionStatusLabels: Record<string, string> = {
active: '活跃',
interrupted: '中断',
completed: '已完成',
};
export const progressStatusLabels: Record<string, string> = {
read: '已读',
reading: '阅读中',
completed: '已完成',
not_started: '未开始',
};
export const targetTypeLabels: Record<string, string> = {
knowledge_source: '知识资料',
temporary_file: '临时文件',
};
export const recordTypeLabels: Record<string, string> = {
reading: '阅读',
session: '会话',
};
export const recordTitleLabels: Record<string, string> = {
'Reading started': '开始阅读',
'Reading ended': '结束阅读',
'Marked as read': '标记已读',
'开始阅读': '开始阅读',
'结束阅读': '结束阅读',
'标记已读': '标记已读',
};
export const sessionModeLabels: Record<string, string> = {
study: '学习',
review: '复习',
reading: '阅读',
quiz: '测验',
};
export const parseStatusLabels: Record<string, string> = {
pending: '待解析',
processing: '解析中',
completed: '已解析',
failed: '解析失败',
};
// ── Review ──
export const reviewStatusLabels: Record<string, string> = {
active: '活跃',
suspended: '暂停',
completed: '已完成',
};
export const scheduleStateLabels: Record<string, string> = {
new: '新卡片',
learning: '学习中',
review: '复习中',
relearning: '重新学习',
};
export const difficultyLabels: Record<string, string> = {
easy: '简单',
medium: '中等',
hard: '困难',
};
// ── Import ──
export const importStatusLabels: Record<string, string> = {
QUEUED: '排队中',
CLAIMED: '已认领',
DOWNLOADING: '下载中',
PARSING: '解析中',
OCR_PROCESSING: 'OCR 处理中',
VISION_PROCESSING: '图像处理中',
CLEANING: '清洗中',
CHUNKING: '分段中',
EMBEDDING: '向量化中',
INDEXING: '索引中',
GENERATING_CANDIDATES: '生成候选中',
COMPLETED: '已完成',
FAILED: '失败',
FAILED_RETRYABLE: '失败(可重试)',
FAILED_FINAL: '永久失败',
// 兼容小写
completed: '已完成',
failed: '失败',
};
export const importStepLabels: Record<string, string> = {
QUEUED: '排队中',
CLAIMED: '已认领',
DOWNLOADING: '下载文件',
PARSING: '文档解析',
CLEANING: '文本清洗',
CHUNKING: '文本分段',
EMBEDDING: '向量化',
INDEXING: '写入索引',
GENERATING_CANDIDATES: 'AI 生成候选',
COMPLETED: '已完成',
FAILED: '失败',
FAILED_RETRYABLE: '失败(可重试)',
FAILED_FINAL: '永久失败',
};
// ── Admin / User ──
export const adminStatusLabels: Record<string, string> = {
ACTIVE: '正常',
DISABLED: '已禁用',
LOCKED: '已锁定',
};
export const userStatusLabels: Record<string, string> = {
active: '正常',
disabled: '已禁用',
deleted: '已注销',
};
// ── Knowledge ──
export const kbStatusLabels: Record<string, string> = { active: '正常' };
export const candidateStatusLabels: Record<string, string> = {
PENDING: '待审核',
ACCEPTED: '已通过',
REJECTED: '已拒绝',
};
// ── Hermes / Agent ──
export const agentTaskStatusLabels: Record<string, string> = {
pending: '待处理',
approved: '已批准',
rejected: '已拒绝',
};
export const artifactStatusLabels: Record<string, string> = {
draft: '草稿',
published: '已发布',
};
// ── Release ──
export const releaseStatusLabels: Record<string, string> = {
proposed: '提案中',
accepted: '已通过',
};
// ── Backup ──
export const backupStatusLabels: Record<string, string> = {
RUNNING: '运行中',
COMPLETED: '已完成',
FAILED: '失败',
};
// ── Secret ──
export const secretStatusLabels: Record<string, string> = {
active: '活跃',
expired: '已过期',
rotated: '已轮换',
revoked: '已撤销',
};
// ── Compliance ──
export const complianceStatusLabels: Record<string, string> = {
pending: '待处理',
approved: '已批准',
rejected: '已拒绝',
open: '待处理',
resolved: '已解决',
};