Merge branch 'tinkle-community:main' into main

This commit is contained in:
d0lwl0b
2025-10-30 00:19:12 +08:00
committed by GitHub
5 changed files with 54 additions and 7 deletions
+26 -6
View File
@@ -1,20 +1,30 @@
# Multi-stage build for NOFX AI Trading System # 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 # Install build dependencies including TA-Lib
RUN apk add --no-cache \ RUN apk update && \
apk add --no-cache \
git \ git \
make \ make \
gcc \ gcc \
g++ \ g++ \
musl-dev \ musl-dev \
wget \ wget \
tar tar \
autoconf \
automake
# Install TA-Lib # Install TA-Lib
RUN wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz && \ 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 && \ tar -xzf ta-lib-0.4.0-src.tar.gz && \
cd ta-lib && \ 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 && \ ./configure --prefix=/usr && \
make && \ make && \
make install && \ make install && \
@@ -56,8 +66,9 @@ RUN npm run build
# Final stage # Final stage
FROM alpine:latest FROM alpine:latest
# Install runtime dependencies # Update package index and install runtime dependencies
RUN apk add --no-cache \ RUN apk update && \
apk add --no-cache \
ca-certificates \ ca-certificates \
tzdata \ tzdata \
wget \ wget \
@@ -65,12 +76,21 @@ RUN apk add --no-cache \
make \ make \
gcc \ gcc \
g++ \ g++ \
musl-dev musl-dev \
autoconf \
automake
# Install TA-Lib runtime # Install TA-Lib runtime
RUN wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz && \ 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 && \ tar -xzf ta-lib-0.4.0-src.tar.gz && \
cd ta-lib && \ 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 && \ ./configure --prefix=/usr && \
make && \ make && \
make install && \ make install && \
+6 -1
View File
@@ -14,6 +14,7 @@ services:
- ./config.json:/app/config.json:ro - ./config.json:/app/config.json:ro
- ./decision_logs:/app/decision_logs - ./decision_logs:/app/decision_logs
- /etc/localtime:/etc/localtime:ro # 同步主机时间 - /etc/localtime:/etc/localtime:ro # 同步主机时间
- frontend-dist:/app/web/dist-shared:rw # 共享前端文件
environment: environment:
- TZ=${NOFX_TIMEZONE:-Asia/Shanghai} # 使用中国时区 - TZ=${NOFX_TIMEZONE:-Asia/Shanghai} # 使用中国时区
networks: networks:
@@ -24,6 +25,7 @@ services:
timeout: 10s timeout: 10s
retries: 3 retries: 3
start_period: 60s start_period: 60s
command: sh -c "cp -r /app/web/dist/* /app/web/dist-shared/ 2>/dev/null || true && exec ./nofx"
# Frontend (Nginx) # Frontend (Nginx)
nofx-frontend: nofx-frontend:
@@ -33,13 +35,16 @@ services:
ports: ports:
- "${NOFX_FRONTEND_PORT:-3000}:80" - "${NOFX_FRONTEND_PORT:-3000}:80"
volumes: volumes:
- ./web/dist:/usr/share/nginx/html:ro - frontend-dist:/usr/share/nginx/html:ro
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
networks: networks:
- nofx-network - nofx-network
depends_on: depends_on:
- nofx - nofx
volumes:
frontend-dist:
networks: networks:
nofx-network: nofx-network:
driver: bridge driver: bridge
+20
View File
@@ -558,6 +558,7 @@ function StatCard({
// Decision Card Component with CoT Trace - Binance Style // Decision Card Component with CoT Trace - Binance Style
function DecisionCard({ decision, language }: { decision: DecisionRecord; language: Language }) { function DecisionCard({ decision, language }: { decision: DecisionRecord; language: Language }) {
const [showInputPrompt, setShowInputPrompt] = useState(false);
const [showCoT, setShowCoT] = useState(false); const [showCoT, setShowCoT] = useState(false);
return ( return (
@@ -581,6 +582,25 @@ function DecisionCard({ decision, language }: { decision: DecisionRecord; langua
</div> </div>
</div> </div>
{/* Input Prompt - Collapsible */}
{decision.input_prompt && (
<div className="mb-3">
<button
onClick={() => setShowInputPrompt(!showInputPrompt)}
className="flex items-center gap-2 text-sm transition-colors"
style={{ color: '#60a5fa' }}
>
<span className="font-semibold">📥 {t('inputPrompt', language)}</span>
<span className="text-xs">{showInputPrompt ? t('collapse', language) : t('expand', language)}</span>
</button>
{showInputPrompt && (
<div className="mt-2 rounded p-4 text-sm font-mono whitespace-pre-wrap max-h-96 overflow-y-auto" style={{ background: '#0B0E11', border: '1px solid #2B3139', color: '#EAECEF' }}>
{decision.input_prompt}
</div>
)}
</div>
)}
{/* AI Chain of Thought - Collapsible */} {/* AI Chain of Thought - Collapsible */}
{decision.cot_trace && ( {decision.cot_trace && (
<div className="mb-3"> <div className="mb-3">
+1
View File
@@ -64,6 +64,7 @@ export interface AccountSnapshot {
export interface DecisionRecord { export interface DecisionRecord {
timestamp: string; timestamp: string;
cycle_number: number; cycle_number: number;
input_prompt: string;
cot_trace: string; cot_trace: string;
decision_json: string; decision_json: string;
account_state: AccountSnapshot; account_state: AccountSnapshot;
+1
View File
@@ -56,6 +56,7 @@ export interface DecisionAction {
export interface DecisionRecord { export interface DecisionRecord {
timestamp: string; timestamp: string;
cycle_number: number; cycle_number: number;
input_prompt: string;
cot_trace: string; cot_trace: string;
decision_json: string; decision_json: string;
account_state: { account_state: {