Phase I - Session Blackboard + READ Layer: - SessionBlackboardService with Postgres-Only cache - DataProfileService for data overview generation - PicoInferenceService for LLM-driven PICO extraction - Frontend DataContextCard and VariableDictionaryPanel - E2E tests: 31/31 passed Phase II - Conversation Layer LLM + Intent Router: - ConversationService with SSE streaming - IntentRouterService (rule-first + LLM fallback, 6 intents) - SystemPromptService with 6-segment dynamic assembly - TokenTruncationService for context management - ChatHandlerService as unified chat entry - Frontend SSAChatPane and useSSAChat hook - E2E tests: 38/38 passed Phase III - Method Consultation + AskUser Standardization: - ToolRegistryService with Repository Pattern - MethodConsultService with DecisionTable + LLM enhancement - AskUserService with global interrupt handling - Frontend AskUserCard component - E2E tests: 13/13 passed Phase IV - Dialogue-Driven Analysis + QPER Integration: - ToolOrchestratorService (plan/execute/report) - analysis_plan SSE event for WorkflowPlan transmission - Dual-channel confirmation (ask_user card + workspace button) - PICO as optional hint for LLM parsing - E2E tests: 25/25 passed R Statistics Service: - 5 new R tools: anova_one, baseline_table, fisher, linear_reg, wilcoxon - Enhanced guardrails and block helpers - Comprehensive test suite (run_all_tools_test.js) Documentation: - Updated system status document (v5.9) - Updated SSA module status and development plan (v1.8) Total E2E: 107/107 passed (Phase I: 31, Phase II: 38, Phase III: 13, Phase IV: 25) Co-authored-by: Cursor <cursoragent@cursor.com>
70 lines
1.5 KiB
Docker
70 lines
1.5 KiB
Docker
FROM rocker/r-ver:4.3
|
||
|
||
LABEL maintainer="dev-team@aiclinicalresearch.com"
|
||
LABEL version="1.0.1"
|
||
LABEL description="SSA-Pro R Statistics Service"
|
||
|
||
# 安装系统依赖(包括 R 包编译所需的库)
|
||
RUN apt-get update && apt-get install -y \
|
||
libcurl4-openssl-dev \
|
||
libssl-dev \
|
||
libxml2-dev \
|
||
libsodium-dev \
|
||
zlib1g-dev \
|
||
libnlopt-dev \
|
||
liblapack-dev \
|
||
libblas-dev \
|
||
gfortran \
|
||
pkg-config \
|
||
cmake \
|
||
curl \
|
||
&& rm -rf /var/lib/apt/lists/*
|
||
|
||
# 直接安装 R 包(简化方案,避免 renv 版本冲突)
|
||
RUN R -e "install.packages(c( \
|
||
'plumber', \
|
||
'jsonlite', \
|
||
'ggplot2', \
|
||
'glue', \
|
||
'dplyr', \
|
||
'tidyr', \
|
||
'base64enc', \
|
||
'yaml', \
|
||
'car', \
|
||
'httr', \
|
||
'scales', \
|
||
'gridExtra', \
|
||
'gtsummary', \
|
||
'gt', \
|
||
'broom' \
|
||
), repos='https://cloud.r-project.org/', Ncpus=2)"
|
||
|
||
# ===== 安全加固:创建非特权用户 =====
|
||
RUN useradd -m -s /bin/bash appuser
|
||
|
||
WORKDIR /app
|
||
|
||
# 复制应用代码
|
||
COPY plumber.R plumber.R
|
||
COPY utils/ utils/
|
||
COPY tools/ tools/
|
||
COPY tests/ tests/
|
||
|
||
# 设置目录权限
|
||
RUN chown -R appuser:appuser /app
|
||
|
||
# ===== 切换到非特权用户 =====
|
||
USER appuser
|
||
|
||
EXPOSE 8080
|
||
|
||
# 环境变量
|
||
ENV DEV_MODE="false"
|
||
|
||
# 健康检查
|
||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||
CMD curl -f http://localhost:8080/health || exit 1
|
||
|
||
# 启动服务(不清理 /tmp,避免权限问题)
|
||
CMD ["R", "-e", "plumber::plumb('plumber.R')$run(host='0.0.0.0', port=8080)"]
|