Repository navigation
Releases: Qixuan112/Tale-AI-legacy
Releases · Qixuan112/Tale-AI-legacy
Release list
Tale-AI v0.20.0 - StandardPipeline 架构重构完成
Tale-AI v0.20.0 - StandardPipeline 架构重构完成
重大更新
StandardPipeline 系统(Issue #180)
将 250 行单体消息处理函数重构为 9 个独立 Stage:
- BuildUserInputStage - 用户输入格式化
- NameMappingStage - 昵称→ID 映射
- SessionInitStage - 会话初始化
- ContextBuildStage - 上下文构建
- LLMCallStage - LLM 调用(支持 ChatLLM/ChatAgent)
- MessageParseStage - XML 解析 + 三路 fallback
- ToolExecuteStage - 工具执行 + Agent 多轮循环
- ReplyDeliverStage - 消息发送 + 跨会话推送
- HistorySaveStage - 持久化 + inbox ack
Feature Flag 灰度系统(Issue #183 P0)
- 新增
use_pipeline配置项(默认false) - 支持运行时切换 Legacy ⇄ Pipeline 路径
- 零风险灰度部署 + 一键回滚
P0 修复
- 并发控制(Semaphore + per-session lock)
- ContextBuilder 初始化
- 文件发送失败通知
技术指标
- 代码量:+2500 行(实现 + 测试 + 文档)
- 测试覆盖:170 个测试(100% 通过)
- 质量保证:5 个 Opus 5 审查 + 2 轮 CodeRabbit
- 性能提升:2/10 → 8/10
- 安全性:6/10 → 9/10
使用方式
默认行为(安全):
# data/config/behavior.yaml
use_pipeline: false # 使用旧版流程启用 Pipeline(灰度):
use_pipeline: true # 使用 StandardPipeline或环境变量:
export TALE_USE_PIPELINE=true灰度建议
详见 PIPELINE_MIGRATION.md:
- Day 1-2: 本地测试验证
- Day 3-4: 10% 生产流量
- Day 5-6: 50%
- Day 7+: 100%
相关资源
- PR: #187
- 文档: PIPELINE_MIGRATION.md
- Issue: #180(已完成), #183(P0 完成)
注意事项
- 默认
use_pipeline: false,保持现有行为不变 - 建议灰度验证后再 100% 切换
- 回滚方式:设置
use_pipeline: false
完成阶段 1-4 架构重构,系统生产就绪!
Tale-AI v0.17.0
Tale-AI v0.17.0
🏗️ 架构重构(Issue #170)
阶段1:责任链模式(MessageHandler)
- 新增
core/handler/模块(353行) - PermissionHandler:黑白名单权限检查
- WakeWordHandler:@机器人、唤醒词、引用回复检测
- QuoteReplyHandler:引用消息检测
- 86 个单元测试,99% 覆盖率
阶段2:上下文构建模块(ContextBuilder)
- 新增
core/chat/context_builder/模块(497行) - ContextBuilder:上下文组装
- MetadataBuilder:元数据构建(ID脱敏)
- MediaRecognizer:图片识别(3s超时保护)
- HistoryProvider:历史记录加载
- 修复纯图消息无上下文问题(Issue #8)
- 58 个单元测试,96% 覆盖率
阶段3:ChatAgent 并发控制(P0核心)
- 新增
core/agent/模块(331行) - Per-session lock:同一用户串行,不同用户并发
- Semaphore(3):全局最大并发限制
- 移除全局
_chat_lock(性能提升 3x) - 超时保护:所有 LLM 调用增加 60s 超时
- 33 个真实执行测试(首次真实验证)
- 性能验证:3用户并发 0.51s(原 ~1.5s)
🔧 CI/CD
- 新增 GitHub Actions 自动化测试(Python 3.10/3.11/3.12)
📊 统计数据
- 15 个 commits
- 84 个文件变更
- +13009 / -440 行代码
Tale-AI v0.17.0 - Architecture Refactoring
🏗️ Architecture Refactoring (Issue #170)
Stage 1: Handler Chain Pattern
- New
core/handler/module (353 lines) - PermissionHandler: allow/deny list permission checking
- WakeWordHandler: @bot, wake word, quote reply detection
- QuoteReplyHandler: quoted message detection
- 86 unit tests, 99% coverage
Stage 2: Context Builder Modules
- New
core/chat/context_builder/module (497 lines) - ContextBuilder: context assembly
- MetadataBuilder: metadata with ID sanitization
- MediaRecognizer: image recognition (3s timeout)
- HistoryProvider: history loading
- Fixed pure-image message without context (Issue #8)
- 58 unit tests, 96% coverage
Stage 3: ChatAgent Concurrency Control (P0)
- New
core/agent/module (331 lines) - Per-session lock: serial per user, concurrent across users
- Semaphore(3): global concurrency limit
- Removed global
_chat_lock(3x performance gain) - Timeout protection: 60s timeout on all LLM calls
- 33 real executed tests (first real verification)
- Performance: 3 users concurrent 0.51s (was ~1.5s)
🔧 CI/CD
- Added GitHub Actions automated tests (Python 3.10/3.11/3.12)
📊 Statistics
- 15 commits
- 84 files changed
- +13,009 / -440 lines of code
Tale-AI v0.16.0 - 架构优化与性能提升
Tale-AI v0.16.0
核心更新
Prompt 系统大规模优化
- 精简 prompt 示例从 574 行到 423 行,减少 26% token 消耗
- 统一 few-shot 示例格式,提升 AI 理解一致性
- 优化
user_input结构,增强 AI 解析清晰度 - 删除低频
<tool>标签,简化输出格式 - 统一
<msg>标签说明文档
工具系统架构重构
- 统一工具注册机制,handler 纳入
ToolRegistry - 新增统一的工具调用日志和统计功能
- ToolLLM 支持独立配置,可 fallback 到 plan_llm
性能与稳定性改进
- 使用
BoundedCache替换无界 dict,防止内存泄漏 - 优化
today_plan位置,启用 prompt 缓存 - 修复 EventBus 事件序列化问题
视觉能力增强
- 消息包含图片时自动使用 VLM 识别,无需额外配置
安全性修复
- 消息元数据 ID 脱敏处理(P0 优先级)
测试覆盖提升
- 新增 Phase 1 完整测试套件
- 新增 17 个事件序列化测试
- 提升核心功能测试覆盖率
统计数据
- 21 个 commits
- 25 个文件变更
- +3659 / -453 行代码
- 6 个新功能,6 个修复,5 个文档更新
Tale-AI v0.16.0 - Architecture Optimization & Performance Enhancement
Core Updates
Massive Prompt System Optimization
- Reduced prompt examples from 574 to 423 lines (26% token reduction)
- Unified few-shot example format for better AI consistency
- Optimized
user_inputstructure for clearer AI parsing - Removed low-frequency
<tool>tags to simplify output format - Unified
<msg>tag documentation
Tool System Architecture Refactor
- Unified tool registration with handlers integrated into
ToolRegistry - Added unified tool call logging and statistics
- ToolLLM now supports independent configuration with fallback to plan_llm
Performance & Stability Improvements
- Replaced unbounded dict with
BoundedCacheto prevent memory leaks - Optimized
today_planplacement to enable prompt caching - Fixed EventBus event serialization issues
Vision Capability Enhancement
- Automatic VLM recognition for messages with images, no extra config needed
Security Fixes
- Sanitized message metadata IDs (P0 priority)
Test Coverage Improvements
- Added complete test suite for Phase 1
- Added 17 event serialization tests
- Improved core functionality test coverage
Statistics
- 21 commits
- 25 files changed
- +3,659 / -453 lines of code
- 6 features, 6 fixes, 5 documentation updates
Tale-AI v0.15.0
批量修复 — 安全/正确性/健壮性
由 @LyaQanYi 贡献的批量修复 PR #116,覆盖安全、正确性、健壮性、并发四类共约 25 处问题。Closes #97, #100, #101, #109, #110, #111, #112, #113, #114, #115。
安全
- SSRF 加固: 多 A 记录任一私网即拒,连接固定到校验 IP(thread-local pin,线程安全),逐跳重校验重定向;
browser.py与main.py图片下载均改用安全请求 - workspace 沙箱: 参数校验扩展到选项内联路径,子进程最小化环境,白名单移除
make/git/sed/env等可任意执行命令 - 插件安全: 禁用插件延迟导入,拒绝自定义插件顶替内置插件 id
- 计算器 DoS: 限制幂运算指数/底数/结果位数
适配器
- 微信去重集合改
OrderedDict,心跳按本地收包时刻计时 - 微信
send_message仅在真正发出内容时返回True - QQ 指纹去重加入分钟级时间桶;
is_bot消息直接IGNORE stop_adapter索引/实例清理移入finally
LLM / 配置
get_active_provider非 LLM 类型返回Noneparse_function_call增加isinstance守卫toolllm为None时降级提示- 会话迁移容忍字符串型 chunk
- context 动态段强制不可缓存
并发 / 跨会话
- ChatLLM 全局锁覆盖整段临界区
- pending 超时改按入队时刻判定
- 新增空闲 sid 淘汰(含孤儿锁回收)
- 跨会话失败反馈改走
add_system_message
其他
- 日程跨天处理、HH:MM 严格校验
- OpenAIEmbedder 兼容不支持
dimensions的第三方端点 - WebUI 日志 SSE 改 pub/sub 扇出 + 环形缓冲
Batch Fix — Security / Correctness / Robustness
Contributed by @LyaQanYi in PR #116, ~25 fixes across security, correctness, robustness, and concurrency. Closes #97, #100, #101, #109, #110, #111, #112, #113, #114, #115.
Security
- SSRF hardening: reject if any A record is private, thread-local IP pinning, per-hop redirect re-validation; secure requests in
browser.pyandmain.pyimage downloads - Workspace sandbox: extended arg validation to inline options, minimized subprocess env, removed
make/git/sed/envfrom allowlist - Plugin safety: deferred import for disabled plugins, reject custom plugin overriding built-in IDs
- Calculator DoS: bounded exponent/base/result for power operations
Adapters
- WeChat dedup uses
OrderedDict, heartbeat timed by local packet receipt - WeChat
send_messagereturnsTrueonly on actual send - QQ fingerprint dedup with minute-level time bucket;
is_botmessagesIGNORE stop_adapterindex cleanup infinallyblock
LLM / Config
get_active_providerreturnsNonefor non-LLM typesparse_function_callwithisinstanceguard- Graceful fallback when
toolllmisNone - Session migration tolerates string chunks
- Context dynamic sections forced non-cacheable
Concurrency / Cross-session
- ChatLLM global lock covering full critical section
- Pending timeout by enqueue time
- Idle session eviction (with orphan lock reclamation)
- Cross-session failure feedback via
add_system_message
Others
- Cross-day plan handling, strict HH:MM validation
- OpenAIEmbedder compat with 3rd-party endpoints lacking
dimensionssupport - WebUI log SSE switched to pub/sub fan-out + ring buffer
Tale-AI v0.13.4
v0.13.4 — 跨会话 sid 校验修复
修复
- session_send 的 id 必须是纯数字群号/用户号,禁止群名/昵称/占位符
- prompt 强调群号通过 query_group_list 工具获取(返回 group_id)
- _send_cross_session 增加 target_id.isdigit() 校验,非数字拒绝并反馈源会话
文件变更
2 files changed
v0.13.4 — Cross-Session sid Validation Fix
Fixes
- session_send id must be pure numeric group/user ID, names/nicknames/placeholders forbidden
- Prompt emphasizes group ID obtained via query_group_list tool (returns group_id)
- _send_cross_session adds target_id.isdigit() check, rejects non-numeric and feeds back to source session
File Changes
2 files changed
Tale-AI v0.13.3
v0.13.3 — 跨会话主动推送 + 群列表查询工具
新增
- 跨会话消息改为主动推送:AI 输出 session_send 后机器人真实发送 QQ 消息,用户实时收到
- 新增 query_group_list 工具:AI 可查询机器人加入的所有群聊列表(群号+群名)
- 元数据注入发送者ID,AI 可构造正确的私聊 sid
修复
- bridge.send 权限校验复用,主动推送不绕过安全策略
- 推送成功后 ack 去重,避免目标会话 consume 重复注入
- 推送失败时反向写系统消息到源会话反馈
- prompt 增强:session_send 格式/示例/隐私约束,严禁输出真实 QQ 号
文件变更
3 files changed
v0.13.3 — Cross-Session Active Push + Group List Tool
New Features
- Cross-session messages now actively pushed: AI session_send triggers real QQ message delivery, user receives in real-time
- New query_group_list tool: AI can query all groups the bot joined (group ID + name)
- Metadata injects sender_id, AI can construct correct DM sid
Fixes
- Reuse bridge.send permission check, active push does not bypass security
- ack after successful push prevents duplicate injection on consume
- Failure feedback written back to source session inbox
- Prompt enhanced: session_send format/example/privacy constraints, real QQ numbers forbidden in output
File Changes
3 files changed
Tale-AI v0.13.2
v0.13.2 — 跨会话桥接运行时修复
修复
- 修复 bridge.py 导入路径错误(from ..utils 改为 .utils,core 是顶层包)
- 补全 _send_cross_session 方法实现,含 30 秒超时和完整异常捕获
文件变更
1 file changed
v0.13.2 — Cross-Session Bridge Runtime Fixes
Fixes
- Fixed bridge.py import path (from ..utils to .utils, core is top-level package)
- Implemented _send_cross_session method with 30s timeout and full exception handling
File Changes
1 file changed
Tale-AI v0.13.1
v0.13.1 — 原生跨会话消息桥接 + 上下文管线修复
新增
- 新增原生跨会话消息桥接模块 core/bridge.py
- 跨会话消息收发(session_send),参考 KiraAI 设计
- 两阶段提交 consume/ack,at-least-once 语义
- UUID 去重(_processed FIFO 1000 + TTL 1h)
- per-session asyncio.Lock 并发保护
- 权限校验(同 adapter/同群组)
- 速率限制(10 次/分钟)
- 消息长度 500 字符上限,inbox 最多 20 条
- parse_xml 支持 <session_send> 标签解析
- prompt 添加 session_send 使用说明和会话列表注入
修复
- 移除历史文本块重复注入,改为结构化 messages 历史
- B1: Agent 多步工具调用后最终回复正确写入会话记忆
- B2: 全局 ChatLLM 锁修复跨会话历史串味
- B3: 朋友圈消息不再写入错误的会话记忆
- B4: 上下文窗口逻辑改为正向布尔变量
- 首次 chat() 调用传 save_to_session=False 消除双重写入
文件变更
5 files changed, 377 insertions(+), 68 deletions(-)
v0.13.1 — Native Cross-Session Bridge + Context Pipeline Fixes
New Features
- Native cross-session message bridge module core/bridge.py
- Cross-session messaging (session_send), inspired by KiraAI
- Two-phase commit consume/ack, at-least-once semantics
- UUID dedup (_processed FIFO 1000 + TTL 1h)
- per-session asyncio.Lock concurrency protection
- Permission validation (same adapter / same group)
- Rate limiting (10 per minute)
- Message length cap 500 chars, inbox max 20
- parse_xml supports <session_send> tag
- prompt adds session_send instructions and session list injection
Fixes
- Removed duplicate history text block injection, use structured messages
- B1: Final reply correctly persisted after multi-step tool calls
- B2: Global ChatLLM lock fixes cross-session context contamination
- B3: WeChat Moments no longer written to wrong session memory
- B4: Context window logic uses positive boolean variable
- First chat() call passes save_to_session=False to eliminate double-write
File Changes
5 files changed, 377 insertions(+), 68 deletions(-)
Tale-AI v0.13.0
v0.13.0 — 会话管理系统 + 文生图增强 + 修复
新增
- 添加会话管理系统(Session + SessionManager),参考 KiraAI 设计
- 添加 WebUI 会话管理页面:查看/编辑/删除会话、切换启用/禁用、增改删单轮记忆
- 会话历史持久化到 data/sessions/sessions.json,重启不丢失
- 添加 persistence_enabled 配置开关,可回退旧模式
- 日志文件自动轮转(5MB/3备份),防止无限膨胀
文生图
- 拆分文生图为拍照(take_photo)与画画(draw_picture),内置风格润色
- 新增火山方舟 Seedream 支持
安全修复
- 修复 data-* 属性存储型 XSS
- 单条记忆改用递增 id,消除 TOCTOU
- 修复 enabled 读写双侧门控
- 修复记忆污染:落库存纯净原文
- 修复并发竞争:全局 RLock + 唯一临时文件
修复
- AI 自主决定群聊 @/引用
- QQ @ 后加空格
- ChatLLM 集成 SessionManager
- 中/英/日三语 i18n
文件变更
17 files changed, 1433 insertions(+), 38 deletions(-)
v0.13.0 — Session Management + Image Generation + Fixes
New Features
- Session management system (Session + SessionManager), designed with reference to KiraAI
- WebUI session management page: view/edit/delete sessions, toggle enable/disable, add/modify/delete memory
- Session history persisted to data/sessions/sessions.json, survives restarts
- Added persistence_enabled config flag to fallback to old mode
- Log file auto-rotation (5MB/3 backups) to prevent unbounded growth
Image Generation
- Split into take_photo and draw_picture with built-in style tuning
- Added Volcengine Seedream support
Security Fixes
- Fixed stored XSS via data-* attributes: added escapeAttr
- Changed to incrementing chunk IDs, eliminating TOCTOU
- Fixed double-sided gating for enabled sessions
- Fixed memory pollution: stored pure original text
- Fixed concurrency: global RLock + unique temp files
Fixes
- AI autonomously decides @/reply in groups
- Added space after QQ @
- Integrated ChatLLM with SessionManager
- Chinese/English/Japanese i18n
File Changes
17 files changed, 1433 insertions(+), 38 deletions(-)
Tale-AI v0.12.0
v0.12.0 — 2026-06-19
新功能
- AI 发图能力(#104 阶段1):AI 可在回复中通过
<image>标签发送图片(URL 或本地路径)。Message增加images字段,parse_xml解析<image>标签(主路径 + 降级回退),回复流程透传 images 到适配器,支持纯图片消息 - AI 绘图能力(#104 阶段2):新增
ImageGenProvider文生图 Provider(OpenAI/SiliconFlow 兼容)+ImageGenerator单例 +generate_image工具,AI 可调用文生图并将结果通过<image>标签发出。FC 提示词工具列表改为从 registry 动态生成 - AI 看图能力(#104 阶段3):修复 VLM 链路死代码(
_ensure_client→_ensure_provider),收到图片先下载到 temp 再喂 VLM,支持针对性提问与多图联合推理 - 图片描述缓存:按 MD5(图片字节 + 识别 prompt) 缓存 VLM 描述到
data/cache/image_desc.json,原子写 + 两阶段锁,避免重复调用
改进
- QQ 适配器:图片 URL 过 SSRF 安全校验(复用
validate_url),本地路径转base64://编码与部署拓扑解耦 - ProviderManager:
type判断优先于format,正确注册image_gen类型供应商 - 配置:默认
routing.yaml增加image字段,services.yaml增加image_genprovider 示例 - 资源管理:文生图 base64 落盘改走
TempFileManager,24h 过期/100MB 上限自动清理 - 体验:纯图片消息给基础打字延迟,避免瞬发
Bug 修复
- #105:PlanLLM
_extract_json容错,修复日程解析死循环 - #103:QQ 适配器启动 TypeError(
_run_done为 None) - #98 #99:WebSocket 适配器生命周期缺陷 + RAG 删除清空索引
- 修复
integration.py重复方法定义导致的 IndentationError - context window VLM 路径 offload 到线程池,修复事件循环阻塞与重复识别
v0.12.0 — 2026-06-19
New Features
- AI Image Sending (#104 Phase 1): AI can send images via
<image>tag in replies (URL or local path).Messagegainsimagesfield,parse_xmlparses<image>(main path + fallback), reply pipeline forwards images to adapter, pure-image messages supported - AI Image Generation (#104 Phase 2): New
ImageGenProvidertext-to-image provider (OpenAI/SiliconFlow compatible) +ImageGeneratorsingleton +generate_imagetool. AI can generate images and send via<image>tag. FC prompt tool list now dynamically generated from registry - AI Image Recognition (#104 Phase 3): Fixed dead VLM code (
_ensure_client→_ensure_provider), images downloaded to temp before VLM call, supports targeted questions and multi-image joint reasoning - Image Description Cache: VLM descriptions cached by MD5(image bytes + recognition prompt) in
data/cache/image_desc.json, atomic writes + two-phase lock, avoiding repeated calls
Enhancements
- QQ Adapter: Image URLs pass SSRF validation (reusing
validate_url), local paths converted tobase64://encoding decoupled from deployment topology - ProviderManager:
typecheck takes priority overformat, correctly registeringimage_genproviders - Config: Default
routing.yamladdsimagefield,services.yamladdsimage_genprovider example - Resource Management: Text-to-image base64 landing now uses
TempFileManagerwith 24h expiry / 100MB cap auto-cleanup - UX: Pure-image messages get base typing delay to avoid instant send
Bug Fixes
- #105: PlanLLM
_extract_jsonfault tolerance, fixes schedule parsing infinite loop - #103: QQ adapter startup TypeError (
_run_doneis None) - #98 #99: WebSocket adapter lifecycle defects + RAG delete clears index
- Fixed IndentationError from duplicate method definition in
integration.py - Context window VLM path offloaded to thread pool, fixes event-loop blocking and duplicate recognition