Summary: - PostgreSQL database migration to RDS completed (90MB SQL, 11 schemas) - Frontend Nginx Docker image built and pushed to ACR (v1.0, ~50MB) - Python microservice Docker image built and pushed to ACR (v1.0, 1.12GB) - Created 3 deployment documentation files Docker Configuration Files: - frontend-v2/Dockerfile: Multi-stage build with nginx:alpine - frontend-v2/.dockerignore: Optimize build context - frontend-v2/nginx.conf: SPA routing and API proxy - frontend-v2/docker-entrypoint.sh: Dynamic env injection - extraction_service/Dockerfile: Multi-stage build with Aliyun Debian mirror - extraction_service/.dockerignore: Optimize build context - extraction_service/requirements-prod.txt: Production dependencies (removed Nougat) Deployment Documentation: - docs/05-部署文档/00-部署进度总览.md: One-stop deployment status overview - docs/05-部署文档/07-前端Nginx-SAE部署操作手册.md: Frontend deployment guide - docs/05-部署文档/08-PostgreSQL数据库部署操作手册.md: Database deployment guide - docs/00-系统总体设计/00-系统当前状态与开发指南.md: Updated with deployment status Database Migration: - RDS instance: pgm-2zex1m2y3r23hdn5 (2C4G, PostgreSQL 15.0) - Database: ai_clinical_research - Schemas: 11 business schemas migrated successfully - Data: 3 users, 2 projects, 1204 literatures verified - Backup: rds_init_20251224_154529.sql (90MB) Docker Images: - Frontend: crpi-cd5ij4pjt65mweeo.cn-beijing.personal.cr.aliyuncs.com/ai-clinical/ai-clinical_frontend-nginx:v1.0 - Python: crpi-cd5ij4pjt65mweeo.cn-beijing.personal.cr.aliyuncs.com/ai-clinical/python-extraction:v1.0 Key Achievements: - Resolved Docker Hub network issues (using generic tags) - Fixed 30 TypeScript compilation errors - Removed Nougat OCR to reduce image size by 1.5GB - Used Aliyun Debian mirror to resolve apt-get network issues - Implemented multi-stage builds for optimization Next Steps: - Deploy Python microservice to SAE - Build Node.js backend Docker image - Deploy Node.js backend to SAE - Deploy frontend Nginx to SAE - End-to-end verification testing Status: Docker images ready, SAE deployment pending
92 lines
2.1 KiB
TypeScript
92 lines
2.1 KiB
TypeScript
/**
|
||
* Session状态轮询Hook(Postgres-Only架构)
|
||
*
|
||
* 功能:
|
||
* 1. 智能轮询任务状态(自动串行,防并发)
|
||
* 2. 状态变化时自动停止轮询
|
||
* 3. 组件卸载时自动清理
|
||
*
|
||
* 参考:ASL模块的 useScreeningTask
|
||
*/
|
||
|
||
import { useQuery } from '@tanstack/react-query';
|
||
import * as api from '../../../api/toolC';
|
||
|
||
interface UseSessionStatusOptions {
|
||
sessionId: string | null;
|
||
jobId: string | null;
|
||
enabled?: boolean;
|
||
}
|
||
|
||
/**
|
||
* 使用Session状态Hook
|
||
*
|
||
* @param sessionId - Session ID
|
||
* @param jobId - Job ID
|
||
* @param enabled - 是否启用轮询
|
||
* @returns 状态数据和控制方法
|
||
*/
|
||
export function useSessionStatus({
|
||
sessionId,
|
||
jobId,
|
||
enabled = true,
|
||
}: UseSessionStatusOptions) {
|
||
const { data, isLoading, error, refetch } = useQuery({
|
||
queryKey: ['sessionStatus', sessionId, jobId],
|
||
queryFn: async () => {
|
||
if (!sessionId || !jobId) {
|
||
throw new Error('sessionId or jobId is required');
|
||
}
|
||
const response = await api.getSessionStatus(sessionId, jobId);
|
||
return response.data;
|
||
},
|
||
enabled: enabled && !!sessionId && !!jobId,
|
||
refetchInterval: (query) => {
|
||
const status = query.state.data?.status;
|
||
|
||
// ✅ 完成或失败时停止轮询
|
||
if (status === 'ready' || status === 'error') {
|
||
return false;
|
||
}
|
||
|
||
// ✅ 处理中时每2秒轮询(React Query 自动保证串行)
|
||
return 2000;
|
||
},
|
||
staleTime: 0, // 始终视为过时,确保轮询生效
|
||
retry: 1, // 失败重试1次
|
||
});
|
||
|
||
// 解析状态数据
|
||
const statusInfo = data;
|
||
const status = statusInfo?.status || 'processing';
|
||
const progress = statusInfo?.progress || 0;
|
||
const session = statusInfo?.session;
|
||
|
||
// 判断各种状态
|
||
const isProcessing = status === 'processing';
|
||
const isReady = status === 'ready';
|
||
const isError = status === 'error';
|
||
|
||
return {
|
||
// 状态数据
|
||
status,
|
||
progress,
|
||
session,
|
||
|
||
// 状态标志
|
||
isProcessing,
|
||
isReady,
|
||
isError,
|
||
isLoading,
|
||
|
||
// 错误信息
|
||
error,
|
||
|
||
// 手动刷新
|
||
refetch,
|
||
};
|
||
}
|
||
|
||
|
||
|