mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-09 22:10:57 +08:00
- Add assistant package with AI Agent runtime - agent.go: Core agent loop with tool calling - session.go: Conversation memory management - tool.go: Tool interface and base implementation - trading_tools.go: Trading-specific tools (13 tools) - prompts.go: Trading expert system prompts (EN/ZH) - Add telegram package for Telegram bot integration - bot.go: Telegram bot with rate limiting & access control - config.go: Environment-based configuration - Update main.go to initialize Telegram bot on startup - Update .env.example with new configuration options - Add gopkg.in/telebot.v3 dependency Trading tools available: - Query: get_balance, get_positions, list_traders, get_trader_status - Control: start_trader, stop_trader - Trading: get_market_price, open_long, open_short, close_position - Config: list_strategies, list_exchanges, list_ai_models
109 lines
3.0 KiB
Plaintext
109 lines
3.0 KiB
Plaintext
# NOFX Environment Variables Template
|
||
# Copy this file to .env and modify the values as needed
|
||
|
||
# ===========================================
|
||
# Server Configuration
|
||
# ===========================================
|
||
|
||
# Backend API server port
|
||
NOFX_BACKEND_PORT=8080
|
||
|
||
# Frontend web interface port
|
||
NOFX_FRONTEND_PORT=3000
|
||
|
||
# Timezone
|
||
NOFX_TIMEZONE=Asia/Shanghai
|
||
|
||
# ===========================================
|
||
# Authentication (Required)
|
||
# ===========================================
|
||
|
||
# JWT signing secret (any random string, at least 32 characters)
|
||
# Generate with: openssl rand -base64 32
|
||
JWT_SECRET=your-jwt-secret-change-this-in-production
|
||
|
||
# ===========================================
|
||
# Encryption Keys (Required)
|
||
# ===========================================
|
||
|
||
# AES-256 data encryption key (Base64 encoded, 32 bytes)
|
||
# Used for encrypting sensitive data in database (API keys, secrets)
|
||
# Generate with: openssl rand -base64 32
|
||
DATA_ENCRYPTION_KEY=your-base64-encoded-32-byte-key
|
||
|
||
# RSA private key for client-server encryption (PEM format)
|
||
# Used for end-to-end encryption of sensitive data from browser
|
||
# Generate with: openssl genrsa 2048
|
||
# Note: Replace newlines with \n for single-line format
|
||
RSA_PRIVATE_KEY=-----BEGIN RSA PRIVATE KEY-----\nYOUR_KEY_HERE\n-----END RSA PRIVATE KEY-----
|
||
|
||
# ===========================================
|
||
# Security Options
|
||
# ===========================================
|
||
|
||
# Transport encryption for API keys (default: false)
|
||
# When enabled, browser uses Web Crypto API to encrypt API keys before sending
|
||
# Requires HTTPS or localhost to work
|
||
# Set to true for enhanced security (HTTPS required)
|
||
# Set to false for easier deployment (HTTP/IP access allowed)
|
||
TRANSPORT_ENCRYPTION=false
|
||
|
||
# ===========================================
|
||
# Telegram AI Assistant (NEW - moltbot-nofx)
|
||
# ===========================================
|
||
|
||
# Telegram Bot Token (get from @BotFather)
|
||
# This enables the AI trading assistant via Telegram
|
||
TELEGRAM_BOT_TOKEN=
|
||
|
||
# Allowed users (comma-separated Telegram user IDs)
|
||
# Leave empty to allow all users (not recommended for production)
|
||
# Get your ID from @userinfobot
|
||
TELEGRAM_ALLOWED_USERS=
|
||
|
||
# Admin users (comma-separated Telegram user IDs)
|
||
# Admins can manage bot settings
|
||
TELEGRAM_ADMIN_USERS=
|
||
|
||
# Rate limit (messages per minute per user)
|
||
TELEGRAM_RATE_LIMIT=30
|
||
|
||
# Default language: "en" or "zh"
|
||
TELEGRAM_LANGUAGE=zh
|
||
|
||
# ===========================================
|
||
# AI Model Configuration (for Assistant)
|
||
# ===========================================
|
||
|
||
# DeepSeek (recommended - cost-effective)
|
||
DEEPSEEK_API_KEY=
|
||
DEEPSEEK_API_URL=
|
||
DEEPSEEK_MODEL=deepseek-chat
|
||
|
||
# Claude (optional alternative)
|
||
CLAUDE_API_KEY=
|
||
CLAUDE_API_URL=
|
||
CLAUDE_MODEL=
|
||
|
||
# OpenAI (optional alternative)
|
||
OPENAI_API_KEY=
|
||
OPENAI_API_URL=
|
||
OPENAI_MODEL=
|
||
|
||
# Qwen (optional alternative)
|
||
QWEN_API_KEY=
|
||
QWEN_API_URL=
|
||
QWEN_MODEL=
|
||
|
||
DB_TYPE=postgres
|
||
DB_HOST=10.
|
||
DB_PORT=5432
|
||
DB_USER=nofx_user
|
||
DB_PASSWORD=
|
||
DB_NAME=nofx
|
||
DB_SSLMODE=disable
|
||
|
||
|
||
# 数据库配置 - SQLite(默认)
|
||
DB_TYPE=sqlite
|
||
DB_PATH=data/data.db |