feat: 更新 Dockerfile 和 docker-compose.yml,使用清华镜像源,升级 CVAT 版本,优化环境配置

fix: 清理飞书配置占位符,增强错误处理,确保前端不暴露内部错误信息
feat: 在标注服务中添加上传错误处理,优化 CVAT 状态查询
feat: 更新 AnnotationPage 以显示上传状态和错误信息,增强用户体验
feat: 登录页面添加重定向功能,优化用户登录流程
refactor: 删除 tsconfig.tsbuildinfo 文件,清理不必要的构建信息
This commit is contained in:
2026-07-15 09:18:53 +08:00
parent 7f3b84faf0
commit 20073eaa59
10 changed files with 150 additions and 30 deletions

View File

@@ -9,6 +9,8 @@ interface CVATStatus {
cvat_status?: string;
campaign_id: string;
error?: string;
image_count?: number;
upload_error?: string;
}
interface MyTaskItem {
@@ -44,6 +46,7 @@ export const AnnotationPage: React.FC = () => {
const [syncing, setSyncing] = useState(false);
const [fetchError, setFetchError] = useState<string | null>(null);
const [syncHint, setSyncHint] = useState<string>("CVAT 保存后约 45 秒自动同步");
const [refreshKey, setRefreshKey] = useState(0);
const syncInFlight = useRef(false);
const [myTasks, setMyTasks] = useState<MyTaskItem[]>([]);
@@ -102,7 +105,7 @@ export const AnnotationPage: React.FC = () => {
poll();
const interval = setInterval(poll, 10000);
return () => { cancelled = true; clearInterval(interval); };
}, [campaignId]);
}, [campaignId, refreshKey]);
useEffect(() => {
if (!status?.cvat_job_url) return;
@@ -226,14 +229,44 @@ export const AnnotationPage: React.FC = () => {
}
if (!status.cvat_job_url) {
const hasError = !!status.upload_error;
const isUploadFailed = hasError || status.cvat_status === "upload_failed";
return (
<div className="flex items-center justify-center flex-1 min-h-[60vh] bg-gray-900 text-white">
<div className="text-center max-w-md">
<div className="text-4xl mb-4"></div>
<p className="mb-2">CVAT Job </p>
<button onClick={() => history.push(backPath)} className="mt-4 px-4 py-2 bg-blue-600 rounded hover:bg-blue-700">
</button>
<div className="text-4xl mb-4">{isUploadFailed ? "❌" : "⏳"}</div>
{isUploadFailed ? (
<>
<p className="mb-2 text-red-400 font-medium">CVAT Job </p>
<p className="text-sm text-gray-400 mb-4">
{hasError
? status.upload_error!.replace(/_/g, " ").replace("UPLOAD FAILED", "上传失败").replace("NO IMAGES", "未找到图片").replace("SETUP FAILED", "准备失败")
: "图片上传失败,请检查 CVAT 服务状态"}
</p>
</>
) : (
<>
<p className="mb-2">CVAT Job </p>
<p className="text-sm text-gray-400 mb-4">
{status.image_count ? `(共 ${status.image_count} 张)` : ""}
</p>
</>
)}
<div className="flex gap-3 justify-center">
<button
onClick={() => { setLoading(true); setFetchError(null); setRefreshKey(k => k + 1); }}
className="px-4 py-2 bg-blue-600 rounded hover:bg-blue-700"
>
</button>
<button
onClick={() => history.push(backPath)}
className="px-4 py-2 bg-gray-600 rounded hover:bg-gray-500"
>
</button>
</div>
</div>
</div>
);

View File

@@ -1,4 +1,5 @@
import React, { useState } from "react";
import { useHistory } from "react-router-dom";
import { useAuth } from "@/app/AuthContext";
import { Button } from "@/components/ui/Button";
@@ -6,6 +7,7 @@ const LOGIN_BG = "/login-bg.png";
export const LoginPage: React.FC = () => {
const { authConfig, loginDev, loginFeishu, loading } = useAuth();
const history = useHistory();
const [devName, setDevName] = useState("开发用户");
const [loggingIn, setLoggingIn] = useState(false);
@@ -55,6 +57,7 @@ export const LoginPage: React.FC = () => {
setLoggingIn(true);
try {
await loginDev(devName);
history.push("/");
} catch {
// error handled by AuthContext
}

View File

@@ -1 +0,0 @@
{"root":["./src/main.tsx","./src/vite-env.d.ts","./src/app/AuthContext.tsx","./src/app/HsapApp.tsx","./src/app/MainShell.tsx","./src/app/Sidebar.tsx","./src/app/hsap-api.ts","./src/components/AssignCountControl.tsx","./src/components/AssignUserSelect.tsx","./src/components/BboxScatter.tsx","./src/components/ClassCountBars.tsx","./src/components/ClassCountPie.tsx","./src/components/ClassCountRadar.tsx","./src/components/ListPaginationBar.tsx","./src/components/ModuleGuard.tsx","./src/components/PageQueryState.tsx","./src/components/SplitCountsBars.tsx","./src/components/ui/Badge.tsx","./src/components/ui/Button.tsx","./src/components/ui/Userpic.tsx","./src/lib/chartStats.ts","./src/lib/dmsCatalog.ts","./src/lib/permissions.ts","./src/lib/types.ts","./src/modules/fleet/FleetShell.tsx","./src/modules/fleet/pages/DashboardPage.tsx","./src/modules/fleet/pages/LiveMapPage.tsx","./src/modules/fleet/pages/TboxConfigPage.tsx","./src/modules/fleet/pages/TripRecordsPage.tsx","./src/modules/fleet/pages/VehiclesPage.tsx","./src/modules/labeling/LabelingShell.tsx","./src/modules/labeling/pages/AnnotationPage.tsx","./src/modules/labeling/pages/CampaignsPage.tsx","./src/modules/labeling/pages/CatalogPage.tsx","./src/modules/labeling/pages/DashboardPage.tsx","./src/modules/labeling/pages/DeliveriesPage.tsx","./src/modules/labeling/pages/ExportPage.tsx","./src/modules/labeling/pages/MyTasksPage.tsx","./src/modules/labeling/pages/QualityReviewPage.tsx","./src/modules/labeling/pages/SimulationStudioPage.tsx","./src/modules/labeling/pages/WorkbenchPage.tsx","./src/modules/models/ModelsShell.tsx","./src/modules/models/pages/DatasetVersionsPage.tsx","./src/modules/models/pages/EvaluationPage.tsx","./src/modules/models/pages/OverviewPage.tsx","./src/modules/models/pages/PromotionPage.tsx","./src/modules/models/pages/TrainingRecordsPage.tsx","./src/modules/models/pages/TrainingSubmitPage.tsx","./src/modules/system/SystemShell.tsx","./src/modules/system/pages/AuditDetailPage.tsx","./src/modules/system/pages/AuditLogPage.tsx","./src/modules/system/pages/AuditQueuePage.tsx","./src/modules/system/pages/ExecutionLogsPage.tsx","./src/modules/system/pages/JobMonitorPage.tsx","./src/modules/system/pages/UserManagementPage.tsx","./src/pages/LoginPage.tsx"],"version":"5.9.3"}