v1.0.4
简体中文 (Simplified Chinese)
🚀 性能提升
- 引入全局统一的引擎资源共享及按需延迟加载(LazyLocalEngine)。支持以
fork()方式复刻引擎上下文,降低长时运行的跨对局开销。
🎨 UI/UX 增强
- 修复了因为熔断机制而导致的前端状态指示灯恢复错误(之前熔断关闭后指示灯依然处于回退状态,现已能正确切回在线模型状态)。
📝 文档更新
- 更新了 README 的视觉排版,包括新的部署文档、统一的徽章样式以及详细的系统架构图示例。
⚡ 改进与优化
- 新增
ReplayEngine,重构并独立了录像回放状态下的模拟事件处理。 - 新增
NullEngine,作为各引擎失效或不可用时的最终备用降级方案。 - 核心事件循环:重构
application后端事件驱动机制,移除老旧虚假的 batch 处理流转机制,全面改用高效的单一事件驱动形态。 - 状态追踪解耦:重构
StateTracker,将核心判定与状态追踪逻辑从过时的mjai.bot包脱绑,全面改用原生的libriichi.PlayerState跟踪场况以提高稳固性。 - 代码库规范化:大规模采用
match-case替代旧有复杂的连环if/elif条件判断语句,提高代码可读性。 - 引入全局
MahjongConstants聚合和管理麻将牌字符常量,取代散落的常量碎片。
🛠️ 维护与重构
- 模块重构:
mjai_bot模块在本次迭代内历经多次重构与打磨,最终定型了当前的健壮架构。引擎加载与预处理剥离进Factory与Provider,网络客户端完成彻底解耦。 - 类型安全:重构并清理了核心层的
Any/dict/object类型声明,全面利用TypedDict及Protocol保障编译推导与静态类型安全。 - 异常日志治理:清除了所有不规范的模糊
Exception或泛用异常捕获,转为针对性的错误拦截,并移除了因为滥用而导致的无意义崩溃堆栈日志刷屏。
🐛 问题修复
- 核心功能:修复了在一番街平台中断线重连时,因数据解析不完善导致无法获取并恢复对局信息的 bug。
- 核心功能:修复了立直前瞻动作分析偶发性执行失败的 bug。
🧪 测试与质量
- 使用 pytest 新增了核心集成测试集,大幅补全了针对
EngineProvider、网络断线重连边界情况以及推理流程的安全防线。
📦 更新依赖
- 升级了前端与 Electron 端大量依赖链,包含 eslint 规则更新及 Github Actions cache v5 构建依赖升级。
English
🚀 Performance Improvements
- Implemented unified engine resource caching and lazy loading (LazyLocalEngine). Introduced
fork()context cloning to reduce instantiation overheads across continuous games.
🎨 UI/UX Enhancements
- Fixed the engine status indicator not properly transitioning away from the Fallback state once the system recovers from a circuit break.
📝 Documentation
- Modernized README visuals, introducing clear architectural diagrams, updated badges, and streamlined deployment guides.
⚡ Improvements & Refinements
- Added
ReplayEngineto handle event simulations modularly during replay mode. - Added
NullEngineto act as a definitive final fallback when other primary engines fail. - Core Event Loop: Refactored the
applicationmessage dispatch array, changing from a mock batch-processing design to a streamlined, highly efficient single-event loop. - State Tracking: Overhauled
StateTrackermethodologies. Repurposed to rely natively onlibriichi.PlayerStatetracking game state instead of using the obsoletemjai.botpackage. - Introduced modern
match-casestatements globally to optimize and simplify complexif/elsebranchs. - Unified decentralized Mahjong tile strings into
MahjongConstants.
🛠️ Maintenance & Refactoring
- Core Overhaul: The
mjai_botmodule went through heavy aggressive iterations and finalized its current architectural design. Network layers, engine factories, and local inference provider bridging contexts are elegantly separated. - Type Safety: Eradicated extensive vague bounds like
Any,object, or raw dictionaries directly in favor ofProtocolboundaries and strictly typedTypedDictshapes. - Exception Handling: Suppressed disorganized traceback exception logging noise while replacing overly broad
except Exceptionclauses with pinpointed, explicit assertions and targeted checks.
🐛 Bug Fixes
- Critical: Fixed a bug on the Riichi City platform where reconnecting post-disconnect failed to restore or retrieve valid game session status.
- Critical: Fixed sporadic execution failures surrounding the LookaheadBot during Riichi simulation states.
🧪 Testing & Quality
- Enriched the pytest suite with comprehensive
EngineProvidermocking, network reconnect edge cases, and robust inference flow validations.
📦 Dependency Updates
- Upgraded frontend and Electron dependencies, including major eslint package upgrades and GitHub Action cache definitions (v5).
Full Changelog: v1.0.3...v1.0.4