Skip to content

ChatSpeed v1.1.26

Choose a tag to compare

@github-actions github-actions released this 29 Jan 08:53

[1.1.26]

🚀 New Features

  • Refined Proxy Statistics: Added "Today" (natural day) dimension to stats, complementing the "Last 24 Hours" view for a more intuitive perspective on daily usage.
  • Custom Header Defense System:
    • Full-Chain Filtering: Built-in blacklist for restricted headers (e.g., Host, Connection, Content-Length) in should_forward_header to prevent proxy protocol conflicts.
    • Source Validation: Added real-time validation in the AI Engine settings UI. Users are now alerted with localized error messages when trying to save restricted headers, avoiding confusion over failed forwardings.
    • Prefix-Aware Protection: The interceptor intelligently strips the cs- prefix before performing safety checks, ensuring no restricted headers bypass the filter.
  • Model ID Robustness Enhancement:
    • Full-Chain Noise Reduction: Implemented automatic .trim() handling in both backend forwarding logic (Body injection and URL splicing) and frontend model settings (Saving and Importing). This eliminates API authentication or matching failures caused by accidental leading/trailing spaces in configurations.
    • Protocol-Aware Model Injection: For OpenAI, Claude, and Ollama protocols, the proxy now forcibly inserts the correct backend model ID into the request body. This ensures the backend receives the expected ID even if the client omits the model field or passes an alias.

🪄 Improvements

  • Proxy Statistics Dashboard Optimization:
    • Real-time Auto-Refresh: The dashboard now supports automatic data updates every 10 seconds. Auto-refreshes do not trigger full-screen loading or clear current views, ensuring a smooth and continuous observation experience.
    • Parallel Data Fetching: Optimized the statistics dashboard by switching from serial to parallel requests (Promise.all), significantly reducing load times.
  • Header Forwarding Architecture Overhaul (Sandwich Logic):
    • Tiered Override Priority: Refactored the header construction pipeline to establish a strict hierarchy: Client Standard Headers -> Provider Config Headers -> Protocol Mandatory Headers -> Client cs- Overrides. This prevents standard client headers from accidentally overriding provider-specific configurations (like custom User-Agents) while maintaining the explicit override power of cs- prefixed headers.
    • Internal Metadata Passthrough: Restored the forwarding of internal identification headers such as X-Provider-Id, X-Model-Id, and X-Internal-Request for better observability.
  • Token Estimation Calibration: Fixed a major estimation bug in direct forward mode. The system now counts tokens only for plain text content, excluding massive counts caused by binary data like Base64 images.
  • Param Forwarding Strategy Optimization: Refined the handling of sampling parameters like stop. If the configuration is empty or resolves to an empty list, the field is no longer sent, ensuring compatibility with providers that enforce strict validation against empty values.
  • Performance & Stability Enhancements:
    • Streaming Robustness: Restored and optimized buffer flush logic for the Claude protocol, ensuring complete output delivery even during unexpected stream interruptions.

🐞 Bug Fixes

  • Assistant Window UX Fix: Resolved an issue where the Assistant window failed to auto-hide on blur and lacked reliable input focus upon being shown. Optimized focus handling specifically for macOS to ensure a smoother transition.
  • Codebase Cleanup: Eliminated multiple redundant header forwarding loops in chat_handler.rs, streamlining the backend execution path.
  • i18n Synchronization: Completed translations for "Today" statistics and "Restricted Header" warnings across all supported language packs.

[1.1.26]

🚀 新特性

  • 精细化代理统计:新增“今天”统计维度,支持按自然日查看统计数据,与“最近 24 小时”维度互补,提供更符合直觉的数据观察视角。
  • 自定义请求头防御系统
    • 全链路过滤机制:在 should_forward_header 中内置受限头黑名单(如 HostConnectionContent-Length 等),防止因自定义头冲突导致代理请求失败。
    • 源头校验增强:在 AI 引擎设置界面(UI)增加实时校验,用户尝试保存非法头时将弹出多语言错误提示,避免配置后无法转发产生的疑虑。
    • 前缀感知防御:拦截逻辑会自动识别并剥离 cs- 前缀后再进行安全比对,确保防御无死角。
  • 模型 ID 鲁棒性增强
    • 全链路自动去噪:在后端转发逻辑(请求体注入与 URL 拼接)以及前端模型设置(保存与导入)全面引入自动 .trim() 处理,彻底解决因配置中意外携带首尾空格导致的 API 鉴权或匹配失败。
    • 协议感知模型注入:针对 OpenAI、Claude、Ollama 等协议,代理层现在会强制在请求体中插入正确的后端模型 ID,确保即使客户端未传 model 字段或传递了别名,后端也能收到预期的 ID。

🪄 改进

  • 代理统计看板优化
    • 实时自动刷新:看板现在支持每 10 秒自动更新一次数据,且自动刷新时不会触发全屏加载或清空当前视图,确保了观测的连续性与平滑性。
    • 并行请求优化:统计看板的数据加载由串行改为并行(Promise.all),显著缩短了加载等待时间。
  • Header 转发架构重构 (Sandwich Logic)
    • 覆盖优先级梯队化:重构了请求头构建流程,确立了 客户端标准头 -> 供应商配置头 -> 协议必需头 -> 客户端 cs- 覆盖 的层级结构。有效解决了供应商自定义头被客户端默认头意外覆盖的问题,同时赋予了客户端 cs- 前缀头最高级别的显式覆盖权。
    • 内部元数据透传:恢复了 X-Provider-IdX-Model-IdX-Internal-Request 等内部标识头的透传功能,便于链路分析。
  • Token 估算算法校准:修正了直连转发模式下的估算漏洞。现在仅针对消息中的纯文本内容进行 Token 计数,完全排除了 Base64 图片等二进制数据带来的海量计数异常,确保统计数据的准确性。
  • 参数发送策略优化:优化了 stop(停止符)等采样参数的处理。当配置为空或解析结果为空列表时,系统将不再发送该字段,以适配对空值校验较严格的后端供应商。
  • 性能与鲁棒性增强
    • 流式处理加固:恢复并优化了 Claude 协议下的末尾缓冲区刷新逻辑,确保在流异常中断等极端情况下也能完整产出结果。

🐞 修复

  • 助手页面交互修复:解决了助手窗口在失去焦点后无法自动隐藏,以及唤起后未能可靠聚焦输入框的问题。特别针对 macOS 优化了焦点处理逻辑,确保交互体验更加顺滑。
  • 冗余代码清理:移除了 chat_handler.rs 中多处重复的 Header 转发循环,优化了后端执行路径。
  • 国际化同步:补全了所有语言包中关于“自然日统计”和“受限头提示”的翻译。