From d8a2f4bb5230f4759d4b6f4bc2befa86336f6f5e Mon Sep 17 00:00:00 2001 From: Rekey Date: Tue, 16 Jun 2026 12:29:23 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=BB=9F=E4=B8=80=20TypeORM=20CLI?= =?UTF-8?q?=20=E6=95=B0=E6=8D=AE=E6=BA=90=E9=85=8D=E7=BD=AE=EF=BC=8C?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E5=BA=9F=E5=BC=83=E5=88=97=E6=B8=85=E7=90=86?= =?UTF-8?q?=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - data/db/data-source-cli.cjs → .ts,复用 config 模块的 pgsql 配置 - 新增迁移 CleanupTradingPairDeprecatedColumns,删除 trading_pairs 表三个废弃列 - reasonix.toml: model 升级 deepseek-pro,启用中文 --- data/db/data-source-cli.ts | 39 +++++++++++++++++++ ...526-CleanupTradingPairDeprecatedColumns.js | 28 +++++++++++++ reasonix.toml | 8 ++-- 3 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 data/db/data-source-cli.ts create mode 100644 data/db/migrations/1781583054526-CleanupTradingPairDeprecatedColumns.js diff --git a/data/db/data-source-cli.ts b/data/db/data-source-cli.ts new file mode 100644 index 0000000..1b9847b --- /dev/null +++ b/data/db/data-source-cli.ts @@ -0,0 +1,39 @@ +/** + * TypeORM CLI 专用数据源配置 + * + * 直接复用 config 模块的 pgsql 配置(含校验), + * 专供 TypeORM CLI(Node.js / tsx)使用。 + * + * 使用方式: + * npx tsx node_modules/.bin/typeorm migration:run -d db/data-source-cli.ts + * npx tsx node_modules/.bin/typeorm migration:revert -d db/data-source-cli.ts + * npx tsx node_modules/.bin/typeorm migration:show -d db/data-source-cli.ts + */ +import { DataSource } from "typeorm"; +import { fileURLToPath } from "node:url"; +import { dirname } from "node:path"; +import { pgsql } from "../config"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const AppDataSource = new DataSource({ + type: "postgres", + host: pgsql.host, + port: pgsql.port, + database: pgsql.database, + username: pgsql.user, + password: pgsql.password, + entities: [__dirname + "/entities/*.{ts,js}"], + synchronize: false, + migrations: [__dirname + "/migrations/*.{ts,js}"], + extra: { + max: pgsql.max, + idleTimeoutMillis: pgsql.idleTimeoutMillis, + connectionTimeoutMillis: pgsql.connectionTimeoutMillis, + }, + logging: ["error", "warn"], +}); + +export default AppDataSource; + diff --git a/data/db/migrations/1781583054526-CleanupTradingPairDeprecatedColumns.js b/data/db/migrations/1781583054526-CleanupTradingPairDeprecatedColumns.js new file mode 100644 index 0000000..740fdab --- /dev/null +++ b/data/db/migrations/1781583054526-CleanupTradingPairDeprecatedColumns.js @@ -0,0 +1,28 @@ +/** + * Migration: 清理 TradingPair 表中已废弃的 K 线相关字段 + * + * 对应 Commit: b4c7636 + * 删除字段(实体已移除,TypeORM 不再引用): + * - kline_synthesis_enabled (BOOLEAN, DEFAULT TRUE) + * - kline_interval (VARCHAR(100), DEFAULT '1m') + * - kline_intervals (VARCHAR(100), DEFAULT '1m,...') + */ +export class CleanupTradingPairDeprecatedColumns1781583054526 { + async up(queryRunner) { + await queryRunner.query(` + ALTER TABLE trading_pairs + DROP COLUMN IF EXISTS kline_synthesis_enabled, + DROP COLUMN IF EXISTS kline_interval, + DROP COLUMN IF EXISTS kline_intervals + `); + } + + async down(queryRunner) { + await queryRunner.query(` + ALTER TABLE trading_pairs + ADD COLUMN kline_synthesis_enabled BOOLEAN NOT NULL DEFAULT TRUE, + ADD COLUMN kline_interval VARCHAR(100) NOT NULL DEFAULT '1m', + ADD COLUMN kline_intervals VARCHAR(100) NOT NULL DEFAULT '1m,3m,5m,15m,30m,1h,2h,4h,6h,8h,1d,1w,1mon' + `); + } +} diff --git a/reasonix.toml b/reasonix.toml index 5ff36d5..3f1766f 100644 --- a/reasonix.toml +++ b/reasonix.toml @@ -3,8 +3,8 @@ # Secrets come from the environment via api_key_env; never put keys here. config_version = 2 # schema marker for diagnostics; old versions may ignore it -default_model = "deepseek-flash" -# language = "zh" # ui/model language; empty = auto-detect from $LANG / $REASONIX_LANG +default_model = "deepseek-pro" +language = "zh" # ui/model language; empty = auto-detect from $LANG / $REASONIX_LANG [agent] # system_prompt = """...""" # omit to use the built-in prompt for this version @@ -13,8 +13,8 @@ max_steps = 0 # executor tool-call rounds; 0 = no limit planner_max_steps = 12 # planner read-only tool-call rounds; 0 = no limit temperature = 0.0 auto_plan = "off" # off|on; off keeps plan mode manual -# reasoning_language = "zh" # visible reasoning language: auto|zh|en -# auto_plan_classifier = "deepseek-flash" # optional; only used for borderline tasks +reasoning_language = "zh" # visible reasoning language: auto|zh|en +# auto_plan_classifier = "deepseek-pro" # optional; only used for borderline tasks soft_compact_ratio = 0.5 # notice only; keeps cache-first prefix intact compact_ratio = 0.8 # try compacting when prompt reaches this fraction compact_force_ratio = 0.9 # force compacting at this high-water mark