From 2f577d9f01cacce6a99aff650e22295793ac3bf9 Mon Sep 17 00:00:00 2001 From: Yinghao Fan Date: Wed, 29 Oct 2025 23:34:21 +0800 Subject: [PATCH 1/2] Enhance Docker setup: Add shared volume for frontend files and update Dockerfile for dependencies Changes: - Updated `docker-compose.yml` to include a new shared volume `frontend-dist` for frontend files. - Modified the `nofx` service command to copy frontend files to the shared volume. - Updated `Dockerfile` to use Go 1.25 and added necessary build dependencies for TA-Lib installation. These changes improve the Docker environment by facilitating shared access to frontend assets and ensuring the build process is up-to-date with the latest Go version. --- Dockerfile | 32 ++++++++++++++++++++++++++------ docker-compose.yml | 7 ++++++- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index d7327035..95467a0c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,30 @@ # Multi-stage build for NOFX AI Trading System -FROM golang:1.24-alpine AS backend-builder +FROM golang:1.25-alpine AS backend-builder # Install build dependencies including TA-Lib -RUN apk add --no-cache \ +RUN apk update && \ + apk add --no-cache \ git \ make \ gcc \ g++ \ musl-dev \ wget \ - tar + tar \ + autoconf \ + automake # Install TA-Lib RUN wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz && \ tar -xzf ta-lib-0.4.0-src.tar.gz && \ cd ta-lib && \ + if [ "$(uname -m)" = "aarch64" ]; then \ + CONFIG_GUESS=$(find /usr/share -name config.guess | head -1) && \ + CONFIG_SUB=$(find /usr/share -name config.sub | head -1) && \ + cp "$CONFIG_GUESS" config.guess && \ + cp "$CONFIG_SUB" config.sub && \ + chmod +x config.guess config.sub; \ + fi && \ ./configure --prefix=/usr && \ make && \ make install && \ @@ -56,8 +66,9 @@ RUN npm run build # Final stage FROM alpine:latest -# Install runtime dependencies -RUN apk add --no-cache \ +# Update package index and install runtime dependencies +RUN apk update && \ + apk add --no-cache \ ca-certificates \ tzdata \ wget \ @@ -65,12 +76,21 @@ RUN apk add --no-cache \ make \ gcc \ g++ \ - musl-dev + musl-dev \ + autoconf \ + automake # Install TA-Lib runtime RUN wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz && \ tar -xzf ta-lib-0.4.0-src.tar.gz && \ cd ta-lib && \ + if [ "$(uname -m)" = "aarch64" ]; then \ + CONFIG_GUESS=$(find /usr/share -name config.guess | head -1) && \ + CONFIG_SUB=$(find /usr/share -name config.sub | head -1) && \ + cp "$CONFIG_GUESS" config.guess && \ + cp "$CONFIG_SUB" config.sub && \ + chmod +x config.guess config.sub; \ + fi && \ ./configure --prefix=/usr && \ make && \ make install && \ diff --git a/docker-compose.yml b/docker-compose.yml index a4b35310..7d4a7f78 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,7 @@ services: - ./config.json:/app/config.json:ro - ./decision_logs:/app/decision_logs - /etc/localtime:/etc/localtime:ro # 同步主机时间 + - frontend-dist:/app/web/dist-shared:rw # 共享前端文件 environment: - TZ=Asia/Shanghai # 使用中国时区 networks: @@ -24,6 +25,7 @@ services: timeout: 10s retries: 3 start_period: 60s + command: sh -c "cp -r /app/web/dist/* /app/web/dist-shared/ 2>/dev/null || true && exec ./nofx" # Frontend (Nginx) nofx-frontend: @@ -33,13 +35,16 @@ services: ports: - "3000:80" volumes: - - ./web/dist:/usr/share/nginx/html:ro + - frontend-dist:/usr/share/nginx/html:ro - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro networks: - nofx-network depends_on: - nofx +volumes: + frontend-dist: + networks: nofx-network: driver: bridge From 92e34f3732a26665b5ae7fa104c4b96f9310b7f5 Mon Sep 17 00:00:00 2001 From: tinkle-community Date: Wed, 29 Oct 2025 23:59:11 +0800 Subject: [PATCH 2/2] Fix: Add input_prompt display in decision cards Previously, the frontend DecisionRecord type was missing the input_prompt field that exists in the backend DecisionLog, causing the input context sent to AI to not be displayed in the UI. Changes: - Add input_prompt field to DecisionRecord interface in both type files - Add collapsible Input Prompt section in DecisionCard component - Display input_prompt before AI Chain of Thought with blue styling - Use same expand/collapse interaction pattern as CoT trace Now users can view both the input context and AI's reasoning process in the decision cards. Co-Authored-By: tinkle-community --- web/src/App.tsx | 20 ++++++++++++++++++++ web/src/types.ts | 1 + web/src/types/index.ts | 1 + 3 files changed, 22 insertions(+) diff --git a/web/src/App.tsx b/web/src/App.tsx index 70761155..8e4d412b 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -558,6 +558,7 @@ function StatCard({ // Decision Card Component with CoT Trace - Binance Style function DecisionCard({ decision, language }: { decision: DecisionRecord; language: Language }) { + const [showInputPrompt, setShowInputPrompt] = useState(false); const [showCoT, setShowCoT] = useState(false); return ( @@ -581,6 +582,25 @@ function DecisionCard({ decision, language }: { decision: DecisionRecord; langua + {/* Input Prompt - Collapsible */} + {decision.input_prompt && ( +
+ + {showInputPrompt && ( +
+ {decision.input_prompt} +
+ )} +
+ )} + {/* AI Chain of Thought - Collapsible */} {decision.cot_trace && (
diff --git a/web/src/types.ts b/web/src/types.ts index c61eca80..fbc224bc 100644 --- a/web/src/types.ts +++ b/web/src/types.ts @@ -64,6 +64,7 @@ export interface AccountSnapshot { export interface DecisionRecord { timestamp: string; cycle_number: number; + input_prompt: string; cot_trace: string; decision_json: string; account_state: AccountSnapshot; diff --git a/web/src/types/index.ts b/web/src/types/index.ts index 94e59e9f..6e648e2f 100644 --- a/web/src/types/index.ts +++ b/web/src/types/index.ts @@ -56,6 +56,7 @@ export interface DecisionAction { export interface DecisionRecord { timestamp: string; cycle_number: number; + input_prompt: string; cot_trace: string; decision_json: string; account_state: {