添加Docker自包含部署分支
- 新增 Seg_Server_Docker 自包含部署内容,包含前后端、FastAPI、Celery、PostgreSQL、Redis、MinIO、演示视频和 DICOM 数据。 - 保留 demo 数据以支持恢复演示出厂设置,排除 SAM 2.1 .pt 权重并在 README 中补充下载命令。 - 补充 GPU 部署、backend/worker 镜像复用、frpc/frps + NPM 公网域名反代部署说明。 - 在 .env/.env.example 中用 # XXXX 标注局域网和公网域名部署需要修改的配置项。 - 添加部署分支 .gitignore,忽略本地模型权重、构建产物、缓存和日志。
This commit is contained in:
56
src/components/ModelStatusBadge.tsx
Normal file
56
src/components/ModelStatusBadge.tsx
Normal file
@@ -0,0 +1,56 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Cpu, Loader2 } from 'lucide-react';
|
||||
import { getAiModelStatus, type AiRuntimeStatus } from '../lib/api';
|
||||
import { cn } from '../lib/utils';
|
||||
import { useStore } from '../store/useStore';
|
||||
|
||||
interface ModelStatusBadgeProps {
|
||||
compact?: boolean;
|
||||
}
|
||||
|
||||
export function ModelStatusBadge({ compact = false }: ModelStatusBadgeProps) {
|
||||
const aiModel = useStore((state) => state.aiModel);
|
||||
const [status, setStatus] = useState<AiRuntimeStatus | null>(null);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
setIsLoading(true);
|
||||
getAiModelStatus(aiModel)
|
||||
.then((data) => {
|
||||
if (!cancelled) setStatus(data);
|
||||
})
|
||||
.catch(() => {
|
||||
if (!cancelled) setStatus(null);
|
||||
})
|
||||
.finally(() => {
|
||||
if (!cancelled) setIsLoading(false);
|
||||
});
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [aiModel]);
|
||||
|
||||
const model = status?.models.find((item) => item.id === aiModel);
|
||||
const ready = Boolean(model?.available);
|
||||
const gpuReady = Boolean(status?.gpu.available);
|
||||
const label = compact
|
||||
? (gpuReady ? 'GPU' : 'CPU')
|
||||
: `${model?.label || aiModel.toUpperCase()} ${ready ? '可用' : '不可用'}`;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"inline-flex items-center gap-1.5 rounded border font-mono uppercase",
|
||||
compact ? "w-8 h-8 justify-center text-[9px]" : "px-2 py-0.5 text-[10px]",
|
||||
ready
|
||||
? "bg-emerald-500/10 text-emerald-400 border-emerald-500/20"
|
||||
: "bg-amber-500/10 text-amber-400 border-amber-500/20"
|
||||
)}
|
||||
title={model?.message || 'AI 模型状态读取中'}
|
||||
>
|
||||
{isLoading ? <Loader2 size={compact ? 12 : 10} className="animate-spin" /> : <Cpu size={compact ? 12 : 10} />}
|
||||
<span>{label}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user